Categories

5 posts by 2 authors in: Forums > CMS Builder
Last Post: June 11, 2008   (RSS)

By andycal - June 8, 2008

Anyone got any clue how to use 'categories'?

Re: [andycal] Categories

By Dave - June 9, 2008

Hi andycal,

Categories are a bit of an advanced feature right now, but maybe I can help you out.

Have you created any other CMS Builder section editors or viewers yet? And what did you want to use categories for?
Dave Edis - Senior Developer
interactivetools.com

Re: [andycal] Categories

By Dave - June 11, 2008

It's pretty much the same as with a regular list of records, except it automatically figured out and assigns a value for 'depth'. So say your variable is named $record['depth'] you can use that to display different classnames (menudepth0, menuDepth1, etc) or use PHP to display different html based on the depth:

<?php foreach ($categoryRecords as $record): ?>

<?php if ($record['depth'] == 0): ?>
<?php echo $record['name'] ?>
<?php endif ?>

<?php if ($record['depth'] == 1): ?>
- <?php echo $record['name'] ?>
<?php endif ?>

<?php if ($record['depth'] == 2): ?>
&nbsp;&nbsp;&nbsp; - <?php echo $record['name'] ?>
<?php endif ?>

<?php endoforeach ?>


The first step is to figure out how you want your categories to look in HTML. Then figure out how to get CMS Builder to output that.

Hope that helps, let me know if you need any more assistance with this one. And yes in future we'll add more options to the code generator to automatically generate category menus for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Categories

By andycal - June 11, 2008

Very cool! Thanks Dave, just off to buy another couple of copies by the way, before the offer ends!