php function needed – "De-randomize"?
-
Hello
I really like Chris Coyiers post about a “Randomized grid of Posts“
I don’t know php that well, so I would like to hear if you could help with the following: In Chris’ post he writes the following for handling the content:
<a href="<?php the_permalink(); ?>" class="box col<?php echo rand(2,4); ?>"> <span class="title"><?php the_title(); ?></span> <img src="<?php echo get_post_meta($post->ID, 'PostThumb', true); ?>" alt="" /> <span class="ex"><?php the_excerpt(); ?></span> </a>
As I understand it this part:
<?php echo rand(2,4); ?>
, is what “randomizes” the grid by choosing a random number between 2,3 and 4 for each box.I would very much like to do the opposite, but I don’t know the command in php. I would like to get a ordered sequence of boxes, eg. 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5 etc. Is it possible to change the “echo rand” command so it does the opposite – an ordered array/sequence of numbers?
Hope you can help…
Cheers
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘php function needed – "De-randomize"?’ is closed to new replies.