Gary Samuels
asked on
using iframe in php
The following code works in a Wordpress page. The php variable $start_day will echo 'Aug-09-2015', the same date used in the iframe.
How do I get the iframe to work using the variable $start_day?
[insert_php]
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set( 'CST');
$s = date("Y/m/d");
$time = strtotime($s);
$start = strtotime('last sunday, 12pm', $time);
$end = strtotime('next sunday, 11:59am', $time);
$format = 'M\-d\-Y';
$start_day = date($format, $start);
$end_day = date($format, $end);
header('Content-Type: text/plain');
echo "Input: $s\nOutput: $start_day - $end_day";
[/insert_php]
<iframe id="pdf" src="http://docs.google.com/viewer?url=http://www.thecatholicdirectory.com/communiques/75154/Aug-09-2015.pdf&embedded=true" frameborder="0" style="border:none; width:100%; height:900px; background: #d1d1d1;" scrolling="yes"></iframe>
<div style="height: 20px;"></div>
How do I get the iframe to work using the variable $start_day?
[insert_php]
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set(
$s = date("Y/m/d");
$time = strtotime($s);
$start = strtotime('last sunday, 12pm', $time);
$end = strtotime('next sunday, 11:59am', $time);
$format = 'M\-d\-Y';
$start_day = date($format, $start);
$end_day = date($format, $end);
header('Content-Type: text/plain');
echo "Input: $s\nOutput: $start_day - $end_day";
[/insert_php]
<iframe id="pdf" src="http://docs.google.com/viewer?url=http://www.thecatholicdirectory.com/communiques/75154/Aug-09-2015.pdf&embedded=true" frameborder="0" style="border:none; width:100%; height:900px; background: #d1d1d1;" scrolling="yes"></iframe>
<div style="height: 20px;"></div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That worked, thanks
The PHP script simply sends a date to the requesting agent.
The iframe code seems to be displaying a PDF - how are you wanting to mix these two?