Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-09-04 18:30:15

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

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

#2 2011-09-04 21:05:53

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

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

Board footer

Powered by FluxBB