php include not working on multi-listing page
3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 16, 2009 (RSS)
This question is going to best be exemplified by looking at addresses.
I have a multi-record module to list calendar events (http://174.143.92.42/waxahachiechamber.com/calendar/default.php). On the lower left of that page is also a single record module laid in as a php include (for Upcoming Events), which works extremely well, except for this one caveat.
On the first detail listing in the calendar, the Upcoming Events include shows up correctly. however, on every subsequent listing the Upcoming Event include will not show up (I WAS getting the dreaded 'No Record Found' error until I commented it out in the include file), now it just shows up as empty.
The code on my include file is:
So it's very simple. Is the error in the 'where' operator? Or is it the 'limit'?
This is the first I've used a module as an include file, but it's solving a lot of issues so I'd like to continue. Any suggestions?
I have a multi-record module to list calendar events (http://174.143.92.42/waxahachiechamber.com/calendar/default.php). On the lower left of that page is also a single record module laid in as a php include (for Upcoming Events), which works extremely well, except for this one caveat.
On the first detail listing in the calendar, the Upcoming Events include shows up correctly. however, on every subsequent listing the Upcoming Event include will not show up (I WAS getting the dreaded 'No Record Found' error until I commented it out in the include file), now it just shows up as empty.
The code on my include file is:
<?php
require_once "C:/inetpub/wwwroot/waxahachiechamber.com/emediacms/lib/viewer_functions.php";
list($upcoming_eventsRecords, $upcoming_eventsMetaData) = getRecords(array(
'tableName' => 'upcoming_events',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$upcoming_eventsRecord = @$upcoming_eventsRecords[0]; // get first record
// show error message if no matching record is found
// if (!$upcoming_eventsRecord) {
// print "Record not found!";
// exit;
// }
?>
.....
<td class="events"><h3 align="center"><?php echo $upcoming_eventsRecord['title'] ?></h3>
<span align="justify"><?php echo $upcoming_eventsRecord['content'] ?></span></td>
So it's very simple. Is the error in the 'where' operator? Or is it the 'limit'?
This is the first I've used a module as an include file, but it's solving a lot of issues so I'd like to continue. Any suggestions?
Re: [misery217] php include not working on multi-listing page
By Luke - November 13, 2009
Hi misery217,
Thank you for your post.
Try removing this line:
'where' => whereRecordNumberInUrl(1),
The only URL that has "1" in it is:
http://174.143.92.42/waxahachiechamber.com/calendar/defaultDetail.php?New-Site-Opening-1
So this is why your Upcoming Events are only displayed on the above event.
Your other events have "3" and "4" in the URL.
Also, I noticed when clicking on an event the URL was doubling up in the browser's address bar. I'm not sure what's causing this but you might want to take a closer look at the source code for your hyperlinks to remove the duplication.
Cheers,
Luke
Thank you for your post.
Try removing this line:
'where' => whereRecordNumberInUrl(1),
The only URL that has "1" in it is:
http://174.143.92.42/waxahachiechamber.com/calendar/defaultDetail.php?New-Site-Opening-1
So this is why your Upcoming Events are only displayed on the above event.
Your other events have "3" and "4" in the URL.
Also, I noticed when clicking on an event the URL was doubling up in the browser's address bar. I'm not sure what's causing this but you might want to take a closer look at the source code for your hyperlinks to remove the duplication.
Cheers,
Luke
Luke Holzken
Product Development
Product Development
Re: [Luke] php include not working on multi-listing page
Thanks Luke, That worked.
I did look at the source code for the Email link and it is showing:
My Viewer URL's are set to http://174.143.92.42/waxahachiechamber.com/calendar/defaultDetail.php which is clunky, but this is mainly because the site is not in full production yet and this way is easier to set up the CMS database.
I did look at the source code for the Email link and it is showing:
<a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email this Page</a>
My Viewer URL's are set to http://174.143.92.42/waxahachiechamber.com/calendar/defaultDetail.php which is clunky, but this is mainly because the site is not in full production yet and this way is easier to set up the CMS database.