Jump to content

MadeMyDay

Members
  • Posts

    371
  • Joined

  • Last visited

  • Days Won

    8

Community Answers

  1. MadeMyDay's post in Can't find the children was marked as the answer   
    Should be:
    $pages->get("/about-us/meet-the-team/")->children("include=hidden"); since the children are hidden and not the parent. And also I prefer to get the parent by id since changing the page name would make your selector return nothing. For example if your team page has id 1020:
    $pages->get(1020)->children("include=hidden");
  2. MadeMyDay's post in Help for creating Tags please! was marked as the answer   
    First of all, create a template called "tags". It is totally fine to leave as it is, just a "title" field, no need for a PHP-file (for now). To be sure, only allow children with template "tags" in the template "family" tab.
     
    Then create your hidden "tags" page. Put same tags in it (that means: create children pages with your tags as title) if you like.
     
    Correct. Template for selectable pages is "tags". You can also define your hidden tags page as parent. No template file needed (for now).
     
     
    Not necessarily.
     
     
    or from the page select field itself (very convenient).
     
    So for that you need to have a .php file as template for the template "tags". 
    First, create your tag list like this:
    echo "<ul>"; foreach($pages->get('/tags/') as $tag){ //iterate over each tag echo "<li><a href='{$tag->url}'>{$tag->title}</a></li>"; // and generate link to that page } echo "</ul>"; (totally untested, but you'll get it).
    Since the tag pages have no template yet, this will throw an empty page (or 404, don't know).
    So let us create a template for the tag pages, which lists all pages with that tag:
    // Beginning of your template here (head etc.) // select all pages with the tag of this tag page $thisTag = $page->title // Current clicked tag $tagPages = $pages->find("Tags.title=$thisTag"); // select all pages where page field "Tags" contains a page with title of our tag foreach ($tagPages as $tp){ // iterate over the pages with that tag // and generate some teasers (or what you like) echo " <div class='teaser'> <h3>{$tp->title}</h3> <p>{$tp->summary}</p> <a href='{$tp->url}'>Read more...</a> </div>"; } // Rest of your template here (footer, javascripts etc.) as I said, totally untested, but this should point you in the right direction.
×
×
  • Create New...