
02-05-2008, 04:38 PM
|
 |
Moderator
|
|
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
|
|
Dynamic PHP question
Hey, all... time for a new question!!
Okay, I googled this not really knowing what to call it, so my results were not successful; however, hopefully someone here can grasp the concept and let me know if this is possible.
[- Page-of-images.php -] Contains links to images
[- single-page.php -] view any/all imgs here
Is there a way to make a list of pictures on one page, and then have the pictures open on another page, which means that page be coded some way to view the requested picture?
I know about targeting to the window name, but I am curious to see if I can make a single page open imgs dynamically.
Here is a free sheep to the first person who can successfully answer this question! 
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
...,,.,.,.
/ \
__oooo__[///]--[\\\]__oooo__
|

02-05-2008, 05:56 PM
|
 |
Moderator
|
|
Join Date: Aug 2005
Location: San Diego, CA
Posts: 274
|
|
YES!
Are you talking about haveing the link target the same page to open all images in?
Wesley
__________________
Don't forget to rate me A+++++++++++++++++!!!!!111one for the service you have received.
|

02-05-2008, 06:21 PM
|
 |
Moderator
|
|
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
|
|
Yeah, I want to code a single page for the imgs to open in vs. having to code a bunch of pages showing the imgs. I am trying to save some time here. 
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
...,,.,.,.
/ \
__oooo__[///]--[\\\]__oooo__
|

02-05-2008, 06:55 PM
|
 |
Moderator
|
|
Join Date: May 2003
Posts: 1,445
|
|
It's pretty simple really. You'll want to play a bit with query strings (the $_GET global variables) to make the page do what you want, depending on what information you feed it.
If I'm understanding what you're asking, you would want to create a function something like the following, and then call it within your "pageofimages.php" file:
PHP Code:
<?php
function showlist() {
echo '<ul>\n\r';
$myimgs = array('pic1.jpg'=>'Picture 1','pic2.jpg'=>'Picture 2','pic3.jpg'=>'Picture 3','pic4.jpg'=>'Picture 4');
foreach $myimgs as $imgname=>$imgdesc {
echo '\t<li><a href="picviewer.php?picname='.$imgname.'">'.$imgdesc.'</a>\n\r';
}
echo '</ul>';
}
?>
Then, the code within picviewer.php (your "single-page") would look something like:
PHP Code:
<?php
if(!empty($_GET['picname'])) {
?>
<img src="<?php echo $_GET['picname'];?>" />
<?php
}
else {
?>
There is no image to show
<?php
}
?>
__________________
I hate Internet Explorer! Anyone with me?
|

02-05-2008, 07:19 PM
|
 |
Moderator
|
|
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
|
|
Hmm, after looking at your example, I am not exactly sure how I would combine the page o' pictures code with what I already have. Here is one example:
Code:
<a class="menu" href="javascript:windowHandle = window.open('imgs/food/chickenrollatiniwfs.jpg','img','top=0,left=0,width=540,height=295'); windowHandle.focus()" onmouseout="window.status=' '" onmouseover="this.T_BORDERCOLOR='#C4C7BE';this.T_WIDTH=156;this.T_BGCOLOR='#ffffff';this.T_OFFSETY=-7;this.T_FONTSIZE='9px';this.T_SHADOWCOLOR='#636363';this.T_SHADOWWIDTH=4;return escape('<img src=\'imgs/food/chickenrollatiniwfs-sm.jpg\' width=\'150\'> Click to zoom.')">
When the visitor drags over the item, a small preview is available, and when it is clicked, a larger view appears.
What I am shooting for is a larger view with some extra stuff added around the img, but I do not want to have to create all of the extra pages per item, which at this moment is about 130'ish imgs.
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
...,,.,.,.
/ \
__oooo__[///]--[\\\]__oooo__
|

02-05-2008, 08:28 PM
|
 |
Moderator
|
|
Join Date: May 2003
Posts: 1,445
|
|
Your links should look something like:
Code:
<a class="menu" href="javascript:windowHandle = window.open('picviewer.php?pic=imgs/food/chickenrollatiniwfs.jpg','img','top=0,left=0,width=540,height=295'); windowHandle.focus()" onmouseout="window.status=' '" onmouseover="this.T_BORDERCOLOR='#C4C7BE';this.T_WIDTH=156;this.T_BGCOLOR='#ffffff';this.T_OFFSETY=-7;this.T_FONTSIZE='9px';this.T_SHADOWCOLOR='#636363';this.T_SHADOWWIDTH=4;return escape('<img src=\'imgs/food/chickenrollatiniwfs-sm.jpg\' width=\'150\'> Click to zoom.')">
Then, picviewer's code would look like:
PHP Code:
<?php
if(!empty($_GET['pic'])) {
$imgsrc=$_GET['pic'];
}
?>
<img src="<?php echo $imgsrc; ?>" />
__________________
I hate Internet Explorer! Anyone with me?
|

02-06-2008, 06:15 AM
|
 |
Moderator
|
|
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
|
|
Curtiss, I have not tested this yet, but you totally rock!!! 
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
...,,.,.,.
/ \
__oooo__[///]--[\\\]__oooo__
|

02-06-2008, 06:51 AM
|
 |
Moderator
|
|
Join Date: May 2003
Posts: 1,445
|
|
|
I hope it works for you.
If you really want to get fancy, you could store the locations of your images inside a database or an XML file, and then you could pull a description, etc. from the database/XML file to show on the page with your image. It wouldn't take much more coding, it would just take a bit of work to get the images and their descriptions, etc. into the DB or XML file.
__________________
I hate Internet Explorer! Anyone with me?
|

02-06-2008, 07:30 AM
|
 |
Moderator
|
|
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
|
|
...completely over my head, but thanks for the info. If I ever need to figure that out, I know who to ask!
And yes, the code you sent works. You are a lifesaver!!!
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
...,,.,.,.
/ \
__oooo__[///]--[\\\]__oooo__
Last edited by Leprakawn; 02-06-2008 at 07:39 AM.
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:17 PM.
|
|
|