Includes not always including CMSB code

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

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: [Dave] Includes not always including CMSB code

OK, this is where the problem is.

Whenever I load in a page that is not the first record in a section, the includes won't show up for certain sections.

I created a whole new news section and have a wrestler profile section, but only get to see certain things (on the right of the screen) if it is the first record.

You can see this in action by going to the following two URL's. These are exactly the same file, just calling in different info from the DB.

This one is the first record:

http://www.theewf.com/profile_wrestler.php?Captain-TNT-1

This one is another record, from the same category:

http://www.theewf.com/profile_wrestler.php?Aphrodite-2
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 - 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