Associating links with specific categories
            13 posts by 2 authors in: Forums > CMS Builder
Last Post: July 16, 2012   (RSS)          
          Hi, Jason.
Can you point me in the direction of an example, please?
Here's what I use in the head of my document:
And this is to put the information on the page:
Thanks,
                          
        Can you point me in the direction of an example, please?
Here's what I use in the head of my document:
list($product_categoriesRecords, $product_categoriesMetaData) = getRecords(array(
    'tableName'   => 'product_categories',
    'loadUploads' => true,
    'allowSearch' => false,
  ));
list($our_productsRecords, $our_productsMetaData) = getRecords(array( 
    'tableName'   => 'our_products', 
    'loadUploads' => true, 
    'allowSearch' => false, 
    'where'       => "category = '".intval(@$_REQUEST['main_category'])."'", 
  ));And this is to put the information on the page:
    <?php foreach ($our_productsRecords as $record): ?>
      <h2><?php echo $record['category:label'] ?></h2> 
	  <p><strong><a href="<?php echo $record['_link'] ?>"><?php echo htmlencode($record['title']) ?></a></strong></p>
    <?php endforeach ?>Thanks,
      Nigel Gordijk
 
Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net
                    Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net
Re: [NigelGordijk] Associating links with specific categories
By Jason - July 16, 2012
          Hi Nigel,
Try this technique where you take the first record from the list and output the category label:
Hope this helps
                          
        Try this technique where you take the first record from the list and output the category label:
<?php $firstRecord = @$our_productsRecords[0]; ?>
<?php if ($firstRecord): ?>
  <h2><?php echo $firstRecord['category:label'];?></h2>
<?php endif ?>
<?php foreach ($our_productsRecords as $record): ?> 
    <p><strong><a href="<?php echo $record['_link'] ?>"><?php echo htmlencode($record['title']) ?></a></strong></p> 
<?php endforeach ?>Hope this helps
      ---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
                    Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
          Perfect! Thank you for your patience and help.
http://www.heritageacresnutrition.com/products.php
                          
        http://www.heritageacresnutrition.com/products.php
      Nigel Gordijk
 
Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net
                    Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net