psquillace Posted March 4, 2010 Share Posted March 4, 2010 Hello, I have changed most of my site over to php and now I have a problem. I did have virtual includes in html on my site that went like this <!--#if expr='("$DOCUMENT_NAME" = "gemaco-bridge-sets.htm")' --><tr><td width="160" height="15" align="left" style="background-color:#cfcfc7;" onMouseOver="this.style.backgroundColor='#cfcfc7';" onMouseOut="this.style.backgroundColor='#cfcfc7';"><a class="menu" href="gemaco-bridge-sets.htm"><b> Gemaco Bridge Sets</b></a></td></tr> <!--#else --> <tr><td width="160" height="15" align="left" style="background-color:#edede4;" onMouseOver="this.style.backgroundColor='#cfcfc7';" onMouseOut="this.style.backgroundColor='#edede4';"><a class="menu" href="gemaco-bridge-sets.htm"> Gemaco Bridge Sets</a></td></tr> <!--#endif --> <tr><td height="1" class="navdivider"><img src="images/spacer.gif" border="0" hspace="0" vspace="0" width="160" height="1" alt=""></td></tr> Now my menu on my pages are broken and I do not know how to convert that to php. Basically I want to say, If we are on this page, then load the menu like this... if not, then this... I know it is an if else I just do not know how to say the if this page part like in html. Thanks for any help or advice on this, Paul Quote Link to comment Share on other sites More sharing options...
Deoctor Posted March 4, 2010 Share Posted March 4, 2010 oops i got it wrong.. is that ur complete function? even the thing in the <!-- --> Quote Link to comment Share on other sites More sharing options...
psquillace Posted March 4, 2010 Author Share Posted March 4, 2010 Yes that is complete even with the <!--#virtual include"DOCUMENT_NAME" --> it is not commonly used but it is all over this site that I have to edit to php so I am not sure how to change it. I tried this below just now but the text editor is complaining about something already. lOL <?php if('congress-playing-cards.php') { echo "<tr><td width=\"16\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#cfcfc7';\"><a class=\"menu\" href=\"congress-playing-cards.php\"><b> Congress Playing Cards</b></a></td></tr>" }else{ echo "<tr><td width="160" height="15" align="left" style="background-color:#edede4;" onMouseOver="this.style.backgroundColor='#cfcfc7';" onMouseOut="this.style.backgroundColor='#edede4';"><a class="menu" href="congress-playing-cards.htm"> Congress Playing Cards</a></td></tr>" } <tr><td height="1" class="navdivider"><img src="images/spacer.gif" border="0" hspace="0" vspace="0" width="160" height="1" alt=""></td></tr> Quote Link to comment Share on other sites More sharing options...
Deoctor Posted March 4, 2010 Share Posted March 4, 2010 try like this echo " <tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor=\'#cfcfc7\';\" onMouseOut=\"this.style.backgroundColor=\'#cfcfc7\';\"><a class=\"menu\" href=\"gemaco-bridge-sets.htm\"><b> Gemaco Bridge Sets</b></a></td></tr>\n"; echo " <tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#edede4;\" onMouseOver=\"this.style.backgroundColor=\'#cfcfc7\';\" onMouseOut=\"this.style.backgroundColor=\'#edede4\';\"><a class=\"menu\" href=\"gemaco-bridge-sets.htm\"> Gemaco Bridge Sets</a></td></tr>\n"; echo " <tr><td height=\"1\" class=\"navdivider\"><img src=\"images/spacer.gif\" border=\"0\" hspace=\"0\" vspace=\"0\" width=\"160\" height=\"1\" alt=\"\"></td></tr>\n"; Quote Link to comment Share on other sites More sharing options...
psquillace Posted March 4, 2010 Author Share Posted March 4, 2010 Thanks Man, that did it. I forgot to put an line ending delimeter on each line I think but it works now so. thanks again Paul Quote Link to comment Share on other sites More sharing options...
psquillace Posted March 4, 2010 Author Share Posted March 4, 2010 Ok Wait... it appears that I spoke to soon This is what I have now as an alternate - if('brand-name-playing-cards.htm') { echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#cfcfc7';\"><a class=\"menu\" href=\"brand-name-playing-cards.htm\"><b> Brand Name<br> Playing Cards</b></a></td></tr>\n"; }else{ echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#edede4;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#edede4';\"><a class=\"menu\" href=\"brand-name-playing-cards.htm\"> Brand Name Playing Cards</a></td></tr>\n <tr><td height=\"1\" class=\"navdivider\"><img src=\"images/spacer.gif\" border=\"0\" hspace=\"0\" vspace=\"0\" width=\"160\" height=\"1\" alt=\"\"></td></tr>\n"; } if('congress-playing-cards.php') { echo "<tr><td width=\"16\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#cfcfc7';\"><a class=\"menu\" href=\"congress-playing-cards.php\"><b> Congress Playing Cards</b></a></td></tr>"; }else{ echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#edede4;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#edede4';\"><a class=\"menu\" href=\"congress-playing-cards.htm\"> Congress Playing Cards</a></td></tr> <tr><td height=\"1\" class=\"navdivider\"><img src=\"images/spacer.gif\" border=\"0\" hspace=\"0\" vspace=\"0\" width=\"160\" height=\"1\" alt=\"\"></td></tr>"; } but for some reason, it is only picking up the else part no matter what page I am on. it also is not picking up my spacer image, is tehre a code for that that I need that is just for images or something. Thanks for any help or advice on this, Paul Quote Link to comment Share on other sites More sharing options...
psquillace Posted March 4, 2010 Author Share Posted March 4, 2010 Ok mark this one as solved, i figured it out and I hope this little bit helps someone here. in PHP you cannot just say, if('pagename.htm') {echo "this stuff"}else{echo "that stuff"}; you have to tell it what server you are on, and if you are, then if you are on this page, then can you do this. Here is an example of what I did to make this menu work for me. if($_SERVER['PHP_SELF'] == 'brand-name-playing-cards.php') { echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#cfcfc7;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#cfcfc7';\"><a class=\"menu\" href=\"brand-name-playing-cards.htm\"><b> Brand Name<br> Playing Cards</b></a></td></tr>\n"; }else{ echo "<tr><td width=\"160\" height=\"15\" align=\"left\" style=\"background-color:#edede4;\" onMouseOver=\"this.style.backgroundColor='#cfcfc7';\" onMouseOut=\"this.style.backgroundColor='#edede4';\"><a class=\"menu\" href=\"brand-name-playing-cards.htm\"> Brand Name Playing Cards</a></td></tr>\n <tr><td height=\"1\" class=\"navdivider\"><img src=\"images/spacer.gif\" border=\"0\" hspace=\"0\" vspace=\"0\" width=\"160\" height=\"1\" alt=\"\"></td></tr>\n"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.