I'm having the same issue. I have a bunch of links in a side-box that go out of Zen Cart, but stay in my site. What I wanted was a way to use relative links, and if the current page was using SSL, turn it off.
I wrote this ugly bit PHP code and put it near the top of my sidebox PHP file:
PHP Code:
<?php
$sslStat = $_SERVER['HTTPS'];
$currHost = $_SERVER['HTTP_HOST'];
$currURL = $_SERVER['REQUEST_URI'];
$stripURL = trim($currURL, "/");
$currArr = explode("/", $stripURL);
function makeInsecureRef($relRef)
{
global $sslStat, $currHost, $currArr;
if ($sslStat == "")
{
echo $relRef;
}
else
{
$numURLEle = count($currArr);
// we don't care about the last
// element in the array since
// its the current file.
$numURLEle = $numURLEle - 1;
$subRelRef = $relRef;
$done = false;
while(!$done)
{
if (strcmp("../", substr($subRelRef, 0, 3)) == 0)
{
$subRelRef = substr($subRelRef, 3);
$numURLEle = $numURLEle - 1; // backing up a directory
}
else
{
$done = true;
}
if ($numURLEle < 0)
{
echo "Error! " . $relRef;
return;
}
}
echo "http://" . $currHost . "/";
for ($i = 0; $i < $numURLEle; $i++)
{
echo $currArr[$i] . "/";
}
echo $subRelRef;
}
}
?>
The function makeInsecureRef() assembles a complete URL combining the http:// with the current host (www.mydomain.com) with as much of the current path as is required.
Then to create the links, I call the makeInsecureRef() function this way:
HTML Code:
<a href="<? makeInsecureRef("../out_of_zencart.html");?>">
This seems to work well for me.
My question (Sorry to hijack the thread) is, where can I put this within the override system, so that ALL of my pages have access to this function? (I need to use it on my footer and header as well.)
I hope this code is helpful and thanks in advance for some help!
Chris