New to CMS Builder - A Few Questions

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

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

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

Chris,

The code you provided worked perfectly. That should do me for now.

Thanks for your help. [:)]