Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-03-08 18:23:21
- sinusffm
- New Member
- From: Frankfurt / M
- Registered: 2007-03-06
- Posts: 5
Getting sections as array using php
Hi guys,
is it possible to read all site sections using php? I’m searching for something like:
<txp:php>$mySection = array(get_sections());</txp:php>
Is there something like a reference for the methods available in Textpattern?
Tanks in advance
Cheers
Frederik
Offline
Re: Getting sections as array using php
PHPXref is super handy for this. I thank Bert on a daily basis for making this available. Otherwise the Source code is fairly well organized and easy to read.
Last edited by hakjoon (2007-03-08 18:57:30)
Shoving is the answer – pusher robot
Offline
Re: Getting sections as array using php
<txp:php>$sections = safe_column('name', 'txp_section', '1=1');</txp:php>
Replace ‘name’ with ‘title’ if you want the section titles.
Offline
Re: Getting sections as array using php
Probably want to do
<txp:php>$sections = safe_column('name', 'txp_section', "name != 'default'"); </txp:php>
in order to exclude the default section.
Shoving is the answer – pusher robot
Offline
#5 2007-03-08 20:50:24
- sinusffm
- New Member
- From: Frankfurt / M
- Registered: 2007-03-06
- Posts: 5
Re: Getting sections as array using php
Awesome, this
<txp:php>$sections = safe_column('name', 'txp_section', "name != 'default'"); </txp:php>
was exactly what I was looking for! And by using PXPXRef I understand what it does as well.
You saved me a lot of time.
Thanks
Frederik
Offline
Pages: 1