[RESOLVED]Passing URL vars ?

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
voxberry
Forum Members
Forum Members
Posts: 56
Joined: Tue Sep 01, 2009 1:04 pm

[RESOLVED]Passing URL vars ?

Post by voxberry »

Hello .

I'm working on a function that displays some data from mysql .

so at some point I need to get a var from the url : http://www.site.com/index.php?page=home&[b]somevar[/b]=somedata

I can use $_GET['somevar'];
but I think I'm doing it wrong .

I found that smarty should work with this : $smarty.get.somevar . but it does not work for me .

any help on passing url vars ?
Last edited by voxberry on Mon Dec 21, 2009 12:39 pm, edited 1 time in total.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Passing URL vars ?

Post by jmcgin51 »

this is not a CMSMS question.  Any PHP tutorial site will explain this.  I like www.w3schools.com/php
voxberry
Forum Members
Forum Members
Posts: 56
Joined: Tue Sep 01, 2009 1:04 pm

Re: Passing URL vars ?

Post by voxberry »

well ... I think it is a CMSMS question as it does use SMARTY ... and I was trying to learn how to get vars from the url as CMSMS does ...

I was not asking for a basic php method to read the vars from the url . (like $var = $_GET['var']; / $var = $_POST['var'];)

I was asking how one would do that INSIDE CMSMS, maybe using the SMARTY engine .
dipper88
New Member
New Member
Posts: 5
Joined: Fri Sep 04, 2009 9:46 pm

Re: Passing URL vars ?

Post by dipper88 »

I too had the same problem and solved it the following way

Code: Select all

{php}
$this->assign('var',$_GET['var']);
{/php}
There might be some way to have the code look more uniform, but at least this one's working
voxberry
Forum Members
Forum Members
Posts: 56
Joined: Tue Sep 01, 2009 1:04 pm

Re: Passing URL vars ?

Post by voxberry »

well.... something like that .
only I'm looking to do this inside a /function.dblist.php file, and $this->assign('var',$_GET['var']); does not work outside content .

anyway .. yup, i'm looking for something like that .

My main problem is that using simple $_GET would be vurnerable and I was thinking that i can somehow use smarty for a safer var passing .

thanks anyway . anymore input on this is welcomed .
Last edited by voxberry on Mon Dec 21, 2009 8:23 am, edited 1 time in total.
voxberry
Forum Members
Forum Members
Posts: 56
Joined: Tue Sep 01, 2009 1:04 pm

Re: Passing URL vars ?

Post by voxberry »

well....

i donno how I made this work and I still donno how good it works, but here is what works for me :

     $smarty->assign('VAR',$_GET['VAR']);
     $VAR= $smarty->get_template_vars('VAR');

and I think with pretty urls the security problem is less of a problem .
Last edited by voxberry on Mon Dec 21, 2009 8:24 am, edited 1 time in total.
Post Reply

Return to “CMSMS Core”