Solved

change iframe PHP variable into php include

Posted on 2010-11-09
3
433 Views
Last Modified: 2012-05-10
I currently use a php variable in a <iframe> like this:

<iframe src="<?=$iframe_url;?>" width="565" scrolling="no" height="3500" frameborder=0></iframe>

I need to make it into a php include and have tried different variations of the following to no effect?  What am I doing wrong?

<?php include('$iframe_url;'); ?>
0
Comment
Question by:pda4me
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ropenner earned 500 total points
ID: 34098645
if

$iframe_url = "http://google.ca"

in both your examples it does not make sense in the 'include' case

if however there is a file called "test.txt" and that file looks like:

http://google.ca

and the variable

$iframe_url = "test.txt";

and that file is in the include path and has accessible permissions then.

it will insert the correct url into your frame declaration and the final result will be:

<iframe src="http://google.ca" width="565" scrolling="no" height="3500" frameborder=0></iframe>

to test for a correct include you can write this in PHP

include_once test.txt;

and the result should be output of the text in the test.txt file namely:

http://google.ca
0
 
LVL 8

Expert Comment

by:ropenner
ID: 34098650
test code should have been:

include_once "test.txt";
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 34105564
Can you please post the code where you are having trouble?  Post the main frame in one code snippet and the iframe frame in a separate code snippet.  Thanks, ~Ray
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question