Need help cross referencing
10 posts by 2 authors in: Forums > CMS Builder
Last Post: December 15, 2010 (RSS)
Now I need to create a section that has only brochures and only spec sheets. How do I create a new section editor that will pull all the brochures and spec sheets from all the download records?
I tried to make a related records field but I am not sure how to go about this.
Please help.
Re: [dccreatives] Need help cross referencing
By Jason - December 14, 2010
Could you give some more clarification on what you're trying to accomplish? How are you trying to "pull" these records? Are you just trying to get the records from the downloads section or the actual files that have been uploaded?
Let me know and we'll see what we can figure out.
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Need help cross referencing
I want to pull all the spec sheets from all the items in downloads in one list. and the same for brochures. Here's an example.
On this page: http://www.axislighting.com/CMS/downloadsList.php are the items with downloads so far. The first item is brochures. What I want is to call all the brochures in one list. The next items is the Product Images. I want to call all the project images in one list. So if someone only wants to see brochures or only wants to see all the Product Images, I should be able to show it in a list. Please advise.
Re: [dccreatives] Need help cross referencing
By Jason - December 15, 2010
Okay, I think I see where you're going with this. How are you able to differentiate between an upload that's a brochure and an upload that product images?
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Need help cross referencing
<?php foreach ($downloadsRecord['brochure'] as $upload): ?> This would be how I call the brochure for each item
<?php foreach ($downloadsRecord['specification_sheets'] as $upload): ?> This would be how I call the spec sheets for each item
I have each one as a separare uploads field in the Downloads section editor for each item.
Re: [dccreatives] Need help cross referencing
By Jason - December 15, 2010
I think the easiest way to do this would be to create 3 new arrays.
In this example, we'll loop through all of the record returned from the Downloads section:
$product_images = array();
$brochures = array();
$specification_sheets = array();
foreach($downloadsRecords as $downloadsRecord){
if($downloadsRecord['product_images']){
$product_images[]=$downloadsRecords['product_images'];
}
if($downloadsRecord['brochures']){
$brochures[]=$downloadsRecords['brochures'];
}
if($downloadsRecord['specification_sheets']){
$specification_sheets[]=$downloadsRecords['specification_sheets'];
}
}
We now have all the uploads for each section stored in an individual array.
Now we can output a list. For example, brochures:
<?php foreach($brochures as $brochure):?>
<?php foreach($brochure as $upload):?>
*OUTPUT BROCHURE*
<?php endforeach ?>
<?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/
Re: [Jason] Need help cross referencing
Re: [dccreatives] Need help cross referencing
By Jason - December 15, 2010
You would put the code that creates the arrays up near the top of your page, after your return your records from Downloads.
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/
Re: [Jason] Need help cross referencing
I am attaching the file. Something is not correct with the way I inserted the code.
Please advise.
Re: [dccreatives] Need help cross referencing
By Jason - December 15, 2010
There was a typo, we had an "s" at the end of the variable name. Try replacing the code like this:
foreach($downloadsRecords as $downloadsRecord){
if($downloadsRecord['product_images']){
$product_images[]=$downloadsRecord['product_images'];
}
if($downloadsRecord['brochure']){
$brochures[]=$downloadsRecord['brochure'];
}
if($downloadsRecord['specification_sheets']){
$specification_sheets[]=$downloadsRecord['specification_sheets'];
}
}
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/