Set flag in menu to include iframe in other page
Posted: Mon May 08, 2006 6:04 am
I need some advice and expect that the solution is rather simple; though I’m stuck on this for several days already (since I’m still learning PHP).
I have one menu_1.php file, containing links to other pages. When such hyperlink is clicked I want that the content of those pages is shown in an iframe in index.php. This iframe must only be active when someone clicks on the link, otherwise it should not show the iframe but the default content in the else statement.
Please not that the onClick=setKey(1) was my latest attempt to set the condition and I’m sure that I’m doing something wrong there too.
The code in index.php
I tried it before with $_GET[‘nav’] and included that in the hyperlink but this was not working out either. I guess that my question could be summarized as: how do I set a hidden variable in menu_1.php that activates the condition in index.php?
Hope that there is someone to help me out with this…
Michael
I have one menu_1.php file, containing links to other pages. When such hyperlink is clicked I want that the content of those pages is shown in an iframe in index.php. This iframe must only be active when someone clicks on the link, otherwise it should not show the iframe but the default content in the else statement.
Code: Select all
print '<div id="menu">';
print '<ul>';
print ' <li><h2>Navigation</h2>';
print ' <ul>';
print ' <li><a href="http://mysite.com/otherpage.php?id=2" target="inline” onClick=setKey(1);return false">Menu item 1</a></li>';
….The code in index.php
Code: Select all
function setKey($Key_1) {
if (isset($Key_1)){
print '<iframe name=inline scroll=yes frameborder=1 width='.$xwidth.' height='.$yheight.'>';
print '</iframe>';
}
elseif (!isset($Key_1)){
print '<table width='.$xwidth.' height='.$yheight.' style="background: url('.$path.'load_'.$lang.'.gif) no-repeat;background-position:top center">';
…..
}
}Hope that there is someone to help me out with this…
Michael