Solved

change iframe PHP variable into php include

Posted on 2010-11-09
3
436 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

820 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