Blog Navigation Question and Question on Warning Error

8 posts by 3 authors in: Forums > CMS Builder
Last Post: January 17, 2012   (RSS)

By meg - January 13, 2012 - edited: January 17, 2012

I'm trying to convert a Wordpress Blog into a CMS Builder Blog, but I'm encountering a couple issues.

1. On the detail pages, the menu only shows that entry, not all the entries.

blogDetails.php

All entries on the main page: blog.php
(this is how I want the menu to display on the detail pages)

2. On the first detailed entry page, I have no warning errors. However, on the rest of the pages, I have warning errors where my php includes are located. Why is that the case?

Please advise. Thanks so much!!

Meghan

Re: [meg] Blog Navigation Question and Question on Warning Error

By Damon - January 13, 2012

Hi Meghan,

For the List Viewer Options that you are using to publish content for "Recent News" and the Footer content, can you add this option for both:

'allowSearch' => false,

I think what is happening is the left side content and footer are getting filtered by the article record number.

If you allowSearch is false, this should make everything work correctly.

Try that out and let me know if you have any questions.

Thanks!
Cheers,
Damon Edis - interactivetools.com

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

Re: [Damon] Blog Navigation Question and Question on Warning Error

By meg - January 13, 2012 - edited: January 17, 2012

Thanks for your input. I tried that with no luck, but maybe I'm inserting it wrong. Here's what I have as my php header:
<?
include_once("include/session_inc.php");?>
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
$libraryPath = 'cms/lib/viewer_functions.php';
$dirsToCheck = array('/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

list($headerRecords, $headerMetaData) = getRecords(array(
'tableName' => 'header',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => false,
));
$headerRecord = @$headerRecords[0];

list($portfolio_menuRecords, $portfolio_menuMetaData) = getRecords(array(
'tableName' => 'portfolio_menu',
'allowSearch' => false,
));

list($footerRecords, $footerMetaData) = getRecords(array(
'tableName' => 'footer',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => false,
));
$footerRecord = @$footerRecords[0];

list($promoRecords, $promoMetaData) = getRecords(array(
'tableName' => 'promo',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => false,
));
$promoRecord = @$promoRecords[0];

list($blog_entriesRecords, $blog_entriesMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'allowSearch' => false,
));

list($blog_entriesRecords, $blog_entriesMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => false,
));
$blog_entriesRecord = @$blog_entriesRecords[0];

?>


A sample include looks like this:
<?
include_once("include/footer-2011.php");?>


The sidebar menu looks like this:
<?php foreach ($blog_entriesRecords as $record): ?><li><a href="<?php echo $record['_link'] ?>" title="<?php echo $record['title'] ?>"><?php echo $record['title'] ?></a></li><?php endforeach ?>

Let me know what I should modify. Thank you!!

Re: [meg] Blog Navigation Question and Question on Warning Error

By Jason - January 16, 2012

Hi,

I think the problem you're running into is in this block of code:

list($blog_entriesRecords, $blog_entriesMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'allowSearch' => false,
));

list($blog_entriesRecords, $blog_entriesMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => false,
));
$blog_entriesRecord = @$blog_entriesRecords[0];


Because you use the same variable name twice ($blog_entriesRecords), you value is being overwritten by your second. This is why you are only getting one value in your list. What you can do is just re-name the variable something like this:

list($blog_entriesRecords, $blog_entriesMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'allowSearch' => false,
));

list($blog_listRecords, $blog_listMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => false,
));
$blog_entriesRecord = @$blog_entriesRecords[0];


You would then use $blog_listRecords in your foreach loop to output your blog list.

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] Blog Navigation Question and Question on Warning Error

By meg - January 16, 2012

Thanks for the tip! It was actually this that got it working...

list($blog_listRecords, $blog_listMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'allowSearch' => false,
));

list($blog_entriesRecords, $blog_entriesMetaData) = getRecords(array(
'tableName' => 'blog_entries',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => false,
));
$blog_entriesRecord = @$blog_entriesRecords[0];


With the menu:

<?php foreach ($blog_listRecords as $record): ?><li><a href="<?php echo $record['_link'] ?>" title="<?php echo $record['title'] ?>"><?php echo $record['title'] ?></a></li><?php endforeach ?>

Re: [Jason] Blog Navigation Question and Question on Warning Error

By meg - January 16, 2012

Now what could resolve the issues I'm experiencing with the warnings? Why does it not apply on the first entry, but does on all of the following?

Re: [meg] Blog Navigation Question and Question on Warning Error

By Jason - January 17, 2012

Hi,

My guess is that you get this error when trying to output your footer record. From your code, it looks like your footer record is a single record section. In the case of single record sections, you should remove your "where" clause. Since this section will only ever have 1 record, there is no need for a search.

Try removing it here:

list($footerRecords, $footerMetaData) = getRecords(array(
'tableName' => 'footer',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
'allowSearch' => false,
));
$footerRecord = @$footerRecords[0];


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/