Home | Products | Consulting | Hosting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Category sidebars

 

 


Janet
User

Jul 8, 2008, 11:50 AM

Post #1 of 10 (434 views)
Shortcut
Category sidebars Can't Post

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


Dave
Staff / Moderator


Jul 8, 2008, 3:38 PM

Post #2 of 10 (429 views)
Shortcut
Re: [Janet] Category sidebars [In reply to] Can't Post

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


Janet
User

Jul 14, 2008, 1:57 PM

Post #3 of 10 (384 views)
Shortcut
Re: [Dave] Category sidebars [In reply to] Can't Post

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


Dave
Staff / Moderator


Jul 14, 2008, 2:53 PM

Post #4 of 10 (379 views)
Shortcut
Re: [Janet] Category sidebars [In reply to] Can't Post

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


Janet
User

Jul 14, 2008, 3:46 PM

Post #5 of 10 (374 views)
Shortcut
Re: [Dave] Category sidebars [In reply to] Can't Post

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


Dave
Staff / Moderator


Jul 14, 2008, 4:50 PM

Post #6 of 10 (368 views)
Shortcut
Re: [Janet] Category sidebars [In reply to] Can't Post

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


Janet
User

Jul 16, 2008, 7:15 AM

Post #7 of 10 (328 views)
Shortcut
Re: [Dave] Category sidebars [In reply to] Can't Post

Thanks so much Dave. Your solution worked perfectly. My client can now add content to sidebars that appear on both the category list page and all the articles within that category. PLUS she can write separate sidebars based on the category.

Here's the solution in a nutshell:
1. Admin > Section Editor > Create a section with your categories (Section Name: Cat A, Cat B). I named this section "Admissions" with Undergraduate and Graduate as my categories.
2. Admin > Section Editor > Create another section for your sidebars Add a field for [content] and a list field containing the categories listed above (Cat A, Cat B). I named my section editor "Admissions Resource List" and included a list field containing "Undergraduate" and "Graduate" as options.

Now my client can now create sidebars in the "Admissions Resource List" section and choose which category she'd like that sidebar to appear. The sidebar appears on both the category (List) page and the article pages.

Here's the code for the admissionList.php page. I put it in a right sidebar div tag (well, actually Dave did... thank you Dave):

<!-- STEP1: Load Record List (Paste this above other steps) -->
<?php
require_once "/usr/www/uga/htdocs/dev/cmsAdmin/lib/viewer_functions.php";
$options = array();
$options['tableName'] = 'your_section_name;
$escapedCategory = mysql_real_escape_string(@$_REQUEST['category']);
$options['where'] = "category = '$escapedCategory'";

$record = getRecord($options);
?>
<!-- /STEP1: Load Record List inside sidebar DIV tag -->

<?php echo $record['content'] ?>

Here's the code for admissionsPage.php (article pages). Instead of $_REQUEST['category'] use $record['category'] (or whatever variable holds the category name) instead. Like this:

$escapedCategory = mysql_real_escape_string(@$record['category']);
$options['where'] = "category = '$escapedCategory'"; :

<!-- STEP1 for article pages: Load Record List (Paste this above other steps) -->
<?php
require_once "/usr/www/uga/htdocs/dev/cmsAdmin/lib/viewer_functions.php";
$options = array();
$options['tableName'] = 'your_section_name';

$escapedCategory = mysql_real_escape_string(@$record['category']);
$options['where'] = "category = '$escapedCategory'";

$record = getRecord($options);
?>
<!-- /STEP1: Load Record List inside article page sidebar DIV -->

<?php echo $record['content'] ?><br/>


Worked like a charm!

Thanks again Dave,

Jan


kevbarker
User

Jul 16, 2008, 9:16 AM

Post #8 of 10 (321 views)
Shortcut
Re: [Janet] Category sidebars [In reply to] Can't Post

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


Janet
User

Jul 16, 2008, 10:46 AM

Post #9 of 10 (305 views)
Shortcut
Re: [kevbarker] Category sidebars [In reply to] Can't Post

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


kevbarker
User

Jul 16, 2008, 12:36 PM

Post #10 of 10 (286 views)
Shortcut
Re: [Janet] Category sidebars [In reply to] Can't Post

Thanks! Nice site!

Kevin

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Hosting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4