- Posts: 9
- Thank you received: 0
Show past events in module or menu
- pmkdk
- Topic Author
- Offline
- New Member
Less
More
14 years 3 months ago #4713
by pmkdk
Show past events in module or menu was created by pmkdk
Hello
The module only shows FUTURE events.
Is it possible to list past events also?
Thanks
The module only shows FUTURE events.
Is it possible to list past events also?
Thanks
Please Log in or Create an account to join the conversation.
- pmkdk
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
14 years 3 months ago - 14 years 3 months ago #4732
by pmkdk
Replied by pmkdk on topic Re: Show past events in module or menu
Thanks to the great coding in the module, it was actually easy for us to spot what to do , in order to show past events aswell.
Following is the code from mod_eb_events.php from the module folder.
Please notice that this module has additional features, such as showing events based on specified categories.
If y ou want to edit your standard module to show past events, then spot the changes in the "event_date" part, in order to do the changes.
Following is the code from mod_eb_events.php from the module folder.
Please notice that this module has additional features, such as showing events based on specified categories.
If y ou want to edit your standard module to show past events, then spot the changes in the "event_date" part, in order to do the changes.
Code:
<?php
defined('_JEXEC') or die ('Restricted access');
require_once JPATH_ROOT.DS.'components'.DS.'com_eventbooking'.DS.'helper'.DS.'helper.php';
$db = & JFactory::getDBO();
$numberEvents = $params->get('number_events', 6);
$categoryId = $params->get('category_id', '');
$where = array() ;
$where[] = ' a.published = 1 ';
$where[] = ' event_date < NOW() ' ; //very important line
$where[] = '(cut_off_date = "'.$db->getNullDate().'" OR cut_off_date >= NOW())' ;
if ($categoryId) {
$where[] = ' a.id IN (SELECT event_id FROM #__eb_category_events WHERE category_id IN('.$categoryId.'))' ;
}
$where = implode(' AND ', $where) ;
$sql = 'SELECT a.id, a.title, a.event_date, a.category_id FROM #__eb_events AS a WHERE '.$where.' ORDER BY event_date DESC LIMIT '.$numberEvents;
$db->setQuery($sql) ;
$rows = $db->loadObjectList();
for ($i = 0 , $n = count($rows) ; $i < $n; $i++) {
$row = $rows[$i] ;
//Get the first category id and name which this event assigned to
$sql = 'SELECT a.name FROM #__eb_categories AS a INNER JOIN #__eb_category_events AS b ON a.id = b.category_id WHERE b.event_id='.$row->id.' LIMIT 1 ';
$db->setQuery($sql) ;
$rowCategory = $db->loadObject();
if ($rowCategory) {
$row->category_name = $rowCategory->name ;
}
}
$config = EventBookingHelper::getConfig() ;
$document = & JFactory::getDocument() ;
$css = JURI::base().'modules/mod_eb_p_events/css/style.css' ;
$document->addStyleSheet($css);
$itemId = EventBookingHelper::getItemid() ;
require(JModuleHelper::getLayoutPath('mod_eb_p_events', 'default'));
?>
Last edit: 14 years 3 months ago by pmkdk.
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.