New to CMS Builder - A Few Questions

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

Hi,

I had been using Listings Manager (LM) for an old website so I was very used to that program. However, I am now trying to do a similar website using CMS Builder. I really like CMS Builder and am starting to get the hang of it. It really is a great program. I have a few questions though...

1. This one should be an easy answer, so I will do it first. In the Section Editors area, I click 'modify' on the table I want to edit. Under the Viewer URLs tab there is a field called Filename Fields. I would like to use two fields there so my file name becomes a combination of the two fields. Is this possible? It looks like it should be possible. However, my results show that it only takes the first field.

2. I have a table for schools and a table for programs. Schools can have one or many programs. So I have a list field in the programs table that links to the schools table. I have done this by school name, not by record number. My experience with databases tells me to link by a unique value...like the schools record number. Should I be worried about this? It is much easier to link by the school name because it shows up in my programs table without using extra code. Just wondering.

3. Same tables as in question #2. I want to be able to have the schools '_link' value show up when I view the programs List Page. I think it needs some extra code for this. I also want to use another field from schools table and have it show up when I view the programs List Page. This is probably the same solution, but I want to do both.

Any help would be appreciated.

Re: [onlinemba] New to CMS Builder - A Few Questions

Please...not everyone all at once. [:(]

OK, I figured out #2 by reading some other posts in the forum. I also figured out the second part of #3. #1 is not longer relevant because I have a work-around.

So all I need to know is this part in #3...

"I want to be able to have the schools '_link' value show up when I view the programs List Page."

Any help would be welcomed.

Re: [onlinemba] New to CMS Builder - A Few Questions

By Chris - January 5, 2010

Hi onlinemba,

1. I'm afraid the first field value that isn't blank is used. You can, however, construct your own URLs using PHP if you're so inclined. You'd want to make sure to be consistent for SEO, however; instead of this:

<?php echo $record['_link'] ?>

try this:

<?php echo "/detailPage.php?" . preg_replace('/[^a-z0-9\.\-\_]+/i', '-', "{$record['field1']}-{$record['field2']}") . "-{$record['num']}" ?>

The important thing is the record number on the end. Please let me know if you want with this.

2. If you aren't planning on changing schools' names, it's much simpler to do things the way you're doing them.

3. You can look up a school by either its record number or its name. Add the following code near the top of your page (but after you've looked up the program):

list($schoolRecords,) = getRecords(array(
'tableName' => 'school',
'where' => "name = '" . mysql_escape($programRecord['school']) . "'",
'allowSearch' => 0
'limit' => 1,
));
$schoolRecord = @$schoolRecords[0]; // get first record

// show error message if no matching record is found
if (!$schoolRecord) {
print "Could not find school record for this program!";
exit;
}


Note that you'll need to change the code in red to reflect your own variable, section, and field names.

After this, you'll be able to access any of the fields in $schoolRecord.

I hope this helps! If you need any help with this, please post the full PHP source code for the page(s) you're working on and ask away! :)
All the best,
Chris