Default Viewer Record

6 posts by 3 authors in: Forums > CMS Builder
Last Post: June 2, 2010   (RSS)

By mark99 - May 27, 2010 - edited: May 27, 2010

I've created several detail (not list) viewer PHP files, each representing different categories.

Now I have one minor problem, everybody who gets to these detail pages comes from a list that uses manually constructed links, for example one list might send an individual product to.. Example_Detail.php?Cameras-5 (productname-record num). But if you try to view Example_Detail.php by itself then it will always display record number 1 and I'd rather the page just returned "no record" or something if that happens.

Now I can at least limit the records to be category specific by doing this at the top:

// 'where' => whereRecordNumberInUrl(1),
'where' => " category LIKE '%Consumer Cameras%' ",

But then it just display the first record associated with that category instead, by default.

Re: [mark99] Default Viewer Recorder

By mark99 - May 27, 2010

Just realised that using 'where' => " category LIKE '%Consumer Cameras%' ", on a detail viewer page doesn't work either as it will then ONLY display the first record for that category and not the others regardless of whats in the URL.

Re: [mark99] Default Viewer Record

By Dave - May 27, 2010

Hi mark99,

Try this:
'where' => whereRecordNumberInUrl(0),

The value in the brackets is what's used if no number is found in the url. So 0 means match nothing.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Default Viewer Record

By mark99 - May 29, 2010

That worked once but oddly it only displayed the "No record found!" message, no other content on the page was displayed.. just a blank page with that text. This is strange because the viewer file suggests that you should see "No record found!" at the bottom of all the pages existing content.

However, when I went to reload the page again it then started displaying standard browser error 404 (page not found) errors. The viewer would of course still work with a correct detail.php?TITLE-NUM call but now I'd just get 404's if you went to detail.php directly. Is that as intended? The 404's vanish, understandably, when you add '1' back into that line.

Re: [mark99] Default Viewer Record

By Jason - May 31, 2010

Hi Mark,

Could you provide a link to the page in question so I can see what's happening?

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/