-
Posts
4,296 -
Joined
-
Last visited
-
Days Won
79
Everything posted by diogo
-
I am a graphic designer
-
It's simpler than you might think, maybe I can convince you to have another look at it by explaining the basics To make it very short. you have two important includes, main.php and blog.php. in main.php there is all the structural html that builds the page, in blog.inc you have the functions that will create most of the dynamic content. In almost all templates, both will be included, being main.php always the last thing in the file. This means that the variables that appear in the main.php code will get their content from blog.inc and from anything that comes in the middle of them. Here's a simple example focusing on the $headline variable: in basic-page.php we have: (this is actually all there is in the file) <?php /** * Basic Page template * */ include_once("./blog.inc"); $headline = $page->get('headline|title'); include("./main.inc"); in main.inc we have: if($headline) echo "<h2>$headline</h2>"; and in blog.inc we have: $headline = ''; In blog.inc, $headline appears also as a parameter in some functions that will be later used in main.inc, but for making the point this is enough. So, in the case of a basic-page we will have a heading with either the headline field content, or the page title; On a template that doesn't define a headline variable between including blog.inc and main.inc, we wouldn't even have the <h2> tags printed (case of home.php); And on the search page we have the result of this: $headline = sprintf(__('You searched for: %s'), $query); that will print "You searched for: whatever"
-
The blog profile has a completely different approach from the default install. Have a look at it http://modules.processwire.com/modules/blog-profile/
-
Maybe it would be a good idea to create a new method to find pages Starting in the homepage and running the branches from there, would this be possible? Like this we could do this kind of filtering very easily.
-
Idea for a community site - history timeline like Facebook
diogo replied to NooseLadder's topic in General Support
I'm trilled to see that the PW community is growing so well -
Textile is not for styling. What it does is replacing some characters by the typographically correct ones.
-
Idea for a community site - history timeline like Facebook
diogo replied to NooseLadder's topic in General Support
You can use $page->created for this -
If those pages don't have a template file, you could check for the existence of the file foreach($parents as $parent) { if(file exists) //echo link } or you can use the same template for all the section pages foreach($parents as $parent) { if($parent->template != "section") //echo link } or create a global field (available in all templates) from type checkbox, and check it on the section pages foreach($parents as $parent) { if($parent->section = 0) //echo link <-- EDIT: I changed from 1 to 0 here }
- 1 reply
-
- 2
-
Rename processwire directory on current installation
diogo replied to NooseLadder's topic in Getting Started
If you didn't hardcode the URL anywhere there shouldn't be any problem. -
or put on the description: "if left empty processwire will be used"
-
Adobe has a nice one You should consider FontSquirrel also, lots of fonts have a web version for download.
-
render() renders the template of the page, do the children of footer-blocks have a working template? edit: and happy birthday!!
-
There isn't a tool like this in PW. But honestly using it doesn't seem much easier than doing normal mysql queries... Is there any advantage?
-
The clients don't even need to see those pages. If you check "Allow new pages to be created from field?" on the field options, they will be able to create new pages on the field itself.
-
Create an "Options" page under "Admin" and hide it from searches (so it won't appear in the admin menu) and use it to organize all your options for the system: You will even forget they are in the tree
-
Thinking about this, maybe it would make sense to create a special field that would allow doing this without changing the way PW works. Look at the repeaters field for instance, all it does is create one new normal page for each entry (they are just hidden). Maybe it would be even enough to extend the Page FieldType to allow creating those pages from the field options.
-
Hani's module can be an alternative, but for now I do prefer to use the PW's way.
-
Never used it myself, but since it's a text formatter module it should work also in any text field. On the field options, go to the "details" tab, and add it from the text formatters dropdown.
-
You have many options, can even be a text field. If you ask for the entire URL, You just have to output like this: <iframe width="420" height="315" src="<?=$repeater->video?>"></iframe> If you ask for the video ID, do this instead: <iframe width="420" height="315" src="https://www.youtube.com/embed/<?=$repeater->video?>"></iframe> There is also a module for this http://modules.proce...er-video-embed/
-
Hm, not really: http://www.w3.org/TR/html5/common-input-element-attributes.html#attr-input-pattern
-
I think in this case a repeatable would be more friendly
-
Yes, but I think Soma is reporting to this post from Apeisa http://processwire.c...ine/#entry12629 I tried to answer without modifying your code too much, but I admit it came out kind of ugly. Soma's code is much better edit: also, if someone has troubles to understand these <? if(count($page->gallery)): ?> , <? endif; ?>, just have a look here http://php.net/manua...tive-syntax.php
-
if($page->body){ //not empty }else{ //empty } other options if($page->body) echo "body not empty"; if(!$page->body) echo "body empty"; for the second question: <?php if($page->gallery->count() > 0){?> <h6>Images</h6> <?php foreach($page->gallery as $slide) { echo "<a rel='prettyPhoto[pp_gal]' title='{$slide->gallery_caption}' href='{$slide->gallery_image->url}'> <img class='peKbGallery' data-delay='{$slide->gallery_delay}' src='{$slide->gallery_image->url}' alt='{$slide->gallery_caption} (Click to enlarge)' /> </a>"; } } ?>
-
Depends on what news you want to appear there. Random? Latest highlights? For latest highlights for instance, you could put a "highlight" checkbox on the news template, and call the last five like this: $highlights = $pages->find("template=template-news, sort=-newsDate, highlight=1, limit=5");