{"id":1979,"date":"2005-07-06T11:27:56","date_gmt":"2005-07-06T16:27:56","guid":{"rendered":"https:\/\/www.quirkspace.com\/quirkblog\/?p=724"},"modified":"2005-07-06T11:27:56","modified_gmt":"2005-07-06T16:27:56","slug":"too-boring-for-prime-time","status":"publish","type":"post","link":"https:\/\/www.quirkspace.com\/quirkblog\/?p=1979","title":{"rendered":"Too boring for prime time"},"content":{"rendered":"<p>I&#8217;ve been doing some massive geek-outery at work again.  It&#8217;s some really cool stuff involving doing the navigation for a huge website using server side includes and variables so that I only have to write something once and it&#8217;ll look different depending on where you are in the site.<br \/>\n<!--more--><br \/>\nI think it&#8217;s cool anyway.<\/p>\n<p>Unfortunately, the rest of the world doesn&#8217;t seem to share my opinion.  It&#8217;s kind of disheartening to get conversationally slapped down when I try to explain how it all works.  On the other hand, the code is nifty and useful and I might as well post it here on the off chance that there&#8217;s someone else out there looking to do something similar.<\/p>\n<blockquote><p>\nFirst problem: doing server side includes without knowing the full directory path.<\/p>\n<p>Solution: use a variable to trick the parsed file into calling images and so on from the correct folder<\/p>\n<p>Example:<br \/>\n<code><br \/>\n&lt;!-- ### set global variable  ### --&gt;<br \/>\n&lt;!--#set var=\"URLPREFIX\" value=\".\" --&gt;<\/p>\n<p>&lt;script type=\"text\/javascript\" SRC=\"&lt;!--#echo var=\"URLPREFIX\" --&gt;\/include\/navigation_script.js\"&gt;<br \/>\n&lt;\/script&gt;<br \/>\n<\/code><\/p>\n<hr \/>\n<p>Second problem: the navigation needs to look different depending on where you are<\/p>\n<p>Solution: set a variable before you call the navigation.  Use if\/then\/else statements inside the navigation to change the code.<\/p>\n<p>Example:<br \/>\nIn the page that calls the navigation<br \/>\n<code><br \/>\n&lt;!--#set var=\"RESEARCHON\" value=\"true\" --&gt;<br \/>\n&lt;!--#include virtual=\"${URLPREFIX}\/include\/navigation.shtml\" --&gt;<br \/>\n<\/code><br \/>\nand in the navigation itself<br \/>\n<code><br \/>\n&lt;a href=\"&lt;!--#echo var=\"URLPREFIX\"--&gt;\/research\/research.shtml\"&gt;<br \/>\n&lt;!--#if expr=\"${RESEARCHON}\" --&gt;<br \/>\n&lt;img name=\"research\" src=\"&lt;!--#echo var=\"URLPREFIX\" --&gt;\/images\/research-on.gif\" border=\"0\" alt=\"\"&gt;<br \/>\n&lt;!--#else --&gt;<br \/>\n&lt;img name=\"research\" src=\"&lt;!--#echo var=\"URLPREFIX\" --&gt;\/images\/research.gif\" border=\"0\" alt=\"\"&gt;<br \/>\n&lt;!--#endif --&gt;<br \/>\n&lt;\/a&gt;<br \/>\n<\/code>\n<\/p><\/blockquote>\n<p>Note: code has been updated with spaces in front of the <code>--&gt;<\/code> tags so that it&#8217;ll <a href=\"https:\/\/www.quirkspace.com\/archives\/2005_07_11.html#000749\">play nice with Apache 1.3<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been doing some massive geek-outery at work again. It&#8217;s some really cool stuff involving doing the navigation for a huge website using server side includes and variables so that I only have to write something once and it&#8217;ll look &hellip; <a href=\"https:\/\/www.quirkspace.com\/quirkblog\/?p=1979\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[26],"class_list":["post-1979","post","type-post","status-publish","format-standard","hentry","tag-technical-notes"],"_links":{"self":[{"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=\/wp\/v2\/posts\/1979","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1979"}],"version-history":[{"count":0,"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=\/wp\/v2\/posts\/1979\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quirkspace.com\/quirkblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}