content

16 posts by 3 authors in: Forums > CMS Builder
Last Post: April 26, 2010   (RSS)

By KCMedia - April 20, 2010

Hi

I have a page
http://www.actionmc.com.au/newsite/used-motorcycles.php?manufacturer=Honda

and you will see at the bottom there is a small history of the bike from honda.

I have setup a multi section called Motorcycle history and i want to only show up the history of the bike brand.

So if someone clicks on Honda they see Honda and if they click on the Yamaha then they see Yamaha on each page there is icon linked to each section based on the page actached to show bikes that the client has in stock

attached the code page.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

used-motorcycles_001.php 29K

Re: [kcmedia] content

By gkornbluth - April 20, 2010

Hi KCMedia,

Sorry I don't have a lot of time to get into this right now, but the first thought that I had (probably wrong) was to use an "if" statement that looks at the manufacturer to sort the history and logos.

Hope that sets you in a direction that helps.

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [kcmedia] content

By Jason - April 20, 2010

Hi,

How is the manufacturer stored in the motorcycle_history table? If it's stored as text (example: Honda) you can use this code:

list($motorcycle_historyRecords, $motorcycle_historyMetaData) = getRecords(array(
'tableName' => 'motorcycle_history',
'allowSearch'=>1,
'loadUploads' => '0',
'limit' => '1',
));


Give that a try and let me know how it works.
---------------------------------------------------
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] content

By KCMedia - April 20, 2010

Hi Jason

It is stored as a drop down and it is a relationship from another table

thanks
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] content

By Jason - April 20, 2010

Hi,

What is the name of the other table and what the are fields in it?

In the motorcycle history table, are you storing the number or the name of the manufacturer?

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: [kcmedia] content

By Jason - April 22, 2010

You could try this code to get your history record:

list($motorcycle_historyRecords, $motorcycle_historyMetaData) = getRecords(array(
'tableName' => 'motorcycle_history',
'where' => "manufacturer='".mysql_escape(@$_REQUEST['manufacturer']."'",
'loadUploads' => '0',
'limit' => '1',
));


This will use the manufacturer variable from the url to select the proper history record. In case there is no variable in the url, or there is no history record to that manufacturer, you'll probably want to use this code around where you output the history:

<?php if($motorcycle_historyRecord) : ?>
*OUTPUT MANUFACTURER HISTORY*
<?php endif ?>


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] content

By KCMedia - April 22, 2010

Hi Jason

this didnt work the page just wouldnt load with any data at all.

please find attached the page code.

I have changed the code back to the way it was so i can keep working on the site.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

used-motorcycles_002.php 30K

Re: [kcmedia] content

By Jason - April 23, 2010

Hi,

I've updated the code to retrieve a history record slightly. Give this a try:
list($motorcycle_historyRecords, $motorcycle_historyMetaData) = getRecords(array(
'tableName' => 'motorcycle_history',
'where' => "manufacturer='".mysql_escape(@$_REQUEST['manufacturer'])."'",
'allowSearch' =>0,
'loadUploads' => '0',
'limit' => '1',
));


This should work better. Let me know if you run into any more problems.
---------------------------------------------------
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] content

By KCMedia - April 23, 2010

Hi Jason

I am gettign this error now



MySQL Error: Unknown column 'manufacturer' in 'where clause'
Thanks



Craig

KC Media Solutions

www.kcmedia.biz