Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#2 2007-03-08 18:54:11

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

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

#3 2007-03-08 19:42:03

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#4 2007-03-08 20:09:01

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

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

Board footer

Powered by FluxBB