Jump to content

What is the alternative to <!--#virtual include.....


psquillace

Recommended Posts

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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";

Link to comment
Share on other sites

Ok Wait... it appears that I spoke to soon  ;D

 

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

Link to comment
Share on other sites

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";

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.