Multi record sections: Get record # from end of url. eg: viewer.php?record_title-3
4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 9, 2015 (RSS)
By Twocans - March 8, 2015
Hello,
I am having a play with the "Code Generator" for the first time,
I am used to dreamweaver etc over the years but having heard about the "Code Generator" thought I would give it a go.
Admin > Code Generator > Detail Page
First off, I have a go at
Custom: Load record #
I enter the value of 10 as I know I have a record for that. I use the Code Generator, I have a look at this code and change
'tableName' => 'designer_details',
'where' => "`num` = '10'",
to
'tableName' => 'designer_details',
'where' => "designer_name` = '10'",
this all works fine as designer name is my foreign key.
then I thought huumm exciting I would have a play with the other option......
"Multi record sections: Get record # from end of url. eg: viewer.php?record_title-3"
I use the Code Generator and select option Multi record sections:,
I past this code into a page called viewer.php
I view this page viewer.php and am greeted with "Record not found!" when I view the webpage.
Then I try viewer.php?record_title-10 but having tested again in my browser I am still been greeted with "Record not found!"
I know I have a record in the database,
I have had a look at the manual and in the CMSB Cookbook but could not find more detail on this.
I would be grateful if you advise me please as to how to view this correctly.
regards
Kenny
By Dave - March 8, 2015
Hi Kenny,
Try creating a pair of viewers like this in the code generator:
- Code Generator > List Page > (just use default options) > save as recommended filename, eg: yoursection-list.php
- Code Generator > Detail Page > Select "Multi Record Section" > save as recommended filename, eg: yoursection-detail.php
- Note the instructions on the last page will tell you to update "viewer urls", which can be found under: Admin > Section Editors > Your Section > Viewer Urls (tab)
- Add the full url for "List Page Url" and "Detail Page Url".
How it works is the "list" viewer shows a list of all the records. And the detail page shows information on a specific record.
For an example of this take a look at our showcase. Here's a list viewer page:
https://www.interactivetools.com/showcase/index.php
And here's a detail viewer page that it links to:
https://www.interactivetools.com/showcase/detail.php?Confluence-179
There's lots of other interesting things you can do, including making search engines really quickly ( http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html ) but that's the basics.
Hope that helps, let me know any questions.
interactivetools.com
By Twocans - March 9, 2015
thanks dave,
This is what I have always known as a master detail. aka what you call the list page we call it the master page.
at the end of the day what I was trying to do with the code generator is create joins or join 4 tables together, I had my primary key of the parent table was akin to the foreign keys for the other tables. All in all I will just just hand coding in dreamweaver,
regards
kenny
By Dave - March 9, 2015
Hi Kenny,
Yea, for multi-table joins and things like that you'll still need to code things by hand (that's what we do), but for simpler sections (news releases, blog posts, etc) the code generator can save a lot of time. Also it will load "labels" from related tables. But ,as I say, for more complex joins you're going to need to do that by hand still.
Cheers!
interactivetools.com