Displaying single record

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 22, 2010   (RSS)

Hi there!

I am having a serious problem with show details of a single record from a category I have set up...

So here it is:
Main category: HOME PAGE
Sub Categories: Welcome , Featured Video

How can I display just a single record? Let's say I would like to display just the "featured video". I have managed to display them (Welcome and Featured Video) at random but for some reason when i try to add the "Where" clause, it all goes bazookas! :-S

HEEELP!

Re: [mrmzalewski] Displaying single record

By Jason - October 22, 2010

Hi,

If you could attach the code from the .php file you're working with, I can take a closer look. If you could also provide a link to that page where it does AND doesn't work, that would be helpful.

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: [mrmzalewski] Displaying single record

By Jason - October 22, 2010

Hi,

I see your using whereRecordNumberInUrl(1). If you're not actually putting a record number in the url, you'll actually be returning the first record in your section. Chances are, you don't want to use this at all. What you need is a way to uniquely identify the record you want to display. If you always want to display the same record on this page, you could use the record number to get it.

In this example, let's assume the record number is 2, you would use this code:

// load records
list($home_pageRecords, $home_pageMetaData) = getRecords(array(
'tableName' => 'home_page',
'where' => "num=2",
'limit' => '1',
));
$home_pageRecord = @$home_pageRecords[0]; // get first record


In practice, just replace the number "2" with whichever record number you want to display.

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] Displaying single record

excellent! you are a life saviour! works great, thanks! now please help with my Image upload problem, ahahah! :-)



thanks
m