#1 (permalink)  
Old 02-05-2008, 04:38 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
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!
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
         ...,,.,.,.
        /          \
__oooo__[///]--[\\\]__oooo__
Reply With Quote

  #2 (permalink)  
Old 02-05-2008, 05:56 PM
Deadeye's Avatar
Moderator
 
Join Date: Aug 2005
Location: San Diego, CA
Posts: 274
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.
Reply With Quote
  #3 (permalink)  
Old 02-05-2008, 06:21 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
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.
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
         ...,,.,.,.
        /          \
__oooo__[///]--[\\\]__oooo__
Reply With Quote
  #4 (permalink)  
Old 02-05-2008, 06:55 PM
curtiss's Avatar
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?
Reply With Quote
  #5 (permalink)  
Old 02-05-2008, 07:19 PM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
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.
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
         ...,,.,.,.
        /          \
__oooo__[///]--[\\\]__oooo__
Reply With Quote
  #6 (permalink)  
Old 02-05-2008, 08:28 PM
curtiss's Avatar
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?
Reply With Quote
  #7 (permalink)  
Old 02-06-2008, 06:15 AM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
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!!!
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
         ...,,.,.,.
        /          \
__oooo__[///]--[\\\]__oooo__
Reply With Quote
  #8 (permalink)  
Old 02-06-2008, 06:51 AM
curtiss's Avatar
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?
Reply With Quote
  #9 (permalink)  
Old 02-06-2008, 07:30 AM
Leprakawn's Avatar
Moderator
 
Join Date: Jan 2004
Location: Outside, and playing with your invisible friends.
Posts: 1,130
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!!!
__________________
Like my spiffy, unique signature?
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Code:
         ...,,.,.,.
        /          \
__oooo__[///]--[\\\]__oooo__

Last edited by Leprakawn; 02-06-2008 at 07:39 AM.
Reply With Quote
Reply


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
Forum Jump

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


All times are GMT -5. The time now is 02:17 PM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter