wordpress - Pass PHP variable into another PHP file that is embedded in IFRAME -


i have page set in wordpress generates content based on various variables. creates string url google calendar. then, google calendar embedded via iframe although google calendar hosted on our domain. can't figure out how string transferred iframe. here code:

  <?php if ( is_page('baseball') ) {    $current_sport = 'baseball';    $athletic_calendar = get_field('calendar_baseball', 'option');    $athletic_calendar_boys_varsity = get_field('boys_varsity_calendar_basketball', 'option');    $athletic_calendar_girls_varsity = get_field('girls_varsity_calendar_basketball', 'option');    $athletic_calendar_boys_jv = get_field('boys_jv_calendar_basketball', 'option');    $athletic_calendar_girls_jv = get_field('girls_jv_calendar_basketball', 'option');    $athletic_calendar_boys_freshmen = get_field('boys_freshmen_calendar_basketball', 'option');    $athletic_calendar_girls_freshmen = get_field('girls_freshmen_calendar_basketball', 'option');   }   ?>    <?php $calendar_string = 'src=' . $athletic_calendar . '&';    if ( $athletic_calendar_boys_varsity ) :     $calendar_string .= 'src=' . $athletic_calendar_boys_varsity . '&';    endif;     if ( $athletic_calendar_girls_varsity ) :     $calendar_string .= 'src=' . $athletic_calendar_girls_varsity . '&';    endif;    if ( $athletic_calendar_boys_jv ) :     $calendar_string .= 'src=' . $athletic_calendar_boys_jv . '&';    endif;     if ( $athletic_calendar_girls_jv ) :     $calendar_string .= 'src=' . $athletic_calendar_girls_jv . '&';    endif;    if ( $athletic_calendar_boys_freshmen ) :     $calendar_string .= 'src=' . $athletic_calendar_boys_freshmen . '&';    endif;    if ( $athletic_calendar_girls_freshmen ) :     $calendar_string .= 'src=' . $athletic_calendar_girls_freshmen . '&';    endif;     global $gcal_string;    $gcal_string = 'https://www.google.com/calendar/embed?' . $calendar_string . 'ctz=america/chicago';   ?>    <?php echo '<iframe src="https://www.bmchs.org/gcal-custom.php" style="border-width:0" width="100%" height="685" frameborder="0" scrolling="no"></iframe>' ;?> 

and here code in gcal-custom.php:

<?php  $content = file_get_contents('https://www.google.com/calendar/embed?src=bmchs.org_2i1q9e2a5o3ud6d9qji33a2reg%40group.calendar.google.com&ctz=america/chicago');  $content = str_replace('</title>','</title><base href="https://www.google.com/calendar/" />', $content);  $content = str_replace('//calendar.google.com/calendar/static/2feb9b53c01cf3989b70175c72c580c5embedcompiled_fastui.css','https://www.bmchs.org/calendar.css', $content);  echo $content; ?> 

what need happen in gcal-custom.php this:

$content = file_get_contents( $gcal_string); 

is possible? can't figure out...

you seem build - string $calendar_string , $gcal_string, never use in iframe.

your iframe's source static string without kind of variable:

<iframe src="https://www.bmchs.org/gcal-custom.php" style="border-width:0" width="100%" height="685" frameborder="0" scrolling="no"></iframe> 

the variable values won't in there magically.

why don't use string may have build exact purpose?

<?php echo '<iframe src="https://www.bmchs.org/gcal-custom.php?' . $calendar_string . '"></iframe>'; ?>   


then read variables in gcal-custom.php; example:

<?php    $my_src = $_get["src"]; ?> 


possibility save values session variables , read values in php file opened in iframe.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -