#1 (permalink)  
Old 02-05-2008, 03:38 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
Lightbulb 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!
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

  #2 (permalink)  
Old 02-05-2008, 04:56 PM
Deadeye's Avatar
Moderator
 
Join Date: Aug 2005
Location: San Diego, CA
Posts: 296
Send a message via MSN to Deadeye
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.
  #3 (permalink)  
Old 02-05-2008, 05:21 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
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.
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
  #4 (permalink)  
Old 02-05-2008, 05:55 PM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,533
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?
  #5 (permalink)  
Old 02-05-2008, 06:19 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
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.
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
  #6 (permalink)  
Old 02-05-2008, 07:28 PM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,533
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?
  #7 (permalink)  
Old 02-06-2008, 05:15 AM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
Curtiss, I have not tested this yet, but you totally rock!!!
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
  #8 (permalink)  
Old 02-06-2008, 05:51 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,533
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?
  #9 (permalink)  
Old 02-06-2008, 06:30 AM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Like you, on a tiny speck of dust floating in the Virgo Cluster.
Posts: 1,311
Send a message via AIM to Leprakawn Send a message via Yahoo to Leprakawn
...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!!!
__________________
This field was intentionally left blank.


Wait a minute... oops.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Last edited by Leprakawn; 02-06-2008 at 06:39 AM..
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Testing php application with apache lax Programming and Scripting 1 10-17-2008 08:03 PM
PHP cookies and multiple values curtiss Programming and Scripting 1 11-07-2007 10:39 AM
PHP Performance Question curtiss Programming and Scripting 1 11-23-2006 10:24 PM
Convert Perl Regex to PHP curtiss Programming and Scripting 3 07-14-2006 09:14 PM
Stupid Question About PHP curtiss Programming and Scripting 3 11-21-2005 11:11 PM


All times are GMT -5. The time now is 04:58 PM.

 
Clicky Web Analytics
CloudContacts
Loop11
Page.ly


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.1 PL1
© 1997-2009 HTMLCenter