Solved

change iframe PHP variable into php include

Posted on 2010-11-09
3
439 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 110

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

738 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