Re: [videopixel] Show field from linked category section
Hi,
What you need to do is to create an array of categories that you can then access when you're outputting your links records. Exactly how you do this will depend on exactly how you're linking your categories to your links (ie, what is the value field of the dropdown?). In this example, it's assuming you're using the num field in the links_category table.
example:
You can put this code up where you're selecting your records
list($categoryRecords,$categoryMetaData) = getRecords(array(
'tableName' => 'links_category',
'allowSearch' => false,
));
$categoryNumToRecord=array();
foreach($categoryRecords as $category){
$categoryNumToRecord[$category['num']]=$category;
}
The variable $categoryNumToRecord is an array of category records, using their 'num' field as an index.
You can then get at the correct category record when outputting your content like this:
<?php foreach ($linksRecords as $record): ?>
<?php $categoryRecord = $categoryNumToRecord[$record['category']];?>
<?php echo $record['title'] ?>
<?php echo $record['url'] ?>
<?php endforeach ?>
You can now use the variable $categoryRecord to output any information stored in that category record.
Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/