how to insert page content from one page into another

4 posts by 3 authors in: Forums > CMS Builder
Last Post: March 23, 2011   (RSS)

By csdesign - March 21, 2011

I really have looked for this... I could swear I've done it before and it's totally simple, but maybe it's just Monday because I can't quite get it to fly.

Every page on the site has a sidebar. I have created a multi record sidebar and it's working on the testpage.

This is the testpage:
http://www.nwsc5872139.myutilitydomain.com/boxList.php

I would like to be able to pull that page into the sidebar of all other pages.

I've added this to both the boxList page and the news.php page - and it pulls the info if I repeat all the fields, but I was hoping to just "get" the page (boxList.php) instead.

// load records
list($boxRecords, $boxMetaData) = getRecords(array(
'tableName' => 'box',
'limit' => '3',
'orderBy' => 'RAND()',
));


I know this is the part I'm messing up: (in the news.php page - sidebar)

<?php foreach ($boxRecords as $record): ?>
<?php echo $record['list'] ?>
<?php endforeach ?>

<?php if (!$boxRecords): ?>
No records were found!<br/><br/>
<?php endif ?>

both boxList.php & new.php are attached. Thanks so much for your help!!
Attachments:

boxlist.php 4K

news_003.php 6K

Re: [csdesign] how to insert page content from one page into another

By Toledoh - March 21, 2011

Have you tried <?php include("boxList.php");?> ?
Cheers,

Tim (toledoh.com.au)

Re: [csdesign] how to insert page content from one page into another

By robin - March 22, 2011

Hi csdesign,

I agree with Toledoh. You should just be able to use
<?php include "boxList.php"; ?>
instead of repeating the load records code for boxRecords in news.php.

Hope it works out for you,
Robin
Robin
Programmer
interactivetools.com