Page Elements section

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

By Thomas - April 9, 2010

Hi,

I am trying to set up a 'Page Elements' section that will include things like header, footer, menus, etc. so I have set up a single record editor with a field for each item.

I would now like to include these in my other pages that have the content so at the top of the page I have included (in addition to the page content code):

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

require_once "/lib/viewer_functions.php";

list($page_elementsRecords, $page_elementsMetaData) = getRecords(array(
'tableName' => 'page_elements',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$page_elementsRecord = @$page_elementsRecords[0]; // get first record

// show error message if no matching record is found
if (!$page_elementsRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>


Then calling the element with :

<?php echo $page_elementsRecord['header'] ?><br/>

This is all working great, but only on the first page.
As soon as I go to the next page I get 'Record not found!' I guess because there is no page 2 of the page elements.

Is there a way I can call the same page elements on all pages?