Jump to content

Search the Community

Showing results for tags 'loop foreach sort'.

  • 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. I'm having a few issues trying to sort from within a loop. $blog_entry = $page->children("sort=title"); foreach ($blog_entry as $entry) { // add classes to first and last boxes. $class = 'blog_box'; if ($blog_entry->getItemKey($entry) % 2) {$class .= ' blog_box_even';} if ($entry == $page->children->first()) {$class .= ' blog_box_first';} elseif ($entry == $page->children->last()) {$class .= ' blog_box_last';} else { $class .= ''; } // make blog images 200 X 150 $image = $entry->single_image; echo "<div class='$class'>"; echo "<div class='blog_text'>"; echo "<h3>$entry->title</h3>"; if (!empty($entry->summary)) { echo "<p>$entry->summary</p>"; } else { echo "<p>$entry->body</p>"; } echo "</div><!-- /.blog_text -->"; echo "<img src='$image->url' width='200' height='150' alt='alt text' class='small_frame' />"; echo "<div class='clear'></div>"; echo "</div><!-- /.blog_box -->"; } If i do the above and sort before the loop, the data gets sorted but it messes up my classes which are added in the logic within the loop. Where can I add the sort parameter to to sort from within? Everything I've tried hasn't worked unfortunately. Thanks
×
×
  • Create New...