SUBCATEGORIES

6 posts by 2 authors in: Forums > CMS Builder
Last Post: October 27, 2009   (RSS)

Re: [kitka] SUBCATEGORIES

By Dave - October 26, 2009

Hi kitka,

Use the Code Generator to make a list viewer page that lists all the "Content" records. You'll then be able to list "content" records from specific subcategories by adding something like this:

contentList.php?subcategory=15

Once you have all the content records showing you can filter them by adding search conditions in the url or in the where option. For more information about how searching works see this page in the docs:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

Note: Replace 'subcategory' with whatever the name of your field is that the subcategory value is stored in. And use the number if you are storing the number (or the name if you are storing the name) to lookup associated records.

Hope that makes sense. Let me know how it goes.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] SUBCATEGORIES

By kitka - October 26, 2009

Still a little confsed sorry>>>>

I created the contentList.php with the follwing code

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

require_once "/usr/home/web/users/a0019131/html/cmsAdmin/lib/viewer_functions.php";

list($contentRecords, $contentMetaData) = getRecords(array(
'tableName' => 'content',
));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
</head>
<body>

<!-- INSTRUCTIONS -->
<div class="instructions">
<b>Sample List Viewer - Instructions:</b>
<ol>
<?php ?>
<li><b>Remove any fields you don't want displayed.</b> (Most list pages only have title and link fields.)</li>
<li>Rearrange remaining fields to suit your needs.</li>
<li>Copy and paste code into previously designed page (or add design to this page).</li>
</ol>
</div>
<!-- /INSTRUCTIONS -->

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Content - List Page Viewer</h1>
<?php foreach ($contentRecords as $record): ?>
Record Number: <?php echo $record['num'] ?><br/>
Title: <?php echo $record['title'] ?><br/>
Category: <?php echo $record['category'] ?><br/>
Content: <?php echo $record['content'] ?><br/>
Price: <?php echo $record['price'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>


<!-- STEP 2a: Display Uploads for field 'photo' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($record['photo'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->



<!-- STEP 2a: Display Uploads for field 'photo_2' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($record['photo_2'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->


<hr/>
<?php endforeach; ?>

<?php if (!$contentRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->

</body>
</html>


Lets say i have a category called rugs" and it si record 15


Where do i insert the doe as suggested
[font "Verdana"]contentList.php?subcategory=15

jim albert

Re: [kitka] SUBCATEGORIES

By Dave - October 26, 2009

Hi Kitka,

Like this: http://www.cadainfo.com/contentList.php?category=Rugs

So basically you just need to create a link on your categoryList.php page that goes to http://www.cadainfo.com/contentList.php?category=Rugs and puts the category name where "Rugs" is.

Hope that helps! Let me know how that goes.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] SUBCATEGORIES

By kitka - October 26, 2009

Hi Dave:

I might hire you to do a couple of quick mods for me...
Is there a good time to get ahold of you diectly...

Easier to explain by phone via email first


JIM
jim albert

Re: [kitka] SUBCATEGORIES

By Dave - October 27, 2009

Hi Jim,

Sure just email me your contact info and availability and I'll give you a call. You can reach me at dave@interactivetools.com

Thanks!
Dave Edis - Senior Developer
interactivetools.com