Click to See Complete Forum and Search --> : PHP drop down menu ?no dhtml?


EliteGhost
08-02-2008, 06:49 PM
Hey, im using a php, and basic html to code my pages, i basically have my php function returning what links go in this part of my webpage,

i would like to scroll over the story link, and have 3 links pop in kinda indented
so on the page it would look like this when the mouse clicks on Story

StoryLink 1
Link 2
Link 3Screen Shots

They would be hidden until clicked, and go away when clicked again, or mouse out.

a short portion of my code looks like this

function PF_sc2links(){
global $context, $maindir, $home;
echo' <td background="/starcraft/images/left2.gif"><div align="left">

<span class="LINKS">
· <a href="'.$home.'sc2/news">News<br /> </a>
· <a href="'.$maindir.'/forum/index.php?board=27.0">Q &amp; A <br /> </a>

· <a href="'.$home.'sc2/story">Story <br /> </a>
// CONDITIONAL GOES HERE WITH 3 LINKS?

· <a href="'.$home.'sc2/screen">Screen Shots<br /> </a>';

and it keeps going with more links, and an if statement if the user is logged in they can view links hidden to the non logged in.


all i want to know is how would i make an IF statement to say, If mouseover story=true than show 3 links indented.

scragar
08-02-2008, 06:58 PM
you do know that PHP can't be used to detect things like that right? PHP is completely server side, before the user even get's to mouse over anything. Javascript is normally used to achieve the effect you desire, look into that.

EliteGhost
08-02-2008, 07:03 PM
right, javascript. my problem there is since i have all these functions building each page. i loaded this java script into where it should go, and it loaded fine, with errors on the page meaning the javascript didnt work
since i use the php to echo just about every aspect of the page so that all my pages are identical except for the pages content i have no idea where to put the java script.

i basically used php's functions to echo' build each page in html. pretty stupid, but its still saving me time none the less.

its running me into alotta problems like this for example any suggestions? for my page?

hastx
08-03-2008, 12:05 AM
javascript and / or css is what you want to do that, if your javascript is getting errors, then it is a matter of fixing the script.

The only way to do anything remotely resembling that with php is to pass the info to the page.

for example your story link would be:


· <a href="'.$home.'sc2/story/page.php?show_sublinks=true">Story <br /> </a>
// CONDITIONAL GOES HERE WITH 3 LINKS?
if(isset($_GET['show_sublinks'])){
if($_GET['show_sublinks'] == true){
echo "<a href ....sublink1";
echo "<a href ....sublink2";
}

}


...but I still think you would get a much better user experience using js and / or css. this method would be awkward...but at least it will still work with javascript disabled