Page 1 of 1

PHP styleswitch links to return curent url

Posted: Fri Jun 06, 2008 8:00 pm
by bennieblanco
Hello ,
I am trying to edit the styleswitch code to return curent url instead sending users back to index.php (using joomla)

this is what I have

Code: Select all

function getCurrentURL(){
    $cururl = mosGetParam( $_SERVER, 'REQUEST_URI', '' );
    if(($pos = strpos($cururl, "index.php"))!== false){
        $cururl = substr($cururl,$pos);
    }
    $cururl =  sefRelToAbs($cururl);
    $cururl =  ampReplace($cururl);
    return $cururl;
}
 
// COLOR SWITCHER LINKS
while(list($key, $val) = each($mystyles)){
 echo "<a href='".getCurrentURL()."?change_css=".$key."' >".$val["label"]."</a>";
}
 
 
It works but the problem is that the url link keeps on continuing every time you click on the style switch



example :

index.php?option=com_content&task=view&id=24&Itemid=44?change_css=green?change_css=green

I need it to show url only once like

index.php?option=com_content&task=view&id=24&Itemid=44?change_css=green

Thank you


best regards

this was original code , I just split it in 2 files

http://www.finalwebsites.com/snippets.php?id=31

Re: PHP styleswitch links to return curent url

Posted: Sun Jul 13, 2008 3:36 am
by halhead
Preety good PHP style switcher at this address http://www.nightingalei.derby.sch.uk

Think it uses cookies.