Jump to content

renobird

PW-Moderators
  • Posts

    1,699
  • Joined

  • Last visited

  • Days Won

    14

Community Answers

  1. renobird's post in Update 2.6dev to 2.7.2 stable - Page tree menu gone was marked as the answer   
    Hi Tom,
    I think this was corrected in 2.7.3 or so (somewhere on the dev branch). To fix it in 2.7.2, unhide Admin > Pages.
  2. renobird's post in "Take down" Image after Time Expires was marked as the answer   
    You would just need to check if there is an expiration set, if there isn't, then just stick with the first image. If there is an expiration set, then check the dates and respond accordingly.
    untested, written in browser.
    $url = $page->timed_image->first()->url; // default to first image, make sure your image field is set to multiple. $expires = $page->select_timed_expire // assuming you set output format for this field to the same as $now. if ($expires){     if (date("Y-m-d h:i:s") > $expires){         $url = $page->timed_image->eq(1)->url; // if it's past the expiration, get the 2nd image.     } } echo "<img src='$url'/>"; 
  3. renobird's post in editor friendly modular fields? was marked as the answer   
    Check PageTable and/or PageTableExtended. 
  4. renobird's post in Dev and master versions was marked as the answer   
    The commits to the dev branch are always very solid and stable. I've used the dev branch for several production sites in the past, but fully realizing I do this at my own peril. I've never experienced an issue that caused me to revert to the master branch. However, I do try to stick with the current master for most production sites.
    Upgrading is super simple. As of 2.5.3 (the current master) you can upgrade/downgrade/DB backup from within the admin.
  5. renobird's post in Can $session->redirect open in a new window? was marked as the answer   
    Here's a more complete answer. Tested and works as expected.
    function navList($items, $level = 1){    $max_levels = 2;    $level == 1 ? $class = "parent" : $class = "child";    $out = '';        if ($level <= $max_levels){        $out = "<ul class='$class'>";        foreach ($items as $item){           $out .= navItem($item, $level);        }        $out .= "</ul>";    }        $level++; // increment level each time this function is called.     return $out; } function navItem($item, $level){    $url = $item->url;    $attr = '';    if ($item->template == "redirect"){        if (trim($item->redirect) == "") return; // skip because the field is blank.        $url = $item->redirect;         if($item->new_window == 1){            $attr = "target=_blank";        }    }    $out = "<li><a href='$url' $attr>$item->title</a>";    if ($item->numChildren > 0){        $out .= navList($item->children(), $level + 1); // get recursive    }    $out .= "</li>";    return $out; } echo navList($p); No need to do anything other than get the top level nav items and set the $max_levels if different than 2.
    You can of course probably do all of this as easy/easier with MarkupSimpleNavigation, but it's not necessary if all you need is this.
  6. renobird's post in Find all pages matching tag (using urlSegment) was marked as the answer   
    Hi Richard,
    If you use the pageField method, then every "tag" creates a page that has a unique name. Example (green-energy, shark-sandwiches, turtle-soup).
    The autocomplete field presents the user with the page title, so they would select tags like (Green Energy, Shark Sandwiches, Turtle Soup). Same applies for adding new tags.
    Now you can use UrlSegments to find pages with your multi-word tags because they will be in a format like /domain/tags/green-energy/
  7. renobird's post in Page field item order was marked as the answer   
    Use the selector option for your page field.
    template=sharks, sort=title
  8. renobird's post in selecting filtered data for page fieldtype was marked as the answer   
    Perhaps this module would be helpful?
    My thought would be to make the contact association on the companies page with a page field, and remove the page field from the actual contact.
  9. renobird's post in Adding pages with multiple fields as page fieldtype? was marked as the answer   
    I don't know how familiar you are with Process Modules, but I posted a quick example a while back. Once you get started, they are super addicting. You can build just about anything.
  10. renobird's post in Date field as field in the Admin Page List? was marked as the answer   
    Hi Ralf,
    Does the date field have an output format set?
    I've never attempted to show a date field in the admin list, but that's where I would start.
  11. renobird's post in Using $pages in custom function was marked as the answer   
    Are you sure $page_id is being passed as expected?
    Perhaps echo $page_id to verify.
  12. renobird's post in How to assign Users to Page Field was marked as the answer   
    clsource,
    You may already know this, but created and modified data is already saved as part of the page.
    $page->createdUser
    $page->modifiedUser
  13. renobird's post in Field-template context on frontend forms was marked as the answer   
    Hey Pete,
    I'm short on time, I think this is what you are after.
    $templates->get("template_name")->fieldgroup->getField($field, true)->label; *written in browser off the top of my head.
×
×
  • Create New...