Jump to content

Search the Community

Showing results for tags '1st image'.

  • 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 1 result

  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; }
×
×
  • Create New...