Jump to content

diogo

Moderators
  • Posts

    4,287
  • Joined

  • Last visited

  • Days Won

    79

Everything posted by diogo

  1. @codelearner Listen my friend, everyone is tired of trolls. If you don't have anything to say, just don't. Consider this an absolutely last warning.
  2. Damn! I've been away from writing in the forum for so long, and now I'm being pulled in by another stupid discussion... @codelearner If you like Django so much, I can't honestly think of a reason why you're not at their forum instead... can you explain? Are you here because you're seriously interested in PW? Than open your mind, people at this forum have a lot of knowledge to share and they will do it in the most friendly way you've experienced on the internet. If you just want to pick a fight please go somewhere else, Reddit would be a great place to start.
  3. You came to some pretty solid conclusions in less than a week
  4. Thanks guys! Yeah, the site is a bit heavy on the images, but I think in this case it makes sense, since they are there to present their work. @rick, we are aware that there's no scrollbar. Can you scroll with the wheel or the pad, or you can't scroll at all?
  5. Hi guys! I've been a bit away from the forums lately but I didn't forget you all (well, I'm not writing much, but visit all the time) Here is our latest site http://www.plateau.studio The design is by Plateau themselves. Some of you will probably recognize "The Weekender" magazine from their portfolio, since we also did their site some time ago https://www.the-weekender.com
  6. Hi Louis, I suspect that this might have to do with the user himself. Can you indicate the user and post in question?
  7. diogo

    gamisch.ch

    We're developing the site for a Swiss architect, and meanwhile we prepared a very simple temporary page: http://gamisch.ch/ It's powered by PW, so I thought I should post anyway
  8. On the subject: https://blog.toggl.com/how-does-music-affect-work-infographic/
  9. Are you getting any error message? Can you try this and see if it works? $user->of(false); // this disables output formatting $user->my_planet = "mars"; $user->save('my_planet');
  10. Since a few days I'm completely addicted to listening to this while working https://www.youtube.com/channel/UC5FUNVH36ebM6ffQd3rvz8g
  11. @PWaddict I think you can add icons only to templates, and not individual pages. On the instructions I tell you to give the "admin" template to the pages, but I guess you could create a new template for it as long as it has you assign the "process" field to it. Be aware that this field won't appear on the select when assigning fields to templates, so you will have to create the template and then go to the fields list — show built-in fields — edit the "process" field — from there, add it to your new template.
  12. diogo

    Toggl button for PW

    Hey! My pull request with an integration for PW for the Toggl Chrome button was just accepted, yay! https://github.com/toggl/toggl-button/pull/788 For those who don't know, Toggl is a really great time tracker, and they have a handy Chrome extension that integrates with web apps by adding Toggl buttons to tasks and projects. Generally, these integrations are with task manager apps and CRMs, but I thought I could develop an integration for the PW admin. Although I did it mostly for the fun of it, I think this can be useful in some cases, and definitely it's great to see PW featured on their extension and github page!. They also seem to be quite picky with these integrations, so I'm glad they accepted the pull request. Here are some images to give you a taste of it
  13. @Sérgio just to let you know. I did a small test, and without making any change, the module already has kind of multilanguage support because the value will be set in the language of the user visiting the page. So, if you set the TRUE parameter to force the value and visit the page with another language, it will actually set the values in that language to the values that are currently set in the value parameter. Not sure if that's more useful than editing the page in the admin though.
  14. Thanks @Sérgio! Just some minutes ago I added the possibility to create multi language fields and uploaded a new zip file. This doesn't let you add the language values, it only allows you to define the field as multi language. I'm not sure how useful it would be to add the possibility to add the language values, since it can get really complicated in sites with lots of languages and I thought of this as a fast development tool. I would check how to support all major field types first, and then think of multi language.
  15. Hey! This is a very early/experimental/alpha not for production environments release of a new module I'm working on. Just testing the possibilities and the interest that might be for such a thing. The idea is to be able to quickly create fields while working inside the template files without having to go to the admin. For example, in an early stage of development when creating a layout, insteading of putting a placeholder headline and then going to the admin to create the headline field where the real content will be, you can create the field directly from the template file by doing: <h2><?=$page->field("A nice headline", "headline", "text")?></h2> This will create a new "headline" text field when it doesn't exist in the system and add it to the the template of the page you're working on and add "A nice headline" value to it. On a second run the module will recognize that the field already exists on that template and will simply return it's value. The method accepts three string parameters in the order ( value, field name, field type ). Value and name are required but field type will assume "text" when omitted. $page->field("A nice headline", "headline"); // creates a text field $page->field("A nice paragraph", "body", "textarea"); // creates a textarea field The method also accepts a boolean parameter in any position: TRUE forces the value to be saved into the field on that page, FALSE (or omitted) sets that value to the field when it adds it to the template, but leaves it how it is when the field already exists in the page. This is the only situation when this module can be destructive, and it's only concerning the value of the field on that page: $page->field("Another nice headline", "headline", TRUE); // will create or add a text field and add the value to the page even if the field already exists there The method also accepts an array as parameter. This array will be used as options for the creation of the field. The options array will override the string parameters when they clash. $page->field("A nice headline", "headline", array( 'name' => 'subtitle', 'label' => 'Subtitle' )); // will ignore the name "headline" and use "subtitle" instead As soon as the fields are created and added to the template, all the method will do is return the value, just like if using $page->headline, unless you use the TRUE parameter which will override the value of the field by the value in the first parameter. -- With this module you can, for instance, convert an existing HTML template quickly, just by pasting the html into a template with no fields created yet, and going through all the code, replacing the content by calls to my field() method. In the end you should have a working page with all the fields created in the template. Now you just need to go to the fields and adjust their preferences. So, just download it > install it > test it > tell me what you think! dynamicPageFields.module.zip -- Edit: Multilanguage fields threw an error but they don't now. You can create a multi lang text by doing: $page->field("A nice headline", "headline", "textlanguage"); that third parameter is just a case insensitive simplification of input field names to make it easier to write. You can still use the original input field name like "FieldtypeTextLanguage" if you prefer.
  16. And here goes some code. Place this on site/ready.php (or create a module from it) and edit the first lines to your liking: /*************************/ /******* EDIT HERE *******/ /*************************/ // ID of the page where the custom content is $this->pageID = 1; // name of the field where the custom content is $this->fieldName = 'body'; // name of html tag and id from the parent of the custom content on the 505 file $this->elementTag = 'div'; $this->elementID = 'message'; /*************************/ /******* END EDIT ********/ /*************************/ // regex to get the contents of parent element $this->regex = '/(<'.$this->elementTag.'\sid=("|\')?'.$this->elementID.'("|\')?>)([^<]|<.+>.*<\/.+>)+(<\/'.$this->elementTag.'>)/i'; // On save the content of the field on the 505.html file $this->addHookAfter('Pages::saved', function(HookEvent $event) { $page = $event->arguments[0]; if($page->id !== $this->pageID) return; $file = wire('config')->paths->templates . '/errors/500.html'; $content = file_get_contents($file); $field = $this->fieldName; $content = preg_replace($this->regex, '$1'.$page->$field.'$3', $content); file_put_contents($file, $content); }); // On render the edit page, save the content of 505.html file on the field to show it $this->addHookBefore("ProcessPageEdit::buildFormContent", function(HookEvent $event) { $page = $event->object->getPage(); if($page->id !== $this->pageID) return; $file = wire('config')->paths->templates . '/errors/500.html'; $content = file_get_contents($file); preg_match($this->regex, $content, $matches); if($matches) { $page->of(false); $field = $this->fieldName; $page->$field = $matches[0]; $page->save($this->fieldName); } }); The above code assumes that your "505.html" file has a <div> with the id "message" in it, you just have to adapt it to yours.
  17. You can create a page with a ckeditor field and then hook on save to rewrite the static file. No time to give you code now.
  18. Or just output the same PHP for all and deal with the differences with css nth-child.
  19. It worked with me, it's stuck in my head now, damn you!
  20. "Everything has to be a thing, even if you don't use it as a thing"
  21. Let's focus on solving the problem without making too many assumptions.
  22. You could also get the images directly from the assets/files directory with PHP.
  23. Only thing I can think of is to limit the search also by template: foreach (wire('fields')->find("type=FieldtypeImage") as $f) { foreach (wire('templates') as $t) { foreach (wire('pages')->findMany("template=$t, $f>0, include=all") as $p) { // etc... } } }
  24. Welcome to the forum Sam. I'm not sure why you are using the @ in your selectors (or is it a glitch from the forum? ). Doesn't it work when you simply leave it out? eg: R.c.count=0 Edit: I guess it's not a glitch from the forum. Just saw that you have it in the title.
×
×
  • Create New...