Categories
5 posts by 2 authors in: Forums > CMS Builder
Last Post: June 11, 2008 (RSS)
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?
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
interactivetools.com
Re: [Dave] Categories
By andycal - June 11, 2008
Hiya,
I was juist wondering how to use them to display stuff, but having looked at the database tables it looks pretty straight forward. I'm going to have a play with writing my own code for now, I guess it will be a lot easier in later versions of CMS builder.
I was juist wondering how to use them to display stuff, but having looked at the database tables it looks pretty straight forward. I'm going to have a play with writing my own code for now, I guess it will be a lot easier in later versions of CMS builder.
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:
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.
<?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): ?>
- <?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
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!