1
tayling
Passing $_REQUEST variable to theme
  • 2009/12/22 14:14

  • tayling

  • Just popping in

  • Posts: 86

  • Since: 2002/1/3 7


I am using htaccess to redirect url when using a number (customer number -e.g. mysite.com/1234 - the 1234 custiner no is being captured ok in root index.php and redirecting to start module - I need to pass the customer number to theme to greet the customer and change the images.
Any ideas gratefully received
Regards

Tony

2
Dylian
Re: Passing $_REQUEST variable to theme
  • 2009/12/22 15:17

  • Dylian

  • Friend of XOOPS

  • Posts: 237

  • Since: 2007/7/21


If i'm not wrong you could use <{$smarty.get.the_var_you_want}> in smarty templates as this equals $_GET['the_var_you_want'] in PHP.

Click [HERE] for more information.

Greets Dylian.

3
andrey3761
Re: Passing $_REQUEST variable to theme

<{$smarty.server.REQUEST_URI}>

4
tayling
Re: Passing $_REQUEST variable to theme
  • 2009/12/22 21:54

  • tayling

  • Just popping in

  • Posts: 86

  • Since: 2002/1/3 7


thanks for that - but it givers me the url of the current page which has redirected already - my user no is collected on root index.php and put in a variable in index.php but is not available when the theme first appears. So it needs to be made a session or global variable
Thanks for helping
Tony

5
Dylian
Re: Passing $_REQUEST variable to theme
  • 2009/12/22 22:44

  • Dylian

  • Friend of XOOPS

  • Posts: 237

  • Since: 2007/7/21


First can you send a copy of your .htaccess file?

And second, if you do your redirect like this the users id will be passed correctly.

RewriteEngine On
RewriteRule 
^([0-9]+)$ your/desired/path/file.php?userid=$[R]


The [R] flag tels apache to redirect. And if you want to keep it real nice you could replace [R] with [L]. If you do this the user won't be redirected but just stays on the current url, while the desired file is still loaded.

Greets Dylian.

BTW To get the users id from within the template you could then use <{$smarty.get.userid}>

6
tayling
Re: Passing $_REQUEST variable to theme
  • 2009/12/23 0:20

  • tayling

  • Just popping in

  • Posts: 86

  • Since: 2002/1/3 7


Hi Dylian
thanks for replyingmyht access file
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([0-9]{1,10})$ http://www.partsjpn.com/index.php?site=$1

No user is logged in at this point - I am trying to avoid that for the moment. It will all be anonymous unless managers acces the site,

I still need the url request in the theme to process look and feel

Cheers
Tony

7
trabis
Re: Passing $_REQUEST variable to theme
  • 2009/12/23 0:24

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Did you try this ?

Login

Who's Online

50 user(s) are online (31 user(s) are browsing Support Forums)


Members: 0


Guests: 50


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits