Jump to content

Recommended Posts

Posted

I want to list the names of pages with the template "individual", so I did this...

<?php foreach($pages->find("template=individual") as $page)
echo $page->name;
?>

It echos an array of page names, as expected, but then it throws one page body (and just one) at the very end of the file. Where is that page body coming from? I'm stumped.

UPDATE

Never mind, solved my own problem. Renamed $page to something else, and it worked as expected.

Posted

It'll be because $page is always the current page array so I'm assuming that diogo is correct and you're echoing $page->body somewhere below that and it's getting confused.

Your solution to change the name is correct of course - it was just getting confused as you were causing it to interfere with the original pagearray for that page.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...