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 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!

Dave Edis - Senior Developer
interactivetools.com