Reply to Re: shuffle pictures

Your name:

Reply:


Posted by Tom on 03/01/07 18:23

On 1 Mar 2007 08:43:32 -0800, badmets@gmail.com wrote...
>
>hey-- im a php newbie, and am trying to figure out how to add a
>hyperlink to the images i am using in a shuffle array. in other
>words, i have a page that displays random images via the shuffle
>script, and i want those images to have hyperlinks. can anyone lead
>me in the right direction? here's the script:
>
>$pictures = array('http://url1.jpg', 'http://url2.jpg');
>
> shuffle($pictures);
>?>
> <?php
> for ( $i = 0; $i < 1; $i++ )
> {
> echo '<img src=';
> echo $pictures[$i];
>

Maybe building two associative arrays (e.g. $pictures and $urls), using an index
number that matches both and store the file name in one and the URL in the
other. That way when you print the graphic after getting shuffled, you have the
index number to get the correct URL. As an example...

<a href="<?=$urls[$i]?>"><img src="<?=$pictures[$i]?>"></a>


Tom
--
Newsguy.com - Basic Accounts $39.95 / 12 months

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация