Strange Blog Results... Help^^

6 posts by 2 authors in: Forums > CMS Builder
Last Post: December 31, 2008   (RSS)

By avrom - December 25, 2008 - edited: December 25, 2008

Hi Dave, Merry X-Mas to you and your family :)) Since I'm snowed in today I'm working on a client site...

I'm having some strange problems with a blog.php page that displays an individual blog article. I really can't find the cause of this.

Here is the main site template, it is made up of several include files, each with their own viewers:
http://www.passionville.net/main.php


Here is an example where the blog display is working correctly:
http://www.passionville.net/blog.php?Brazil-s-Martini-s-Grill-1

If I click on any other of the blog links from the main template you can see the whole site template starts to fall apart:
http://www.passionville.net/blog.php?What-Is-Happening-In-Tibet-Now-4
http://www.passionville.net/blog.php?Beijing-Olympics---At-What-Costs-3

One page displays an error warning for the ads_250x80 file which is correct syntax but the other page doesnot. I n fact the content missing is specifically from 2 include files: bot_panel.php and left_panel.php

Sorry Dave but I will really need your help on this one ;))

Cheers
Avrom

Re: [Dave] Strange Blog Results... Help^^

By avrom - December 30, 2008

Yes Dave, that was exactly it...

Many Thanks :)))

Re: [virgodesign] Strange Blog Results... Help^^

By avrom - December 31, 2008

Hi Dave,

I'm having another issue, and I am wondering if its the same issue - even though I have removed the 'where' => whereRecordNumberInUrl(1),

Warning: Invalid argument supplied for foreach() in includes/ads_250x80.php on line 12

This error only happens if no ads are in the record (or all hidden). But if there are ads in that record it displays fine. Any ideas off the top of your head ??

Here is the code:

<?php
require_once "cms/lib/viewer_functions.php";
list($ads_380x200Records, $ads_380x200MetaData) = getRecords(array(
'tableName' => 'ads_380x200',
//'where' => whereRecordNumberInUrl(1),
'orderBy' => 'RAND()',
'limit' => '1',
));
$ads_380x200Record = @$ads_380x200Records[0]; // get first record
?>
<!--Ads 380x200 -->
<div id="ad_block" class="block2">
<?php foreach ($ads_380x200Record['ad_upload'] as $upload): ?>
<?php if ($upload['isImage']): ?>
<a href="<?php echo $ads_380x200Record['url'] ?>" target="_blank"><img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" title="<?php echo $ads_380x200Record['sponsor'] ?>" alt="<?php echo $ads_380x200Record['sponsor'] ?>" /></a>
<?php endif ?>
<?php endforeach ?>

<?php if (!$ads_380x200Record): ?>
<a href="advertise.php"><img src="images2/spacer.gif" width="380" height="200" /></a>
<?php endif ?>

</div>

Re: [virgodesign] Strange Blog Results... Help^^

By Dave - December 31, 2008

Hi Avrom,

You can put an "if" around the foreach so it doesn't run if there are no ads:

<?php if ($ads_380x200Record['ad_upload']): ?>
<?php foreach ($ads_380x200Record['ad_upload'] as $upload): ?>
...
<?php endforeach ?>
<?php endif ?>


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

Re: [Dave] Strange Blog Results... Help^^

By avrom - December 31, 2008

Thanks Dave, perect !!