Generating Meta Information USing CMSB

7 posts by 3 authors in: Forums > CMS Builder
Last Post: January 29, 2010   (RSS)

By (Deleted User) - January 28, 2010

I am having trouble understanding how to use CMSB to add meta information to a page.

Using CMSB to add Meta information to a "Single Editor" page seems straightforward. Simply add fields for Title, Meta Keword, and Meta Description to each editor and then call them using the method specified in other threads like this:

http://www.interactivetools.com/iforum/gforum.cgi?post=66012;search_string=meta%20tags;t=search_engine#66012

However, how do you do it for pages whose content is generated by a "Multi Record Editor." Can I make a reference database within CMSB and then pull that data somehow?

Re: [cohagan] Generating Meta Information USing CMSB

Hi Cohagan,

The approach that I've used in the past to keep all of my site wide"Common Information" in one place is to create a single record editor called "common_information" with various meta information and other common information fields required throughout my site. Then I insert these fields in all of my single record and multi-record viewers as required.

At the top of my page I call the required tables like this:

<?php

require_once "/my_path_to/cmsAdmin/lib/viewer_functions.php";


list($tmy_multi_record_tableRecords, $tmy_multi_record_tableMetaData) = getRecords(array(
'tableName' => 'my_multi_record_table',
));

list($common_informationRecords, $common_informationMetaData) = getRecords(array(
'tableName' => 'common_information',

'limit' => '1',
));
$common_informationRecord = @$common_informationRecords[0]; // get first record


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


Then I insert the appropriate meta information in the head of specific pages like this:

<META NAME="KeyWords" CONTENT="<?PHP echo $common_informationRecord['my_specific_page_meta_keywords']; ?>">

Hope that helps,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Generating Meta Information USing CMSB

By (Deleted User) - January 28, 2010

Hi Cohagan,

The approach that I've used in the past to keep all of my site wide"Common Information" in one place is to create a single record editor called "common_information" with various meta information and other common information fields required throughout my site.


Why a single record editor? Couldn't I use a multi record, each record named the same name as the page it was going to be used on? If I want to vary each pages meta data and title, with a single record editor don't I end up with a very long page of fields rather than a multi record editor which would give me a small manageable record with x fields for each page?

Re: [cohagan] Generating Meta Information USing CMSB

Hi Cohagan,

I think that you could on the detail pages, but on the list page you'd have to decide which record to pull your meta information from, and call only that record to display the meta tags.

Someone may have a more elegant solution, but that's my understanding.

Best,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Generating Meta Information USing CMSB

By (Deleted User) - January 28, 2010

Nope I just don't grok why it is less straightforward.

UI wise...every page has a discrete record associated with it which is intuitively linked to its name instead of one long list. For larger sites I could see the single editor solution becoming quickly cumbersome.

Is it just more difficult code wise to pull the information from the DB? I guess I need more understanding of how DB's are queried.

Thank you for the solution using single record.

Re: [gkornbluth] Generating Meta Information USing CMSB

By Chris - January 29, 2010

Hi cohagen,

Why a single record editor? Couldn't I use a multi record, each record named the same name as the page it was going to be used on? If I want to vary each pages meta data and title, with a single record editor don't I end up with a very long page of fields rather than a multi record editor which would give me a small manageable record with x fields for each page?


We're currently exploring ways to make this really easy for people. In the meantime, the approach I've found simplest is to use a separate Single Record section for each list viewer page, having fields like "content_blurb" and "page_title". If this would mean too many sections, you could try a Multi Record approach, certaintly. You'd simply need to add some code to the top of your viewers to load in the appropriate record. Something like this, perhaps:

list($page_meta_dataRecords, ) = getRecords(array(
'tableName' => 'page_meta_data',
'allowSearch' => false,
'where' => "page = 'example.php'"
));
$page_meta_dataRecord = $page_meta_dataRecords[0];


I hope this helps. Please let me know if you have any questions.
All the best,
Chris