View previous topic :: View next topic |
Author |
Message |
enhance Smarty n00b
Joined: 24 May 2003 Posts: 3
|
Posted: Sat May 24, 2003 10:31 pm Post subject: get url string |
|
|
I have problem that I just can't figure out from smarty.
I have a url that appears something like this:
When someone goes here:
info.php?qstId=10&dat=foo
I need the "foo" to display in the template.
so anytime someone clicks on a link in the template,
"foo" stays in the url.
I basically need to include this somehow:
a href="info.php?qstId={$QuestionId}&dat={$dat}"
Thank You for any help,
Joe |
|
Back to top |
|
aloner Smarty Rookie
Joined: 24 Apr 2003 Posts: 24
|
Posted: Sat May 24, 2003 10:36 pm Post subject: |
|
|
Maybe
{$smarty.get.qstId}
{$smarty.get.dat}
?
_________________ Your ad here. |
|
Back to top |
|
enhance Smarty n00b
Joined: 24 May 2003 Posts: 3
|
Posted: Sat May 24, 2003 10:57 pm Post subject: |
|
|
I included that in the template and no luck.
this little problem is driving me insane, if someone could help or explain what to do. It would help me greatly.
Thanks,
Joe |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sun May 25, 2003 12:43 am Post subject: |
|
|
hmmm, if aloner's solution didn't work, then this REALLY should work:
[php:1:97d15388b1]<?php
$smarty->assign( 'qstId', $_REQUEST['qstId'] );
$smarty->assign( 'dat', $_REQUEST['dat'] );
?>[/php:1:97d15388b1]
Code: |
<a href="info.php?qstId={$qstId}&dat={$dat}">
|
|
|
Back to top |
|
sweatje Smarty Regular
Joined: 17 Apr 2003 Posts: 70 Location: Bettendorf, Iowa, USA
|
Posted: Sun May 25, 2003 2:31 am Post subject: |
|
|
Or sometimes I do:
[php:1:7d2ee91ccc]<?php
$smarty->Assign('selflink', $_SERVER['REQUEST_URI']);
php>[/php:1:7d2ee91ccc]
and Code: | <a href="{$selflink}">foo</a> |
_________________ Jason
jsweat_php AT yahoo DOT com |
|
Back to top |
|
enhance Smarty n00b
Joined: 24 May 2003 Posts: 3
|
Posted: Sun May 25, 2003 4:09 pm Post subject: thanks |
|
|
thank you to all who replied and thanks to boots for the code. That prove to be the best method for me. |
|
Back to top |
|
Ze Smarty Rookie
Joined: 13 Jun 2003 Posts: 5 Location: Rennes, France
|
Posted: Fri Jun 13, 2003 9:56 am Post subject: how to get complete url |
|
|
Hi,
I would like use in my templates the complete url of the current page (ie: http://www.site.com/idndex.php?arg=value&bar=foo)
Is there a way to get this url directly with a smarty feature ?
I have try {$smarty.get.page} but this display nothing...
Someone have an elegant solution for me ? Do i need to code a php function who return this url and use it on my template ?
Ze |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Jun 13, 2003 10:21 am Post subject: Re: how to get complete url |
|
|
Hi Ze:
Smarty provides access to the PHP $_SERVER (or $HTTP_SERVER_VARS as appropriate) superglobal.
You can probably use {$smarty.server.REQUEST_URI} as that is most likely what you need (note this returns the URI, not the URL). As you are probably aware, you could also get other values by using one of the keys described in the reserved variables page of the PHP manual. (of interest here: SERVER_NAME, HTTP_HOST and SERVER_PORT).
HTH
Last edited by boots on Fri Jun 13, 2003 2:29 pm; edited 1 time in total |
|
Back to top |
|
Ze Smarty Rookie
Joined: 13 Jun 2003 Posts: 5 Location: Rennes, France
|
Posted: Fri Jun 13, 2003 1:37 pm Post subject: |
|
|
Thank you very much, i'm probably tired . I have missed in the documentation that in {$smarty.get.page}, page is an argument of the exemple's URL .... I'm so stupid !
Thanks again for smarty's forum !
Ze _________________ --
Yann RICHARD |
|
Back to top |
|
|