Jump to content

Search the Community

Showing results for tags 'rendernav'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 2 results

  1. Hi guys, I'm trying to create a function to show the first picture of a page based on the rendernav function in _init.php. I'm succeding at showing all the images, but i can't find a way to show just the first image. Thanks in advance for anyhelp & merry christmass !!! function renderNavImages(PageArray $items) { // $out is where we store the markup we are creating in this function $out = ''; // cycle through all the items foreach($items as $item) { //trying to render 1st image foreach($item->images as $image) { //$imagen = $page->image->first(); $out .= "<img src='$image->url' />"; } // render markup for each navigation item as an <li> if($item->id == wire('page')->id) { // if current item is the same as the page being viewed, add a "current" class to it $out .= "<li class='current'>"; } else { // otherwise just a regular list item $out .= "<li>"; } // markup for the link $out .= "<a href='$item->url'>$item->title<br />$item->image</a> "; // if the item has summary text, include that too if($item->summary) $out .= "<div class='summary'>$item->summary</div>"; // close the list item $out .= "</li>"; } // if output was generated above, wrap it in a <ul> if($out) $out = "<ul class='nav'>$out</ul>\n"; // return the markup we generated above return $out; }
  2. Hello there! I have a question regarding the "renderNav" function used in the ‘intermediate’ site-profile. I have a multi-level menu system going by using the renderNav function, and I’d like to extend the default "renderNav" function to also mark all the parents of any given page with "current". I think I have to modify this line from the "renderNav" function: $out .= $item->id == wire('page')->id ? "<li class='current'>" : "<li>"; … specifically adding something along the lines of foreach parent of the itemid "<li class='current'>" else "<li>", but is there a neat way of putting that into the existing line? Or how would you do it? Thanks!
×
×
  • Create New...