Jump to content


Photo

IFRAME issue


  • Please log in to reply
9 replies to this topic

#1 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 04 September 2006 - 03:41 PM

I'm trying to include an IFRAME on my page.  Basically the reason I am using it is to be able to use it as a TARGET for a few links.  I'm able to include it and make it work, but when I go to add PHP code to it, the trouble starts.  I'm wanting the frame to display a default image based on the ID of the page it is included within.  I've done it a few ways, and the best I can figure is that the IFRAME isn't getting the ID data to be able to provide the appropriate variable.  If anyone understands what I am saying, am I correct?  Is there a way around this??

Thanks,

~Z~

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 04 September 2006 - 03:47 PM

care to post some of your code?
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 04 September 2006 - 03:53 PM

The code for my default IFRAME page is:

<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 ALIGN="CENTER" WIDTH="450" HEIGHT="150">
<TR><TD VALIGN="TOP">

<IMG SRC='images/<?php echo "$picture1";?>'>

</TR></TD>
</TABLE>

The code from the page it is inserted on:

<IFRAME BGCOLOR="#000000" SRC="image.php" MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0 SCROLLING=NO WIDTH=450 HEIGHT=100% NAME="IMAGE"></IFRAME>

The variable $picture1 is defined on the page where the IFRAME is inserted.

~Z~

#4 designationlocutus

designationlocutus
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 04 September 2006 - 03:58 PM

You could send the name of your image as a url variable when the user clicks on the link, then use the url variable and assign it to picture.

#5 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 04 September 2006 - 03:58 PM

Put
<?php session_start(); ?>
at the top of image.php, then store the variable as a session variable ($_SESSION['picture1']) on the page containing the iframe and call the session variable in image.php. Remember to use session_start() in both pages (before outputting anything).

#6 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 04 September 2006 - 03:59 PM

That's the way I'm doing it, but I need it to load a default image based on the ID of the parent page loaded.

~Z~

#7 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 04 September 2006 - 04:01 PM

Actually you didn't.

#8 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 04 September 2006 - 04:03 PM

sorry, that reply wasn't for you, it was for designationlocutus.  I'm trying your suggestion now.

I'm a little fuzzy about how to include the session variable ($_SESSION['picture1']) though, could you help with that?

#9 aviatorisu

aviatorisu
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 04 September 2006 - 04:54 PM

Anyone else have any thoughts??

~Z~

#10 designationlocutus

designationlocutus
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 07 September 2006 - 02:55 PM

Session would be useful if you wanted to maintain the image through several clicks. Start the session the way Daniel suggested (this must be done on every page that you use) and assign your session variable to the picture name.

However to do it the way I suggested, you need to set the iframe src in your second example to produce the correct image.

SRC="image.php?picture1=image.jpg"





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users