-
Posts
4,296 -
Joined
-
Last visited
-
Days Won
79
Everything posted by diogo
-
Hm, I don't really think it's extreme. When someone decided to install the software on a server, had to mess around with permissions and so... he has to be ready to learn the hard things of life
- 74 replies
-
- 1
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
I really don't see that much difference between {% for item in navigation %} <li><a href="{{ item.url }}">{{ item.title }}</a></li> {% endfor %} and <?php foreach($navigation as $item): ?> <li><a href="<?= $item->url ?>"><?= $item->title ?></a></li> <?php endforeach; ?> If you write it like this, you can forget the }} as much as the ?> Of course the Twig code looks a little more friendly at the first sight, but the advantages of getting used to writting PHP are worth it.
- 74 replies
-
- 2
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
What is the best practice to change the home page?
diogo replied to Robert Zelník's topic in General Support
You can also put this on your homepage template: <?php $page = $pages->get(123); // replace by the page you want to replace the homepage with include("./{$page->template}.php"); -
How to get admin page with certain Process assigned?
diogo replied to apeisa's topic in API & Templates
It's a bit strange... echo $pages->get('3')->process; // returns "ProcessPageList" echo $pages->get("process=ProcessPageList")->name; // returns nothing This happens even in a visible, non admin, template -
Oh, it's so different from what I posted! I didn't notice how the module is so different from it's beginnings
-
@Nico http://processwire.com/talk/topic/1310-multilanguage-urls-alias-creation/#entry11814
-
Not evangelical at all, as I'm not even an experienced programmer. I only learned PHP in the past few months, and I can say it was mostly because of the way PW is thought out. As a Designer I never thought I would be writing some rather advanced PHP so soon, but because PW uses PHP instead of a templating engine, and because it's designed to make it so easy for anyone to achieve basic tasks, you just feel encouraged to go further and further without any constraints. Really, just start building a website with PW without thinking of external tools, you don't even need to install any of the excellent custom modules that are already available, and you will see how easy it is and how powerful it can get
- 74 replies
-
- 6
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
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.
- 74 replies
-
- 2
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
check also the file permissions. make them all 777 just for testing
-
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");
-
@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
-
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.
-
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.
-
Looks good! Would be nice to give it a PW look and feel. I'm curious to see the inside
-
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
-
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.
-
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;
-
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?
-
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.
-
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.
-
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?
-
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
-
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;
-
I'm not sure if i understand. What do you mean by together? Can you put a scheme of what you want here?
-
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.