Sub-Categories ?

12 posts by 2 authors in: Forums > CMS Builder
Last Post: March 15, 2008   (RSS)

By avrom - March 9, 2008


Hello Dave,

My current client has a PDF upload page, with four categories for her PDF's (i.e. Cat1, Cat2, Cat3...)

Each Category (i.e. Cat1) will have a set of multiple records listing each PDF file that is uploaded, no problem there (you already helped with an issue on that). So one Category might have 5 items, another category might have 7 PDF files. etc.

The easiest solution is to have four different "menu" items, and then she can add, delete, and reorder her PDF entries in each section, so four different sections. Easy and done... (Sometimes there is something to be said for keeping it simple)

Is there a way to combine it all together into one PDF Files section, but have them separated by the four different categories ?? Ideally if she could change the category name that would be great... I think what I am asking for is sub-categories ?

Thanks muchly,
Avrom

Re: [virgodesign] Sub-Categories ?

By Dave - March 10, 2008

So are all the PDFs in one "section editor"? And there's 4 category fields? Or is each record a "category" with multiple PDFs uploaded for it? Can PDFs belong to multiple categories?

There's probably a few ways to do this. Do you have a sample mockup page showing the output that we could see?

Have a look at what we did here with the jobs page:
http://www.interactivetools.com/consulting/cmsbuilder/jobs/index.php

Is that close? Let me know some more details and I'll help you get it working.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Sub-Categories ?

By avrom - March 11, 2008

Hi Dave,

There are four categories for the PDF upload sections:

MPG
Leadership
Team
Workshops
Organizational Learning

Each of those sections will have multiple pdf uploads. I noticed I can upload multiple pdf's with the upload feature. They will be listed in each category in whatever order she places them in.

So MPG may have 5 pdf's to list, Leaderhsip may have 3, or whatever.

I will use an option field for the file name to be displayed. i.e. info1 "Leadership training schedule" which will link to the pdf file (as you showed me in forum 59768):

<a href="<?php echo $upload['urlPath'] ?>"><?php echo $upload['info1'] ?></a><br/>

Dave, does this clarify what I am trying to do ?

Much thanks,
Avrom

Re: [Dave] Sub-Categories ?

By avrom - March 12, 2008

Hi Dave,

Here is some more clarification. Thank you very much.

So are all the PDFs in one "section editor"?
YES would be nicest way.

And there's 4 category fields?
YES 4 or 5 Categories

Or is each record a "category" with multiple PDFs uploaded for it? Can PDFs belong to multiple categories?
YES Multiple PDF's uploaded to each category. No need for PDF's to belong in multiple categories, they will only belong to one category.

SO I'm thinking the best way would be to use a "single page viewer" called "PDF Page", and just load multiple PDF's to each category. I assume I can display each PDF and just link to them like a picture gallery... as code below.

Do you think that is the best way ?

Cheers and much thanks :)
Avrom

Re: [Dave] Sub-Categories ?

By avrom - March 12, 2008

Dude you rock ! :)

That's so easy why didn't I think of that ? This way she can create her own categories as well.

PS I'll be snapping up that multi-pack before the 26th.

Re: [virgodesign] Sub-Categories ?

By Dave - March 12, 2008

Glad to hear that will work! And thanks for the business! We'll keep working hard to earn it. :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Sub-Categories ?

By avrom - March 14, 2008 - edited: March 14, 2008

Hey Dave, so sorry to keep bothering you here. but just not sure how to integrate the php coding.

Okay so no problem :) Cheers

Using a Multi Page for the categories:

table: pdf_upload
Section: (text-box: The Category)
order: (list 1..10)
pdf_files: (Upload of pdf files)
info1: (Pdf name for link)

All set up in the CMS. However I want to list both the "List Viewer" and the "Page Viewer" all on the same page, so each of the pdf files is listed under each category. But I'm not sure how to do that. Here is what I came up with so far. I'm kinda thinking I don't need the "Page Viewer" code here:

<?php foreach ($listRows as $record): ?>
<h6><?php echo $record['section'] ?></h6>

<?php if (empty($record['pdf_files'])): ?>
No record found!
<?php endif ?>

<?php foreach (getUploads($options['tableName'], 'pdf_files', $record['num']) as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>"><?php echo $upload['info1'] ?></a><br/>
<?php endforeach ?>

<?php endforeach ?>

Re: [virgodesign] Sub-Categories ?

By Dave - March 14, 2008

So you want all the categories listed on one page with PDFs underneath? Is that right? Yes, the code you have there looks good.

Another thing you can do is loop over the $listrows multiple times in the same page. So you could have this to show headings:

<?php foreach ($listRows as $record): ?>
<h6><?php echo $record['section'] ?></h6>
<?php endforeach ?>


And then another one further down the page that listed the titles and PDFs. That's how we did this job page:
http://www.interactivetools.com/consulting/cmsbuilder/jobs/index.php

Hope that helps, let me know if you need anything else or if there's any errors with it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Sub-Categories ?

By avrom - March 14, 2008

Hi Dave,

Yes, like the bottom part of your example page. I thought the php looked right, but its not displaying the pdf files, I think there is something missing. Here was my list viewer deceleration, I didn't use the page viewer deceleration:

require_once "/website example path/cmsAdmin/lib/viewer_functions.php";
$options = array();
$options['tableName'] = 'pdf_upload';
$options['titleField'] = '';
$options['viewerUrl'] = '';
$options['perPage'] = '';
$options['orderBy'] = '';
$options['pageNum'] = '';
$options['where'] = '';
$options['useSeoUrls'] = '';
list($listRows, $listDetails) = getListRows($options);