Insert generic code on every page
3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 3, 2010 (RSS)
By Toledoh - March 2, 2010 - edited: March 3, 2010
Hi Guys,
Is there a way in inserting blocks of code on every page?
For instance, I want to set up a multi-page editor called "snippets" which are going to be a whole bunch of bits and peices that will be displayed at various places aroun the site.
So the code to place at the start of the page is:
And then there are others that I use constantly through the site... categories, newlist, blog_comments etc.
Rather than placing each of these blocks of text on each page, and making changes to every page when something changes... can I add the following?
where insertSiteWideCode.php is;
I try, and get "Warning: session_start(): Cannot send session cache limiter - headers already sent..."
Is there a way in inserting blocks of code on every page?
For instance, I want to set up a multi-page editor called "snippets" which are going to be a whole bunch of bits and peices that will be displayed at various places aroun the site.
So the code to place at the start of the page is:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/cmsAdmin/lib/viewer_functions.php";
list($snippetsRecords, $snippetsMetaData) = getRecords(array(
'tableName' => 'snippets',
));
?>
And then there are others that I use constantly through the site... categories, newlist, blog_comments etc.
Rather than placing each of these blocks of text on each page, and making changes to every page when something changes... can I add the following?
<?php
include("_insertSiteWideCode.php");
?>
where insertSiteWideCode.php is;
<?php
require_once "/var/www/forrest.id.au/public_html/nutsDemo/lib/viewer_functions.php";
list($a_text_snippetsRecords, $a_text_snippetsMetaData) = getRecords(array(
'tableName' => 'a_text_snippets',
));
list($b_latest_newsRecords, $b_latest_newsMetaData) = getRecords(array(
'tableName' => 'b_latest_news',
'perPage' => '5',
));
list($c_galleryRecords, $c_galleryMetaData) = getRecords(array(
'tableName' => 'c_gallery',
'perPage' => '5',
));
?>
I try, and get "Warning: session_start(): Cannot send session cache limiter - headers already sent..."
Cheers,
Tim (toledoh.com.au)
Tim (toledoh.com.au)
Re: [Toledoh] Inser generic code on every page
By Chris - March 3, 2010
Hi Tim,
That warning is caused by any character (even a space or a newline) being output before viewer_functions are included.
Try changing this:
to this:
I hope this helps! Please let me know if you have any questions.
That warning is caused by any character (even a space or a newline) being output before viewer_functions are included.
Try changing this:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
...
to this:
<?php
header('Content-type: text/html; charset=utf-8');
...
I hope this helps! Please let me know if you have any questions.
All the best,
Chris
Chris
Re: [chris] Inser generic code on every page
By Toledoh - March 3, 2010
Excellent! Thanks for that.
Cheers,
Tim (toledoh.com.au)
Tim (toledoh.com.au)