Includes not always including CMSB code

7 posts by 2 authors in: Forums > CMS Builder
Last Post: January 2, 2009   (RSS)

I'm creating a site and am using the php include command to call in various aspects of the page, just the basic one:

<?php include("header.php"); ?>

When on the index page, it works fine, calls it in perfectly, but soon as I click on a news item, it doesn't show up. However, if I just rename the file, keeping its location, it shows up fine.

Then I thought that it might have been caused by the way news is shown up, for example:

http://www.theewf.com/newsdetail.php?A-New-Year---A-New-Site-4

It wasn't that, as I typed in just the index file, followed by ?vhdhkgjd (just rubbish), but it showed up fine.

What drives me crazier, is that there are 4 includes, 2 of them show up and two don't. The actual latest news include is one that does show up.

One thing that I did notice, is that where I call an image file using:

http://www.theewf.com/images/venue/<?php echo $datesRecord['next_venue'] ?>.gif">

It shows the image on the home page, but when looking at what is called up on the news page, it says that it was looking for a file called .gif.

You can see what I mean here:

http://www.theewf.com/index4.php

I could really do with some help, as this is supposed to be online tomorrow [shocked]

Thanks,

Joe
High quality residential training for writers, actors &amp; Film Making - Click Here for further information

Re: [Moonworks] Includes not always including CMSB code

By Dave - December 30, 2008

Hi Joe,

My first guess would be that you have some viewer code in your header and includes and they are seeing the record number in the url and trying to load a different record. See this works:
http://www.theewf.com/newsdetail.php?1

But not this:
http://www.theewf.com/newsdetail.php?2

For all the viewers that you want to load just one record (the same record every time) remove the "where" line and it should ignore the number. Try that and let me know if it works for you.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Includes not always including CMSB code

Hi Dave,

Changing the number to 1 worked great, thanks for that.

The news will be changing. I start off with news.php, which is an include file and that shows the following:

<?php

require_once "/home/uyvluaez/public_html/theewf.com/lib/viewer_functions.php";

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

?>

<p align="center"><font size="2">
<font color="#FFFFFF">
<?php foreach ($newsRecords as $record): ?></font><font face="Arial"><font color="#FFFFFF"> <?php echo date("D, M jS, Y", strtotime($record['date'])) ?><br/>
<!-- For date formatting codes see: http://www.php.net/date -->
by <?php echo $record['contributor_name'] ?></font><p align="left">
&nbsp;<P></P><b><font color="#FFFFFF"><?php echo $record['title'] ?></font></b><p align="center">
&nbsp;<p align="justify"><font color="#FFFFFF"><?php echo $record['quick_summary'] ?></font><p align="center">
<font color="#FFFFFF"><br/>
&nbsp;</font><a href="http://www.theewf.com/<?php echo $record['_link'] ?>"><font color="#FFFFFF"><img border="0" src="http://www.theewf.com/images/readmore.gif" width="94" height="41"></font></a></font><font color="#FFFFFF"><br/>

&nbsp;</font><hr/>
<p align="center">
<?php endforeach; ?>&nbsp;

<?php if (!$newsRecords): ?>
<i><font face="Arial">Must be a slow week, no news!</font></i><br/><br/>
<hr>
<?php endif ?>


After this, is the newsdetail.php file, which shows the following:

<?php

require_once "/home/uyvluaez/public_html/theewf.com/lib/viewer_functions.php";

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$newsRecord = @$newsRecords[0]; // get first record

?>


Plus the extra stuff for the page.

I have tried tasking the where out of that last one, but it doesn't change the link. Where isn't anywhere to be seen on the news.php file, the one that is called into the page.

So the only confused part for me now, is where to make it not say -4

Thanks,

Joe
High quality residential training for writers, actors &amp; Film Making - Click Here for further information

Re: [Moonworks] Includes not always including CMSB code

By Dave - December 31, 2008

Hi Joe,

So are all the includes showing up now?

You need the 4 on the end of the url to tell it which record to display on the detail page.

Let me know what issues remain and I'll try and help you with them.
Dave Edis - Senior Developer
interactivetools.com

Re: [Moonworks] Includes not always including CMSB code

By Dave - January 2, 2009

Hi Joe,

And what's the viewer code being used by "Next Live Event" include which appears broken on the url ending in 2?

Does it include a line like this:
'where' => whereRecordNumberInUrl(1),

If so try removing that.

If none of that helps feel free to email CMS and FTP login details to dave@interactivetools.com and I can take a look. (Email, don't post login details to the forum).

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Includes not always including CMSB code

Thanks Dave

I'm sure I tried that the first time you said about it, but obviously not, as it works fine now [blush]

Thanks for the help - and the patience!

Joe
High quality residential training for writers, actors &amp; Film Making - Click Here for further information