View previous topic :: View next topic |
Author |
Message |
StingerMKO Smarty Rookie
Joined: 17 Oct 2013 Posts: 6
|
Posted: Thu Oct 17, 2013 10:29 am Post subject: get full url path but without parameter |
|
|
Hi,
which smarty variable gives me the url path without parameters.
Example:
I have an url like this: http://www.mydomain.com/myfolder?p=3
I want to get http://www.mydomain.com/myfolder
With {$smarty.server.HTTP_HOST} I get "http://www.mydomain.com" and with {$smarty.server.REQUEST_URI}I get /myfolder?p=3
So what can I use in my case?
Thanks in Advance!
Malte |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Oct 17, 2013 1:43 pm Post subject: |
|
|
Look at the output of phpinfo(), it will give you the apache _ENV vars, this is what $smarty.server is giving you. You are probably looking for something like SCRIPT_URI |
|
Back to top |
|
StingerMKO Smarty Rookie
Joined: 17 Oct 2013 Posts: 6
|
Posted: Thu Oct 17, 2013 2:05 pm Post subject: |
|
|
I see this in the php info:
safe_mode_allowed_env_vars PHP_
safe_mode_protected_env_vars LD_LIBRARY_PATH
Both don't work.
{$smarty.server.SCRIPT_URI} just gives me "http://www.mydomain.com".
I am not sure, if it is an issue of the Shop software Shopware, which uses the smarty engine. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Oct 17, 2013 2:23 pm Post subject: |
|
|
look for something like this in your phpinfo output:
http://d.pr/i/f4Np
judging by that, I'd say SCRIPT_FILENAME is what you are after. |
|
Back to top |
|
StingerMKO Smarty Rookie
Joined: 17 Oct 2013 Posts: 6
|
Posted: Thu Oct 17, 2013 2:30 pm Post subject: |
|
|
{$smarty.server.SCRIPT_FILENAME} shows
"/var/www/web1/html/shop/shop_4/shopware.php?p=3" |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Oct 17, 2013 2:39 pm Post subject: |
|
|
oops that is the filepath.
SCRIPT_URI should give you the full URL without the query string.
Put something like
http://www.mysite.com/phpinfo.php?abc=123
and check the output, see which one does not contain ?abc=123 |
|
Back to top |
|
StingerMKO Smarty Rookie
Joined: 17 Oct 2013 Posts: 6
|
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Oct 17, 2013 5:35 pm Post subject: |
|
|
what does SCRIPT_URI give you? |
|
Back to top |
|
StingerMKO Smarty Rookie
Joined: 17 Oct 2013 Posts: 6
|
Posted: Fri Oct 18, 2013 7:14 am Post subject: |
|
|
With {$smarty.server.REQUEST_URI}I get /category?p=3 |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Oct 18, 2013 1:21 pm Post subject: |
|
|
SCRIPT_URI should be what you need. What is this for, a link? a relative link should work fine in a browser too (no host name) |
|
Back to top |
|
StingerMKO Smarty Rookie
Joined: 17 Oct 2013 Posts: 6
|
Posted: Tue Nov 05, 2013 2:46 pm Post subject: |
|
|
{$smarty.server.SCRIPT_URI} Does not work in a Shopware template. It returns nothing (empty).
I think what I need is not possible |
|
Back to top |
|
|