Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Grab value of site URL for header redirect
I’m using <txp:php>header('Location:....')</txp:php>
to redirect the browser following successful form completions.
At the moment, I’m developing this site on my personal domain, so I have hand-coded the domain name in there. I would like to able to reference the value of site URL in the preferences, so that it is easier to maintain once I move this on to the real server and domain name.
How do I grab the value from the site preferences? I admit that I’m not really good at how to grab native TxP variables when using PHP.
Thanks
Offline
Re: Grab value of site URL for header redirect
The following two methods should work:
<txp:php>global $prefs; echo $prefs['siteurl'];</txp:php>
or:
<txp:php>echo $GLOBALS['prefs']['siteurl'];</txp:php>
TXP Builders – finely-crafted code, design and txp
Offline