How to display selected pods randomly on page refresh

0

Hello,

total newbie just getting my head around pods. LOVE IT so far!!!! Have built a site with all content editable for the client with pods. Not figured out the UI bit yet though, tried to install it but apparently it is now bundled with the main pods install so the help sheets I have found no longer apply.

My query is: How to display selected pods randomly on page refresh.

Just wondering if this is possible or not? I have a site and client want random quotes to display in a sidebar on page refresh, I would personally prefer a slider like nivo but could do with knowing what is possible. I have been searching for a few days but not come up with an answer anywhere.

They also want the same thing on another area of the page but this time displaying random images.

They want to be able to edit the content themselves otherwise I would just use nivo slider in the page template. As they want to edit themselves then pods seems like the answer for this too, if this is possible with pods??

I would be VERY grateful if anyone can help me out or point me in the right direction on this.

cheers! :)

asked Oct 14 '11 at 3:55

0161jon

18

add comment
enter at least 15 characters

4 Answers

1

Yes. Just use code like this to get a random record:

$pods->new Pod('my_pod');
$pods->findRecords('RAND()', 1);

answered Oct 14 '11 at 4:01

chris.pilko

889

edited Oct 15 '11 at 2:18

add comment
enter at least 15 characters
0

brilliant thanks for the rapid response!! Will have a try now.

answered Oct 14 '11 at 4:12

0161jon

18

add comment
enter at least 15 characters
0

hi,

I tried that but I get a fatal error,

Fatal error: Call to undefined method Pod::find_records() in...

this is what i have (no doubt I've missed something simple off?!):

<?php

// Use the "right_quotes" pod $pods = new Pod('right_quotes'); $pods->find_records('RAND()', 1); echo $pods->showTemplate('right_quotes_template');

?>

thanks for the help :)

answered Oct 15 '11 at 12:06

0161jon

18

It helps if I used the right syntax. It's findRecords() not find_records(). I corrected my original answer. – chris.pilko Oct 15 '11 at 2:19
add comment
enter at least 15 characters
0

ah thank you sorted now!!

:)

answered Oct 15 '11 at 2:42

0161jon

18

add comment
enter at least 15 characters