Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. Some minor but helpful updates to MarkupSimpleNavigation 1.3.0 http://t.co/dyrjSSc8IP - http://t.co/5qF7ta9Tux #processwire

  2. Just pushed some updates. Module is now v1.3.0 Form readme: Changes in 1.3.0 Changed module setting singular to false. This enables you load the module as a new instance with $nav = $modules->MarkupSimpleNavigation. This changes behavior for hooks attached to such an instance as it will only be called for this instance. This allows you to create multiple instances of the module to create different navigations with separate hooks. Added support for Page::listable. So you can exclude listing of pages in runtime by modifying this page permission. This can be done using a system hook on Page::listable and set the hook event to return false. Added new option date_format for created and modified native page properties. Added new option code_formatting, to enable or disable code formatting (indentation and newlines) of output markup. Added new option debug that will output rendertime and selector infos as commented inline html. Added support for Page::listable Usually you won't need this, but I needed it in a project so thought it wouldn't hurt. Usually you can hide pages from rendering in a list/navigation by setting the page to hidden in the admin. So this additional check in the module itself, allows you to make pages not listed on runtime. This can be used to check for logged in users that only should see the page listed when logged in. Example hook inside template just before calling render(): wire()->addHookAfter("Page::listable", null, "hookPageListable"); function hookPageListable($event){ $page = $event->object; if($page->template == "internal-page") { $event->return = false; // set listable to false if template "internal-page" } } Added new option debug If set to true this option will add an inline <!-- [MarkupSimpleNavigation Rendertime: 0.0171] --> after the markup output to show rendertime, and <!-- [Selector Level1: limit=3] --> on each item to see selector being used. This new version should still be compatible with older versions. But there could be instances where it could behave different when you have multiple navigations and using hooks. But chances are very small you run into this. If you have questions to the above just ask.
  3. Kongondo is right. "parent_class" => "parent" is to set the class for parents of the current page. You don't have to do anything to make it work it just works, all parent list items will have a class="parent".
  4. Just to make it complete with a working example (now at desktop): $treeMenu = $modules->get("MarkupSimpleNavigation"); $rootPage = $page; $options = array( 'current_class' => 'current-menu-item', 'has_children_class' => '', 'max_levels' => 2, 'outer_tpl' => '<ul class="dl-menu">||</ul>', 'inner_tpl' => '<ul class="dl-submenu">||</ul>', 'item_tpl' => '<a href="{url}">{title}</a>', 'item_current_tpl' => '<a href="{url}">{title}</a>', ); echo $treeMenu->render($options, null, $rootPage);
  5. I completely see and agree, but I think i wasn't too clear with what the current behavior is wrong. There's no difference from redirecting from "/" to "/en/" than from "/en/" to "/". But currently I can't redirect from "/" to "/default/" as that would give me a endless re-redirect. I think it should be to the developer to decide whether he want the one or the other. (This of course would be when there's a "home" page name for default language defined.) Sorry if I completely missed the point
  6. What diogo said. I have also, without going away, a lot of trouble keeping up with the pace. Times to change something.
  7. You have the rootPage as second argument. Insert null as second, this is to overwrite current page active.
  8. If you read the manual you'll find that the last argument you can specify the root parent page... that would be simply the current $page.
  9. A good reference would be the HelloWorld.module that comes with PW in /site/modules/. Or here is some great summary write up by the great teppo http://www.flamingruby.com/blog/using-hooks-to-alter-default-behavior-of-processwire/ wire()->addHookProperty("Page::itemCode", null, "itemCodeHook"); When a hook is added in template code we use wire(), as this is the base class of PW that contains the hook methods. addHookProperty() adds a new property to the object specified with "Page", so "Page::itemCode" adds a itemCode to page objects. $page->itemCode would return the code returned by the hook. "null" is usually the context for the hook, but doesn't need one in template code. Last argument is the function name of the callback that is used for this hook.
  10. Soma

    I'm back

    Glad to have you back!
  11. I just committed suic.. ehrm an update to ColorPicker. As of 2.0.0 you can enable output formatting of the field in the details settings. When enabled it will format value directly from AADDEE to "#AADDEE" and "transp" to "transparent".So you can now simply write: echo "background-color: " . $page->color; // outputs // background-color: #AEADEA added converting "0" settings to "000000", just in case This update should be save to update and backward compatible, but as always you should first test on a development server if you have a chance. In case something went wrong just ask here in the forums and I'm sure it will be solved within short time. Thanks
  12. I see and kinda agree. But maybe rather add formatting to the field than change current 6 chars. Remember you could do that yourself with formatValue hook or property instead of local tpl logic.
  13. I see. Hmm changing it to # would work in this case but break compatibility. So not positive to change it for something that is broken in PW. A string is a string not a number.
  14. No. to be more clear it happens with all textfields in settings of fields or modules. Except title, names or labels. I enter for example 000 and get 0 after saving. Ok happens also for labels but only on alternative language. I have multilanguage installed, but otherwise I have no idea, nothing else I can think of. And it also happens to others as reported multiple times.
  15. That is because the module is singular. Same instance same hooks, and as far as I know you can't know what the source is, whatever that would mean. If you set "singular" => false, you could create a new instance that will be separate with hooks. But I think you could also define the item content using a property hook and use that to output custom stuff. wire()->addHookProperty("Page::itemCode", null, "itemCodeHook"); function itemCodeHook($event){ $page = $event->object; if($page->template == "xyz"){ $event->return = "<i>your markup for this page</i>"; } } $options = array("item_tpl" => "{itemCode}"); $nav->render($options); This way you don't need to hook module.
  16. As far as creating your own RSS list with PHP, I think there tons of examples out there if you search google. There's even one in this thread on first page! http://processwire.com/talk/topic/105-rss-feed-module/?p=6701
  17. RSS styling, also maybe read the Post Ryan made 3 posts above yours in here: http://processwire.com/talk/topic/105-rss-feed-module/?p=37799
  18. As if I could know you are not capable of doing things that require some coding when doing things that are not covered by ProcessWire. As for your question above, I really don't know as I don't understand how a RSS feed is getting sent? I usually serve a RSS XML Feed url that people subscribe to so there seems to be no "send out"? But I see there's a TTL for the feed settings, which as far as I know is the interval a reader is meant to update the feed, but there's no "at that hour" setting in a RSS feed as little as I know. The RSS module supports XSL stylesheet as far as I know. But it doesn't support custom content for the description field. I have never done RSS feeds that are styled or contains more than the standard "description" text. I guess it depends on what readers are capable of, similar to Newsletters. I usually try to avoid it, so I can't help there. https://www.google.ch/#q=formatting+rss+feeds As far as Custom content goes there could be a simple trick to feed the RSS module description "itemDescriptionField" (default "summary") field used with custom content. Before the RSS creation code in the template, you could define a local hook to add a new custom property to Page. // hook to add new property to pages, this makes $page->customDescription return some formatted code; wire()->addHookProperty("Page::customDescription", null, "customDescription"); function customDescription($event){ $page = $event->object; $event->return = "<h1>$page->title</h1><p class='lead'>$page->summary</p><img src='{$page->image->url}'>"; } // RSS generation using the above customDescription "field" $feed = $modules->MarkupRSS; $limit = 20; $articles = $pages->find("template=post, sort=-date_published, limit=$limit"); $feed->itemDescriptionField = "customDescription";$feed->render($articles);
  19. So you're using ProcessWire Admin login for frontend login? ProcessLogin is only meant for backend login, and it has only a GET id for editing pages. So the id (if set with ?id=1231) will get appended to the form action url. This will be looked for and redirect to the edit screen after login. ProcessLogin::afterLoginRedirect is hookable, so you could replace it depending on what user logs in. After all since it looks like a front end login you should consider creating your own login form, where you have full control and don't let everybody see where your backend login is.
  20. That looks like a permission issue with FTP and Apache/PHP user. As soon as you delete it PHP will create a new cache file and thus is again the owner.
  21. RSS is not meant for unpublished pages! #157 foreach($this->feedPages as $page) { if(!$page->viewable()) continue; $out .= $this->renderItem($page); } Why not just simply create your own xml list? Or copy the RSS module to your site/modules and rename/modify it to your need.
  22. That's a strange one. But There's anyway a couple strange things when using PW search with selectors sometimes. On my new blog http://soma.urlich.ch this doesn't happen and I have the same code. When I search for & it get's transformed to "&" and it finds results that contain no visible "&". On all other PW sites there's an error. On processwire.com if you enter "test&" you get some results and the first search entry " iPhone test is strange as it is a page that isn't viewable! Anyway, searching with like "some & string" isn't a problem, and maybe just a min char count test on the search form could easily prevent error for things like "&".
  23. No I mean the code for prev next by teppo, not the one I wrote cause that's different thing. if ($input->pageNum) { $limit = 15; // whatever limit you're actually using if ($input->pageNum > 1) { echo "<link rel='prev' href='{$page->url}{$config->pageNumUrlPrefix}".($input->pageNum-1)."' />"; } if ($input->pageNum * $limit < $items->getTotal()) { echo "<link rel='next' href='{$page->url}{$config->pageNumUrlPrefix}".($input->pageNum+1)."' />"; } } Or $limit = 12; // the "limit"-setting used on this page $children = $page->children("limit=" . $limit); $totalpages = ceil($children->getTotal() / $limit); // PAGINATOR: set SEO tags for Google if ($input->pageNum) { if ($input->pageNum < $totalpages) { echo "<link rel='next' href='" . $page->url . $config->pageNumUrlPrefix . ($input->pageNum + 1) . "' />"; } if ($input->pageNum > 1) { echo "<link rel='prev' href='" . $page->url . $config->pageNumUrlPrefix . ($input->pageNum - 1) . "' />"; } } I don't think modifiying the pager module is good or easy, as you're saying your not a coder even less. And pager module doesn't allow to do what you need. But with some custom code in template you can more easily generate a next link based on the pageNum etc. Maybe someone can help you getting the logic from the above script to what you exactly need.
×
×
  • Create New...