urlparam and pretty urls

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
cnisvcs
Forum Members
Forum Members
Posts: 37
Joined: Wed Jan 30, 2008 3:02 am

urlparam and pretty urls

Post by cnisvcs »

This seems to be a basic stuff, but I cant't find the answer. I need to modify the content of a specific page if it is entered from another specific page. Seems that you accomplish that by adding urlparam to the {cms_selflink} on the originating page and check for the existence of that parameter on the destination page with {if $smarty.get.myparamhere}. Well, it doesn't work for me. My selflink tag looks like the one below:

{cms_selflink page="page-alias" text="Back" urlparam="&myparam=1"}

The url used by the browser is:

http://www.mywebsite.com/index.php/page-alias&myparam=1

and the browser shows error 404.

I should have mentioned that pretty urls are turned on for this site, but I never found the indication, that pretty urls don't like urlparam.

I disabled the pretty urls to move on with this, but, if posible, I would like to have them on and parse the parameters between pages using GET method. Is that possible? If so, how?
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: urlparam and pretty urls

Post by CWebguy »

Your first parameter needs to come after a question mark and not an ampersand (&).

Cheers!
CMSMS Made
cnisvcs
Forum Members
Forum Members
Posts: 37
Joined: Wed Jan 30, 2008 3:02 am

Re: urlparam and pretty urls

Post by cnisvcs »

Thanks for the response, WebGuy. The first parameter is "page-alias", which in pretty urls comes after index.php/. I don't think the question mark is used when pretty urls are turned on.

It just seems like with pretty urls you can parse only one parameter using GET method and it is the page alias. I would love if one of developers indicated whether I'm right or wrong.

BTW, in the process of experimenting with different syntax I tried

http://www.mywebsite.com/index.php/page-alias?myparam=1

but that gave me 404 as well.
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: urlparam and pretty urls

Post by CWebguy »

You have to change your rewrite code to fetch the variable if that's what you are trying to do.

Try changing

RewriteRule ^(.+)$ index.php?page=$1 [QSA]

to

RewriteRule ^(.+)&(.+)$ index.php?page=$1&param=$2 [QSA]
CMSMS Made
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: urlparam and pretty urls

Post by CWebguy »

what's happening is you are doing the url

pagename&parameter=2

but the server is doing

index.php?page=pagename&parameter=2

Which it can't find cause it doesn't exist.

Cheers,
CMSMS Made
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: urlparam and pretty urls

Post by CWebguy »

sorry I gave you bad code, isn't hard to explain.  I don't want to mess it up if someone else can explain this better, if not I'll be happy to help.

Take care.
CMSMS Made
Post Reply

Return to “CMSMS Core”