Get list of Section Names

7 posts by 2 authors in: Forums > CMS Builder
Last Post: October 2, 2008   (RSS)

Sorry for this post, I searched the Forum but couldn't find the answer... maybe searching using the wrong terms.

How can I get a list of all the 'Sections' so that I can build a dynamic menu for my CMS site. I want to load each section into an array and then load the subPages so that I can create a simple menu like the sample below:

Section 1
- Page 1
- Page 2
- Page 3

Section 2
- Page 1
- Page 2
- Page 3

... and so on. The sections would be the section name in the CMS and the pages would be the titles.

I am sure this is something simple, but my brain is not catching it.

Thanks,
Doug

Re: [dougdrury] Get list of Section Names

Anyone have any ideas?

Re: [dougdrury] Get list of Section Names

By Dave - October 1, 2008

There's nothing officially supported for this - but you could try using this code:

<?php foreach (getSchemaTables() as $table): ?>
<?php echo $table ?><br/>
<?php endforeach ?>


Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Get list of Section Names

By dougdrury - October 1, 2008 - edited: October 1, 2008

Thanks Dave,
Are there methods like:
getSchemaTableNames(); or getSchemaTableTitle();
getSchemaTableIDs();

I need to be able to use the name of the table that shows up in the admin menus. Like 'My Table = my_table'.

I found the functions where you all have getSchemaTables(); and poked around to see what other methods are in there... I understand that most people would start with a static set of top level menu items, but I have a requirement to have the dynamic menu expand/sort as people add more sections. Just don't want to have to manually change the top levels to reflect new sections if I don't have to.

Thanks.
Doug

Re: [dougdrury] Get list of Section Names

By dougdrury - October 1, 2008 - edited: October 1, 2008

Also, is there a way to get at the order of the main sections? I know over the editor you can reorder the sections, so somewhere it should be something I can read so I can order the sections the same way?

Does CMSBuilder have a way to send add hoc SQL queries to the database? I could then just do this myself without having to setup my own mysql_query() type calls.

Thanks,
Doug

Re: [Dave] Get list of Section Names

Dave,
Thanks. I will check these options out!!

Regards,
Doug