a bit lost with url arguments

A bit lost with url arguments, a forum discussion on Jojo CMS. Join us for more discussions on A bit lost with url arguments on our Administration (backend and configuration) forum.

Back to Forum Index : Back to Administration (backend and configuration)   RSS
glouk glouk

16 Jan 2009
Posts: 46

i'd like to have multiple colorschemes for my site, that users could choose at will...

what i'm trying to do is just transmit the $scheme variable and parse it.

here's my setup :

in api.php i added the line :
"Jojo::registerURI("theme[scheme:integer]", 'JOJO_Plugin_glouk_home');"

so i guess that when i call mysite.org/theme0, i should go to my home page and have $_GET["scheme"]=0, or have Jojo::getFormData('scheme','') return the value 0.
But no. $_GET just contains an empty URI item.

what did i do wrong ?
tom

Developer

tom

16 Jan 2009
Posts: 379

if you use theme1 does it return anything? Not sure about get, but in many situations, 0 treated the same as null or false

a useful tool for these things is Charles
http://www.charlesproxy.com/

which will let you see exactly what request is being passed through and what is coming back
glouk glouk

17 Jan 2009
Posts: 46

I've changed my strategy a bit, and decided to have a plugin that handles the "/theme2" thing, hoping that after parsing it and rewriting, the url would be automatically reparsed. but no.

Is it possible and how ?
my rule is set to (works only in the homepage) :
Jojo::registerURI("theme[scheme:integer]", 'JOJO_Plugin_glouk_demo_scheme');
is there a regex equivalent to :
Jojo::registerURI("*theme[scheme:integer]", 'JOJO_Plugin_glouk_demo_scheme');

also, isn't the "allowed_vars" array used to pass variables ? And how does it work ?

I'm looking for a simple way to pass variables, without writing 20 rewrite rules for each one... Is there ?

thanks for your time

here's the code of mycolorscheme plugin :

class Jojo_Plugin_glouk_demo_scheme extends Jojo_Plugin
{
static function getScheme()
{
$scheme = Jojo::getFormData('scheme','');
return $scheme;
}

function getCorrectUrl()
{
global $scheme;
$scheme = Jojo_Plugin_glouk_demo_scheme::getScheme();
echo "myscheme=$scheme<br/>";

$url_exp = explode("theme",$_SERVER['REQUEST_URI']);
$base_url = $url_exp[0];
echo "$base_url<br/>";
return $base_url;
}
}
Back to Forum Index : Back to Administration (backend and configuration)   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.