Updating CMS Builder Code
2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 25, 2008 (RSS)
By Perchpole - June 25, 2008
Hi, Dave -
I'm now working on my 4th CMS builder site. Unfortunately, I'm so happy with the way the system is playing that I've gone back to my second site and started to convert it (to take advantage of the new features found in v1.17). I'm afraid this was easier said than done! By updating all of the templates I have inadvertently broken some of the PHP code snippets I had put to good effect. For example, when I wanted to print the name of the SQL table on my page you suggested I should use...
This no-longer works!
In fact, after much trial and error, it now seems impossible to print any $record outside of the boundaries of the <?php foreach...> code block.
If I have a field called "category", for example, I would expect to be able to print this record anywhere on my page by inserting...
It doesn't seem to be that simple any more. The latest version of CMSB is much better than previous incarnations but also seems far stricter.
Any pointers?
[unsure]
Perch
I'm now working on my 4th CMS builder site. Unfortunately, I'm so happy with the way the system is playing that I've gone back to my second site and started to convert it (to take advantage of the new features found in v1.17). I'm afraid this was easier said than done! By updating all of the templates I have inadvertently broken some of the PHP code snippets I had put to good effect. For example, when I wanted to print the name of the SQL table on my page you suggested I should use...
<?php $schema = loadSchema($options['tableName']); print $schema['menuName']; ?>
This no-longer works!
In fact, after much trial and error, it now seems impossible to print any $record outside of the boundaries of the <?php foreach...> code block.
If I have a field called "category", for example, I would expect to be able to print this record anywhere on my page by inserting...
<?php echo $record['category'] ?>
or
<?php echo $tablenameRecord['category'] ?>
It doesn't seem to be that simple any more. The latest version of CMSB is much better than previous incarnations but also seems far stricter.
Any pointers?
[unsure]
Perch
Re: [Perchpole] Updating CMS Builder Code
By Dave - June 25, 2008
Hi Perch,
You don't need to update the old code unless needed. We don't. :) That's why we leave support for the old code in there still. We'll remove support for it eventually, but probably not for a long long time.
That said, you can get it working again pretty quick too. Just replace $options['tableName'] with the name of your table like this: loadSchema('news');
And for the record name, usually you only have a foreach loop if there are multiple records. And you need it in that case because you wouldn't know which record to display otherwise. But for single record pages you should still be able to display the placeholder wherever you like. You might just need to switch the name back.
If you want to attach a file you're working with I can take a look and let you know exactly what to change. Once I help you with one it will probably make sense for the others as well.
Hope that helps!
You don't need to update the old code unless needed. We don't. :) That's why we leave support for the old code in there still. We'll remove support for it eventually, but probably not for a long long time.
That said, you can get it working again pretty quick too. Just replace $options['tableName'] with the name of your table like this: loadSchema('news');
And for the record name, usually you only have a foreach loop if there are multiple records. And you need it in that case because you wouldn't know which record to display otherwise. But for single record pages you should still be able to display the placeholder wherever you like. You might just need to switch the name back.
If you want to attach a file you're working with I can take a look and let you know exactly what to change. Once I help you with one it will probably make sense for the others as well.
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com