Help needed to add content from multiple sections on one page

20 posts by 8 authors in: Forums > CMS Builder
Last Post: August 12, 2010   (RSS)

By aharrow - August 6, 2008

I was very impressed with you Realty Manager and decided to give your CMS a try. However i need some help in adding content from multiple sections on one page.

Example on my home page i would like a News Article listing (which i have already done using:

<?php

require_once "/control/lib/viewer_functions.php";

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'perPage' => '1',
)); ?>

to combine with other sections for instance summary aticles or a summary of the about us.

<?php

require_once "/control/lib/viewer_functions.php";

list($aboutRecords, $aboutMetaData) = getRecords(array(
'tableName' => 'about',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$aboutRecord = @$aboutRecords[0]; // get first record
?>

Can you explain how i can get this accomplished and keep in mind i would like to add more than 2 sections.

Thank you and keep up the good work

Re: [aharrow] Help needed to add content from multiple sections on one page

By Dave - August 6, 2008

Hi aharrow,

Is it working right now? And do you need to sections to interact with each other at all? You should be able to just have both blocks of code at the top of the page like you have it. You can however remove some duplicate code and reduce it to this if you like:

<?php

require_once "/control/lib/viewer_functions.php";

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'perPage' => '1',
));

list($aboutRecords, $aboutMetaData) = getRecords(array(
'tableName' => 'about',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$aboutRecord = @$aboutRecords[0]; // get first record

?>

And then display $newsRecords and $aboutRecord where ever you want on the page.

Let me know if that will work for you or if you need something else.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Help needed to add content from multiple sections on one page

By aharrow - August 6, 2008

Hi Dave this is exactly what i need and it works, however the News Section is a listing and when i select NEXT the About Us generates and error.

Have a look at a demo site: http://www.greenparrothotel.com/opsr/index.php

The only parts the are active are the News and About Us Sections on the home page.

This is the error msg generated on the About Us Section: "Warning: Invalid argument supplied for foreach() in D:\hshome\greenparrot\greenparrothotel.com\opsr\index.php on line 255"

Re: [aharrow] Help needed to add content from multiple sections on one page

By Dave - August 6, 2008 - edited: August 6, 2008

Hi aharrow,

Ahh, I see. Try removing this line from the about code:
'where' => whereRecordNumberInUrl(1),

And then adding this line:
allowSearch => false,

Then it will always just load the first record, and ignore any search terms if the url (if you add those later). So your code will look like this:

list($aboutRecords, $aboutMetaData) = getRecords(array(
'tableName' => 'about',
'allowSearch' => false,
'limit' => '1',
));

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Help needed to add content from multiple sections on one page

By aharrow - August 6, 2008

Hi Dave,

Works like a charm, but for anyone else who needed this the last suggestion from dave was missing the quote:

'allowSearch' => false, and not allowSearch => false,

Thank you very much for your assistance.

Re: [aharrow] Help needed to add content from multiple sections on one page

By Dave - August 6, 2008

Thanks, I'll update my post above. Glad it's working now!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Help needed to add content from multiple sections on one page

By HDLLC - August 28, 2008

Hi there-

I'm trying to do something very similar - but ran into a problem on one particular instance - hoping maybe someone here can point me in the right direction.

I want the description of the location of a property to show everywhere it is listed for SEO. But this snippet from the top of the page makes things odd where used:

http://www.fretwellland.com/missouri-illinois-hunting-land-for-sale.php?01-MO-1010-24

Notice that the headline of: Northeast Missouri Hunting Land for sale in Shelby County, Missouri

I want that to show in my pages that have the listings view or search results:
http://www.fretwellland.com/listings-missouri-illinois-hunting-land-for-sale.php?state=IL

But, when I use the step 1 code at the top of the page, it will insert the information - but it's the same info in every instance.

Here's what I am placing:
<?php
require_once "/Library/WebServer/WebSites/fretwellland/public_html/cmsAdmin/lib/viewer_functions.php";

list($propertiesRecords, $propertiesMetaData) = getRecords(array(
'tableName' => 'properties',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$propertiesRecord = @$propertiesRecords[0]; // get first record

?>


and within the pages I am using this to describe the property:

<?php echo $propertiesRecord['geographic_location'] ?> <?php echo $propertiesRecord['state_long'] ?> <?php echo $propertiesRecord['type_of_property'] ?> for sale in <?php echo $propertiesRecord['county'] ?> County, <?php echo $propertiesRecord['state_long'] ?>.

Any help is greatly appreciated!

Thanks in advance!

--Jeff

Re: [HDLLC] Help needed to add content from multiple sections on one page

By Dave - August 28, 2008

Hi Jeff,

Just so I'm clear - do you want that description in the url?

So instead of:
http://www.fretwellland.com/missouri-illinois-hunting-land-for-sale.php?01-MO-1010-24

You'd have:
http://www.fretwellland.com/missouri-illinois-hunting-land-for-sale.php?Northeast-Missouri-Hunting-Land-for-sale-in-Shelby-County-Missouri-24

Is that right? Or is there something else you're trying to do?

Let me know and I'll help you with it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Help needed to add content from multiple sections on one page

By HDLLC - August 28, 2008

Hi Dave-

Thanks for the quick response!

Not exactly...

I want to use that code, or inclusion of the information that describes a property.

I just want to put it in the page - but I keep throwing errors or it wants to put the same info (state, county, etc.)

But - when I get it to work using that code I posted - I get the same property type, state, county, etc. - in each instance (all 25 listings on the page).

So, I'm close - just not all the way there...

Make sense?

--Jeff