Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
txp:site_url versus hardcoded URL
Is there any performance gain by using a hardcoded URL in a page/form template rather than tag such as <txp:site_url />
or <txp:section url="1" />
? Does the CMS make a database call every time those tags are used in a template or just once then cache?
Offline
Re: txp:site_url versus hardcoded URL
<txp:site_url />
just returns the site-wide constant, so all database wrangling has already been done: no additional overhead (bar the function call and parser itself).
<txp:section url="1" />
reads information from $thissection
or the article context and then calls pagelinkurl()
. That does further processing to return a formatted URL, including raising a plugin callback. So depending on the plugins installed, it could be more “expensive” in terms of raw computation and stack calls.
But neither tag makes any additional DB calls, as all the data they need has already been extracted.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: txp:site_url versus hardcoded URL
Great, thanks Stef!
Offline
Pages: 1