Show sub-sections on new page

4 posts by 2 authors in: Forums > CMS Builder
Last Post: April 26, 2015   (RSS)

By Toledoh - April 23, 2015

I ended up with the following - but I'm sure it's a bit rough!


$url = $_SERVER['REQUEST_URI'];
$query = parse_url($url, PHP_URL_QUERY);
$vars = array();
parse_str($query, $vars);

list($pagesRecords, $selectedPages) = getCategories(array(
'tableName' => 'pages', //
'categoryFormat' => 'onelevel', // showall, onelevel, twolevel, breadcrumb

// advanced options (you can safely ignore these)
'rootCategoryNum' => $vars['num'], // Only categories _below_ this one will be shown (defaults to blank or 0 for all)
));

Cheers,

Tim (toledoh.com.au)

By ross - April 24, 2015

Hi Tim

Thanks for posting! Sounds like you got something working so feel free to move on with that. I do have some other ideas though :).

My first thought is how about sending the parent number in the URL when you link to the sub category?  This idea means instead of using the ['_link'] variable you'll need to create a manual link to your sub category page so it might not be ideal.  Does it make enough sense at this stage? Or can I elaborate for you some more?

Another idea is that once you are on the sub category page, you probably have the sub category number in the URL. You could do a quick look in the database to see what the current sub category's parent category number is, then look up the rest of the details for the parent category from there. Does that make sense as well?

Let me know what you think.  Again though, since you have a solution in place, feel free to move forward with it instead of re-doing anything based on my ideas. Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Toledoh - April 26, 2015

Hey Ross,

If this is working - and not "bad code" then I'm happy!  Thanks.

Cheers,

Tim (toledoh.com.au)