Page 1 of 1

On Click

Posted: Fri Feb 27, 2009 10:58 pm
by yasirjamal
Dear Friends,


I am making a website. But language is not in english or not compatible with dreamweaver.
So i have to make images as a text for that website. The images are 30 before its was just only HTML website. 30 images means 30 HTML Pages. It was very difficult for me to arrange 30 HMTL pages. I want when i click to a button the images will be call from images folder on same page. When i click to next button next images will be call from images folder. Can you anyone tell me please how to do it.

Thank You

Re: On Click

Posted: Sat Feb 28, 2009 12:00 am
by Randwulf
I hope I understand what it is you're looking for.

Code: Select all

 
<?php
if (!isset($_GET['pic'])) $pic = 0;
else $pic = $_GET['pic'];
$ar = scandir("images folder here");
echo "<img src='images folder path here/".$ar[pic]."'>";
echo "<a href='filenamehere.php?pic=" . $ar[pic] + 1 . "'>Next</a>";
 ?>
 

Re: On Click

Posted: Sat Feb 28, 2009 1:21 am
by yasirjamal
Dear Randwulf,

I dont want a image gallary. please visit http://www.saughat.com.
In this website the right side. There are some button when you click a button image will be open on a position. I want when i click to 1 button 1 image will be open when i click 2 image 2 will be open.

Re: On Click

Posted: Sat Feb 28, 2009 9:01 am
by Randwulf
So you want the picture to be opened in the center of the main page instead of you having to make a whole bunch of different html pages that the buttons link to. I think I understand now.

You would turn your main page into a PHP page and pass the picture file name to the page with GET. Each of your buttons in this case would link to http://www.saughat.com/saughat/index.ph ... lename.jpg. (Where insertfilename.jpg is replaced with the picture name of course)

Code: Select all

 
<?php
if (!isset($_GET['pic'])) $fileloc = "images/defaultpicname";
else $fileloc = "images/" . $_GET['pic'];
?>
---HTML Stuff Here---
 
<image src="<?php echo $fileloc; ?>">
 
---More HTML Stuff---