Jump to content

random child page image


Svet
 Share

Recommended Posts

Hi all,

Wrote this code to get one random child page and display the first image on it.

However, it is not working right. With this I always get the last child page in the array, and I want anything else but that!

$extra = $page->child("sort=random");

$thumb = $extra->images[0];

$thumb = $image->size(140, 95);

echo "<a href='{$extra->url}'><img src='{$thumb->url}' border='0'></a>";
Link to comment
Share on other sites

Topic closed. Not to use this forum as a brain dump place,

but since I cannot delete this posting, I am just going to say this:

be careful about reusing the variable names, even outside of the loop, because otherwize you will end up like me, asking stupid questions lol

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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