Jump to content

Ivan Gretsky

Members
  • Posts

    1,459
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by Ivan Gretsky

  1. I did try this and it did not work, because getById returns a PageArray, not a Page object in spite of the get part in the method name. Using something like first() on the returned result seems to give you the cashed (changed) version of the page. But there is a getOne option that managed to do the trick. So I could only get it to work like this: $oldPage = $this->wire('pages')->getById($page->id, array( 'cache' => false, // don't let it write to cache 'getFromCache' => false, // don't let it read from cache 'getOne' => true, // return a Page instead of a PageArray ));
  2. Thank you, diogo! As we are in tutorial mode here, it is worth mentioning the benefits of this approach versus the common echo / print_r / var_dump. I can think of two: You can check variables on the live site, where outputting things in the document html may scare site visitors. In some cases, for example in Reno theme, html output is hard to find and read on the screen. So console log is simply clearer. I am not sure (as I have not tested it), but this technique may help debugging PW admin with its redirects.
  3. It seems like you are trying to use "delayed output" aproach as you are extending on a standart site-languages profile. You have to put all the html generated in gallery template in a $content variable for it to be rendered in the _main.php. Like this: foreach($page->images as $image) { $thumbnail = $image->size(150,100); $content .= "<a class='gallery' rel='gallery-1' href='{$image->url}' title ='{$thumbnail->description}'><img src='{$thumbnail->url}' style=' padding: 5px;' ></a>"; }
  4. Maybe not as convinient, but if you are comfortable in editing json, you can export a text field with built-in PW field export feature, paste the generated code to text editor, duplicate it as many times as you want, edit nearly all the field's properties and import it back into your site.
  5. This is really awesome! Something to be proud of. I really need a few of your tricks on my current project so digging into the frontend source)
  6. Come on, adrianmak! You are on the block for a while now and know that all the cool kids use dev branch. I can't live without the Saturday morning presents on the blog and certainly do not want to wait for half a year to get them) There are no hotfixes to stable branch (at least that I know of) so really no point in staying behind.
  7. @Sradesign: Those are wonderful examples of what a custom admin theme for PW could look like. I do not think though that Tom should change his theme or incorporate any of it's parts including bootstrap. I am sure if you or me shall spare some time and actually produce the theme, it can under certain circumstances be included in the main PW branch as a third alternative. But it will actually be even simplier for it to just be distributed through modules directory (and it will save us from the need to keep it up to date ). I can see some troubles using bootstrap though as not only the chrome but all input's markup should be rewritten for that purpose. @renobird: I would like to ask your for a favour for PW community to share your knowledge about custom admin theme creating. If you could find some time and produce a little post with a tutorial on this topic it would be incredibly valuable, as Ryan's tutorial on this is rather outdated and probably no longer accurate. Personally, I am even more interested in creating not a complete admin theme replacement, but a theme with a limited functionality for non-superuser site editors.
  8. Thanks for the explanation, Ryan. Clear, clever and polite as always. I thought that this could be related to Avoine new project on top of PW. And it is... but in a broader sense. And I guess Teppo is right. For the sake of nurturing a devoted and confident open source community such questions should probably be debated for a while.
  9. I think you are right about that. But the task would require a team of well informed and highly capable people to help Ryan as it is probably not the task that could be easilly managed by one. One man is just not enough to manage both the developmrnt and the documentation (and the promotion, and the translation...) Some day the time will come to gather forces, so better get prepared - read the code and learn to write!
  10. In the comments to the latest PW blog post Teppo noticed the licence change that seem to be present in the new 3.x branch of ProcesswWire. It has changed from GPL2 to MPL2. What does this switch means to us? Earlier Ryan said that he is not so much into legal matter and just goes along with the big players like Wordpress and Drupal in the field of licencing, Obviously that is no longer the case. I am no expert in this matter, but as I can guess MPL2 will allow to produce a commercial version of PW to exist alongside with a community one. I am starting this topic to find out about what real difference the licence change will bring and to find out about the core development team plans concerning future of PW development.
  11. Another question. I try to tanslate the theme, but with no luck. I did add AdminThemeRenoHelpers.php for translation and added translations for strings I needed - the strings still appear in English. I can easilly translate strings from the core files like admin.php. What can it be?
  12. Hallo, Tom! Could you please hide the profile link in the avatar dropdown for users without profile-edit permission like you did in footer?
  13. I found this thread and it is a treasure for anybody doing some custom backend stuff! I still don't get half of it, but the answer is certainly there. Edit: Can't make the topic "solved" as this thread probably does not alow this.
  14. Ivan Gretsky

    Arguman

    And it is certainly worth exploring not only from developer point of view. Decent argument is so rare nowadays. Thanks for the share, diogo.
  15. I try to run ProcessPageEdit in a executeEdit method of another ProcessModule like this: public function ___executeEdit() { $out = $this->modules->get("ProcessPageEdit")->execute(); return $out; } It does work for almost everything, but not for a few selects, those option lists are formed with "Custom selector to find selectable pages" option + "Show this field only if". Those fielda appear blank and the dropdown is formed with root children pages. I think I could simply add a ProcessPageEdit as a child to my process page as a workaround, but it is still a bug...
  16. I do not think that there is (or is needed) an IDE specifically for PW. But there are ways to make some IDEs work better with PW (autocomplete and so). Try reading through these threads: 1) https://processwire.com/talk/topic/3336-pre-release-templatestubs-ide-support-for-page-objects/ 2) https://processwire.com/talk/topic/10747-phpstorm-autocompletion-and-typehinting-of-wirexx/ 3) https://processwire.com/talk/topic/2770-recommend-a-code-editor-with-ftp-for-working-on-template-files/ 4) https://processwire.com/talk/topic/3518-what-ide-do-you-utilize/ 5) https://processwire.com/talk/topic/7427-pw-api-as-autocomplete-in-your-ide/ 6) https://processwire.com/talk/topic/1498-better-phpdoc-comments-in-pw-classes/
  17. Damn, I like germans! CTRL is STRG on German keyboards, but still CTRL on Russian ones. Got some national pride! But if we didn't lose that cold war it could look like this...
  18. Maybe like this: $place=$page->place; $links = $pages->get("template=links, categories=$pcat"); echo "<h4>$links->title</h4> <ul>"; $filteredLinks = $links->urls->find('place=$place'); foreach ($filteredLinks as $u) { if ($u->desc) echo "<li><a href='$u->poiurl'>$u->urltext</a> ($u->desc)</li>"; else echo "<li><a href='$u->poiurl'>$u->urltext</a></li>"; } echo "</ul>";
  19. Check this out. Is that what you looking for? What is STRG by the way?
  20. Good day! Sometimes I find folders with names starting with a dot in the modules directory. For example: .ProcessCustomUploadNames .ProcessPageListerPro I believe they appear after upgrading with ProcessWireUpgrade module. Could you please confirm my suggestion. What is the use of those folders? Are they there for backup purpose? Is it safe to delete those folders?
  21. SteveB's solution should work. You can run the check not only on login, but periodically with Lazy Cron core module or with a cron job as kongondo suggested.
  22. Is there a way to define dynamic role on runtime based on user role? I have a number of similar roles named similarly (and they will be adding) for each of which I need to make a few dynamic roles. So I am looking for a way to make it DRY. Edit: I mean something like making a hook that generates a dynamic role via API.
  23. Thanks. Your module does redirect the user where it is needed. Bit I still have the "Pages" menu visible. How can I get rid of it?
  24. 1) I found the problem and the solution. Processwire cannot read post_max_size if it is defined in bytes (see here). It sets it to 5M in that case instead. Define your php_ini variables as 100g, 50m, 1200k, but not as 104857600. 2) And I have not been able to redefine the value due to little typo: it had to be $f->maxFilesize instead of $f->maxFileSize.
  25. Good day! I need to make custom admin interface for specific user role. I want them to only see those menus and menu items I selected. I do not want them to see "Pages". I plan to use custom Process modules under custom admin menu. But I do want to use PageEdit admin interface for editing pages. To make it possible, I have to set edit permission to the pages they are to edit. But that uncovers "Pages" menu for them. How can I achieve that, still using defaul or Reno admin theme? Or is it preferable to make my own?
×
×
  • Create New...