Making Headers and Footers

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

I want to use a generic header and footer for my site. I created a new section called Global. I want to created 2 items under Global one called HEader and one Footer. What is the best way to create these?

What would be the shortcuts on my pages to include the Header and Footer?

Re: [dccreatives] Making Headers and Footers

By Jason - April 19, 2010

Hi,

It sounds like Global is a Single Record Section. Is this correct.

If it is you can put this code up near the top of you page to retrieve the header and footer:

<?php
list($globalRecords,$globalMetaData)=getRecords(array(
'tableName' =>'global',
'limit' => 1,
'allowSearch' =>0,
));

$global = $globalRecords[0];
?>


You can then access Header and Footer anywhere below this using this code:

<?php echo $global['header']; ?>
or
<?php echo $global['footer']; ?>

You'll need to change the names to make them match your database.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Making Headers and Footers

ok, this is the result of what I did:

http://www.axislighting.com/CMS/brandsList.php

I added this code to the Head section:

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

require_once "/services/webpages/a/x/axislighting.com/public/cmsAdmin/lib/viewer_functions.php";

list($brandsRecords, $brandsMetaData) = getRecords(array(
'tableName' => 'brands',
));

list($globalRecords,$globalMetaData)=getRecords(array(
'tableName' =>'global',
'limit' => 1,
'allowSearch' =>0,
));

$global = $globalRecords[0];

?>

-----------------

Then after the body tag I added this code:<?php echo $global['header']; ?>

Then after the end of the page, I added this:<?php echo $global['footer']; ?>

-----------

In the admin, I added a new single record called Global.

I added text fields called header and footer.

I gave header the value header.php

and footer the value footer.php.

It is calling the value, not the pages.

I believe that the field should not be a text field, is that correct?

Thank You,

Re: [dccreatives] Making Headers and Footers

By Jason - April 19, 2010

If you have content in header.php and footer.php that you want to display on the page, you can try this:

<?php include("header.php"); ?>
and
<?php include("footer.php"); ?>

Since you probably won't be changing the names footer and header, you probably don't need to store these names in the global section.

Let me know if that works for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/