Jump to content

diogo

Moderators
  • Posts

    4,314
  • Joined

  • Last visited

  • Days Won

    80

Everything posted by diogo

  1. Hi. and welcome to the forum! There's not really a point on implement something like this in Processwire. PW use of PHP is very well thought to make it easy to anyone with no PHP skills to learn and use. Have a look at this page where Ryan explains this design decision http://processwire.com/api/why-php-syntax/. The context of this quote is a blog ready-to-use PW install. Ryan meant that this profile should be as easy for non-programmers to start using immediately.
  2. check also the file permissions. make them all 777 just for testing
  3. The page fieldtype refers to the page object itself, and not the id. So this should work: $news = $pages->find("template=news-post, news_section=$page, limit=5");
  4. @mcmorry, this is not what I meant. I was referring to those situations when the landing page doesn't have any content, only the language choice. In this case would make sense to have it in mysite.com, and then the English homepage in mysite.com/en, and the Portuguese homepage in mysite.com/pt
  5. Yes, I agree, and this is how I would probably implement it. But this is a design issue, and would be great if the module would allow people to have their own design solutions instead of imposing one.
  6. I like netcarver's idea. But there are also cases when the homepage is just a place where people choose the language. In this case, the homepage should be neutral, and mysite.com should be a different page from mysite.com/es If some fix will be implemented, it would make sense to have these different situations as options on the module settings.
  7. Looks good! Would be nice to give it a PW look and feel. I'm curious to see the inside
  8. This is what the repeater field does, except that the pages are hidden inside the special page "Admin>repeaters". This was actually one source of inspiration for the repeaters in PW http://processwire.c...t__40#entry4906
  9. I see another problem. for Portuguese should be pt and not pr I also think think it would be nice to have this option. Hope there is a way.
  10. Updated the module to prevent this to happen. Now it checks for the title, and if it isn't there, it outputs the name $out .= $c->title ? $c->title : $c->name;
  11. Ryan, I did the changes you suggested and all is working. Updated the file already. Lars, it seems to be correct. Anyone knows what might be happening?
  12. Strange. I uninstalled the module and erased the page, and then installed it again and created a new page with the process. Then I created a comments field named "article_comments" and changed the field name option to this name. Added the field to a template, and changed from "comments->renderForm()" to "article_comments->renderForm()" on the template file. Then I added some dummy comments to some pages, and I got the expected list with those pages. Then I went through those pages and Approved all the comments. I get the no comments message as expected.
  13. The page fieldType already allows you to sort by dragging. Just choose the option "pageListSelectMultiple" under "input field type" on the "input" tab. As for inheritance, I think it should be more clear what you pretend before deciding the method, But for what I understand, it would make more sense to do it automatically on the template.
  14. I did some changes to the module. Now it supports three options on the settings of the module: Name of the field Sentence for when there are no pending comments Sentence for when there are pending comments Can you test it?
  15. Here is the module Just install it and create a page as child of "admin" with the "admin" template, and assign the process "ProcessCommentsList" to it. Edit: changed some details on the module Edit2: added some options to the module settings Edit3: updated the module with some changes suggested by Ryan Edit4: minor change -- replaced the word "Sentence" by "Message" on the options Edit5: No need for a title when outputting the link to the page. If it is not there, the name is used instead ProcessCommentsList.module
  16. I'm still a bit confused with what you need... still, another try: function treeMenu(Page $page = null, $depth = 1, $id = null) { $depth -= 1; if(is_null($page)) $page = wire('page'); if(!is_null($id)) $id = " id='$id'"; $out = "\n<ul$id>"; $out .= "\n <li class='level-1'>\n <a class='level-1' href='{$homepage->url}'>{$homepage->title}</a>\n </li>"; // added the homepage here $parents = $page->parents; // This is where we get pages we want. You could just say template!=news-item foreach($page->children() as $child) { $class = "level-" . count($child->parents); $s = ''; if($child->numChildren && $depth > 0 ) { $s = str_replace("\n", "\n ", treeMenu($child, $depth)); } $class .= " page-{$child->id}"; $class = " class='$class'"; $out .= "\n <li$class>\n <a$class href='{$child->url}'>{$child->title}</a>$s\n </li>"; } $out .= "\n</ul>"; return $out; } $homepage = $pages->get("/"); //parameters: current page, menu depth, ul menu id $menu = treeMenu($homepage, 2, "myMenu"); // this will make the menu be the same in any page echo $menu;
  17. I'm not sure if i understand. What do you mean by together? Can you put a scheme of what you want here?
  18. Hm, i think i would approach this like this: Create all your blocks as children of a "Blocks" page (this page can be wherever you want on the pages tree). The blocks can have different templates, and should be not visible on site. Create two fields with Type "Page". One named "left" and one named "right". Make them "multiple pages" and set the "Parent of selectable page(s)" to "Blocks". Add those two fields to the templates of the pages where you want the sidebars. Now anyone editing those pages can add the blocks to any of the sidebar fields. You can render them like this: echo "<ul id='sidebar-left>"; foreach ($page->left as $block) { echo "<li class='{$block->title}'>"; $block->render(); echo "</li>"; } echo "</ul>"; For the inheritance, you can iterate all the ascendant pages, and check if they have any blocks. If they do, and if they are not on your array already, prepend them to it. $left = $page->left; // all the blocks from this page foreach ($page->parents as $parent) { // all the parent pages down to the root foreach ($parent->left as $block) { // all the blocks on each parent page if (!$left->has($block)) { $left->prepend($block); // if this ancestor has a different block, prepend it } } } // now we can do the same as above but with all blocks since the root page (not repeated) echo "<ul id='sidebar-left>"; foreach ($left as $block) { echo "<li class='{$block->title}'>"; $block->render(); echo "</li>"; } echo "</ul>"; Just a rough draft to give the idea. Not tested (and broken for sure) and not considering lots of aspects, like checking if fields exist for instance.
  19. You can easily list all pages that have pending comments and link to their admin pages like this: foreach ($pages->find("comments.status=0") as $c){ // status 0 means pending echo "<li><a target='_blank' href='{$config->urls->admin}page/edit/?id={$c->id}'>{$c->title}</a></li>"; } If I have time tomorrow, I can try to make a process module with this, so you can have the list on an admin page.
  20. When you use a page field you can always relate the pages both ways. Only the way you call them is different. You call B from A like this: $page->pagefield and A from B like this: $pages->get('pagefield=$page') where A is the page that has the page fieldType
  21. Welcome newbie I did a small change to the code, so it includes the self page on the tree. EDIT: the code I posted wasn't working. Using the same code you posted here, just change the end (after the function closes) to this: $homepage = $pages->get("/"); $menu = treeMenu($homepage, 3, ""); echo "<ul id='myMenu'>"; echo "<li class='level0'><a class='level0' href='{$homepage->url}'>{$homepage->title}</a>"; echo $menu; echo "</li></ul>"; This is not a very elegant way of doing this. Would be best to change the function. But it works.
  22. I wasn't clear enough. To be clear now, the image is the result of this code foreach ($input->urlSegments as $segment) { echo "<h3>{$segment}</h3>"; } added on top of the default site-map template
  23. Bug?? I was showing that it works! edit: the image was to show that the segments are working well. What did you think was a bug? That there is one page with English name? If it's that, don't worry, that's the only one that I didn't define a Portuguese title
  24. @diogo
×
×
  • Create New...