Category sidebars

10 posts by 3 authors in: Forums > CMS Builder
Last Post: July 16, 2008   (RSS)

By Janet - July 8, 2008

Hi everyone -

I'm trying to make it easy on my client by including special sidebars in one of the categories of my site. There's two sections in this category and each sidebar is specific to a section.

I thought I'd add a couple of sidebar fields to the category database and call those fields into the list and article pages. So far so good.... except both sidebars appear on each page. It looks like I've got to add more parameters into the code. If Undergraduate, then write this sidebar; if Graduate, then write this sidebar.

Here's my code so far:

<?php include ("/usr/www/uga/htdocs/dev/cmsAdmin/templateFiles/viewers/admissionsCategoriesListViewer.php"); ?>
<?php foreach ($listRows as $record): ?>

<?php if (!$record['hide_this_category_from_menu']): ?> //hides one of my categories

<h4><?php echo $record['sidebar_resource_header_a'] ?></h4>
<?php echo $record['sidebar_resourse_list_a'] ?>
<h4><?php echo $record['sidebar_resource_header_b'] ?></h4>
<?php echo $record['sidebar_resource_list_b'] ?>
<?php endif ?>
<?php endforeach ?>

I don't know how to write this PHP into the above context -
if ($type == 'Undergraduate'):
if ($type == 'Graduate'):

Here's the example in all it's duplicious glory: http://uga.edu/dev/ecology/admissionsList.php?category=Undergraduate

and http://uga.edu/dev/ecology/admissions.php?Article_One-1/

Can you help me?

Jan

Re: [Janet] Category sidebars

By Dave - July 8, 2008

Hi Jan,

Try this:

<?php foreach ($listRows as $record): ?>
<?php if (!$record['hide_this_category_from_menu']): ?> //hides one of my categories

<?php if ($record['type'] == 'Undergraduate'): ?>
<h4><?php echo $record['sidebar_resource_header_a'] ?></h4>
<?php echo $record['sidebar_resourse_list_a'] ?>
<?php endif ?>


<?php if ($record['type'] == 'Graduate'): ?>
<h4><?php echo $record['sidebar_resource_header_b'] ?></h4>
<?php echo $record['sidebar_resource_list_b'] ?>
<?php endif ?>

<?php endif ?>
<?php endforeach ?>

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

Re: [Dave] Category sidebars

By Janet - July 14, 2008

Hi Dave - Great talking with you today. And thanks for getting back to me about my sidebar situation. I've chosen a different route which I think will be easier for my client to update. Instead of adding two fields to my category section editor, I've created a special section called "Admissions Resource List" with title, content and a choice of categories - "Undergraduate" and "Graduate." I thought that if I write this in both my admissions.php and my admissionsList.php pages:

<!-- Record List-->
<?php
require_once "/usr/www/uga/htdocs/dev/cmsAdmin/lib/viewer_functions.php";
$options = array();
$options['tableName'] = 'admissions_resources';
$options['recordNum'] = '';
$options['where'] = '';
$record = getRecord($options);
?>
<!-- /Record List -->


<?php if ($record['category'] == 'Undergraduate'): ?>
<?php echo $record['content'] ?><br/>
<?php endif ?>

<?php if ($record['category'] == 'Graduate'): ?>
<?php echo $record['content'] ?><br/>
<?php endif ?>

<!-- /Record List -->

...it would work. And it does, sort of.... the results are a bit mixed.

The undergraduate list and article pages work great [http://uga.edu/dev/ecology/admissionsList.php?category=Undergraduate]

The graduate list page shows my undergraduate sidebar. The graduate article page doesn't show anything at all.
[http://uga.edu/dev/ecology/admissionsList.php?category=Graduate]

Bummer. So close... yet still so far away.

Jan

Re: [Janet] Category sidebars

By Dave - July 14, 2008

Hi Janet,

Is the 'admissions_resources' section a single record section or a list section?

The Graduate page seems to be showing content now. Did you get it figured out? If not can you let me know what part I should be looking for that's not working? Thanks! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Category sidebars

By Janet - July 14, 2008

It's a multi-page section. I thought I could create two articles in the section - one for the undergraduate admissions sidebar which should appear on all the undergraduate admission pages (this is the placeholder content: Mark your calendar-Undergraduate: / Helpful links - Undergraduate:); the other for the graduate admissions sidebar which should appear on the graduate admission pages (this is the placeholder content: Mark your calendar-Graduate: / Helpful links - Graduate:).

The sidebar you see on the graduate page is actually the content from the undergraduate sidebar.

I hope that makes sense.

Jan

Re: [Janet] Category sidebars

By Dave - July 14, 2008

Hi Jan,

Can you email me CMS and FTP (I think I already have that) so I can take a closer look? My email is dave@interactivetools.com.

I have an idea but I think it will be quickest if I can just take a look at the admin sections first.

Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Janet] Category sidebars

By kevbarker - July 16, 2008

Jan,

Could you post a link to the site so that we can see the final result? That would be great if you could.

Thanks,
Kevin

Re: [kevbarker] Category sidebars

By Janet - July 16, 2008

Happy to - the development site is at http://www.uga.edu/dev/ecology/ and the section Dave and I were working on is at http://www.uga.edu/dev/ecology/admissionsList.php?category=Undergraduate and http://www.uga.edu/dev/ecology/admissionsList.php?category=Graduate

I can't keep up with my content editor - I see she's already deleted my test articles but there's one or two up that will show you what we were trying to achieve.

Jan

Re: [Janet] Category sidebars

By kevbarker - July 16, 2008

Thanks! Nice site!

Kevin