1 (edited by symbiot 2006-12-30 1:30:08 PM)

Topic: adjustment xajaxRequestUri when using several domainnames

on one of my website i have several domainnames pointing to one domain name, in that case i encountered the folowing problem:

when addressing the site with one of the domain-pointers, i get a acces-error, i solved it by editing the xajaxRequestUri function as followed:

(NOTE: this is not te best solution, but it works)

in de main function:

function xajax($sRequestURI="",$sWrapperPrefix="xajax_",$sEncoding=XAJAX_DEFAULT_CHAR_ENCODING,$bDebug=false)
    {
if ($this->sRequestURI == "")
            $this->sRequestURI = $this->_selfURL();
}

and the adjustment in de getJavascriptConfig() function

function getJavascriptConfig()
    {
        $html  = "\t<script type=\"text/javascript\">\n";
        $html .= "var xajaxRequestUri=\"".$this->_selfURL() . str_replace("http://www.yourdomain.com","/",$this->sRequestURI) ."\";\n";
}

my added function is the followed: (in the xajax function)

/*---------------- ADDED BY SYMBIOT, NEEDED WHEN USING ALTERNATE URL WICH POINT TO THE SAME -------------------*/
function _selfURL()
    {
        $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s"     : "";
        $protocol = $this->_strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
        $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
        return $protocol."://".$_SERVER['SERVER_NAME'];
    }
function _selfSECURL()
    {
        return "https://".$_SERVER['SERVER_NAME'];
    }
function _strleft($s1, $s2)
    {
        return substr($s1, 0, strpos($s1, $s2));
    }

PS: if you want to use an ssl connection, use _selfSECURL() instead of _selfURL()

I hope this is usefull!
best wishes 4 2007!

[xajax 0.5 RC 2 Minimal]
Sometimes, the sound of goodby is louder than any drumbeat