Hi, I was wondering if someone could help me answer this "easy" question: I have three variables, lets say $item1, $item2 and $item3 How would I display these in order, one at a time? For example, I have only one variable right now: if (!$show) { return $item1; } Code (markup): If I add $item2 and $item3 to the database, how can I get it to display these in numerical order? item1, item2, item3, item1, item2, item3.... I do not want to use rand() because they need to stay in order. Sorry if this sounds confusing... I would really appreciate any help you can give. Thanks!
Your question is not really clear. Try to rephrase it and post your whole code so we can understand better.
Yes, what triggers the display of the variables? The refresh of the page? the user action by pressing a link or a button? How the variables are stored? each variable is a row of the table? do we have an ordered structure by row like: - row1 : item1 value, - row2 : item2 value, etc... in that case you would be able to use the "limit" keyword of sql to retrieve the next element based on an hidden variable kept into to your form of the last shown element.
Sorry for not being clear enough. Here is the full code: <?php $body = 'This is some text'; function myfeed($content) { global $body; if(is_feed()) { return $content.$body; } else { return $content; } } add_filter('the_content', 'myfeed'); ?> PHP: Its for wordpress. What you type in $body shows up at the end of your RSS feed, such as a copyright notice or an ad. I want to have something like $body2 and $body3 and rotate them in order. For example, each time I make a post, it will add $body, $body2, $body3, $body, $body2.... etc. etc at the end of my posts, rotating them in order. I know that there are similar plugins that already exist, but I wanted to work with this code a little bit. Again, any help is appreciated. Thanks so much.