Get list of Section Names
7 posts by 2 authors in: Forums > CMS Builder
Last Post: October 2, 2008 (RSS)
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
By Dave - October 1, 2008
<?php foreach (getSchemaTables() as $table): ?>
<?php echo $table ?><br/>
<?php endforeach ?>
Hope that helps!
interactivetools.com
Re: [Dave] Get list of Section Names
By dougdrury - October 1, 2008 - edited: October 1, 2008
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
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: [dougdrury] Get list of Section Names
By Dave - October 2, 2008
For getting the schema's sorted by order you could try getSortedSchemas() eg:
<?php foreach (getSortedSchemas() as $tableName => $schema): ?>
...
As far as sending ad hoc SQL queries. I had thought about adding that, but by the time you're at that point it's pretty much as easy to do it with PHP functions such as mysql_query(). If you load viewer_functions.php first, though, it will automatically connect to the database for you so you won't have to do that.
Hope that helps!
interactivetools.com
Re: [Dave] Get list of Section Names
By dougdrury - October 2, 2008
Thanks. I will check these options out!!
Regards,
Doug