Hello again!
Ok, so now I´m back at the office and have taken a look at exactly how I did to solve this for the event list. But the same steps would probably apply to the news list.
First make the proper folder structure for your new extension and create the necessary files
My_extension
-> config
-> config.php
-> dca
->tl_module.php
-> languages
->en
->sv
->modules.php
-> et cetra...
->templates
-> mod_eventlist_mylist.php
->ModuleEventlistMyList.php
The file ModuleEventlistMyList.php which is place directly under My_extension is a copy of the orignal ModuleEventlist
with these changes
Original:
Code:
class ModuleEventlist extends Events
{
/**
* Current date object
* @var integer
*/
protected $Date;
/**
* Template
* @var string
*/
protected $strTemplate = 'mod_eventlist';
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE')
{
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### EVENT LIST ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'typolight/main.php?do=modules&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
$this->cal_calendar = $this->sortOutProtected(deserialize($this->cal_calendar, true));
// Return if there are no calendars
if (!is_array($this->cal_calendar) || count($this->cal_calendar) < 1)
{
return '';
}
return parent::generate();
}
And here is the modified version:
Code:
class ModuleEventlistMyList extends Events
{
/**
* Current date object
* @var integer
*/
protected $Date;
/**
* Template
* @var string
*/
protected $strTemplate = 'mod_eventlist_mylist';
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE')
{
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### EVENT LIST MYLIST ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'typolight/main.php?do=modules&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
$this->cal_calendar = $this->sortOutProtected(deserialize($this->cal_calendar, true));
// Return if there are no calendars
if (!is_array($this->cal_calendar) || count($this->cal_calendar) < 1)
{
return '';
}
return parent::generate();
}
What I did was that I changed the name of the function, and the name of the template file and the backend wildcard.
The config.php registers the new frontend module and looks like this:
Code:
array_insert($GLOBALS['FE_MOD'], 2, array
(
'events' => array
(
'eventlistmylist' => 'ModuleEventlistMylist'
)
));
The tl_module.php adds the new eventlist to the DCA and looks like this:
Code:
$GLOBALS['TL_DCA']['tl_module']['palettes']['eventlistmylist'] = '{title_legend},name,headline,type;{config_legend},cal_calendar,cal_noSpan,cal_format,cal_order,cal_limit,perPage;{template_legend:hide},cal_template,imgSize;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
And the languages file looks like this:
Code:
$GLOBALS['TL_LANG']['FMD']['eventlistmylist'] = array('Min händelselista', 'Denna modul listar alla händelse för en månad, en vecka eller en dag.');
And the mod_eventlist_mylist.tpl is just a copy of the original mod_eventlist.tpl whith the changes I wanted.
Hope this claryfies how i did work my way around to have a custom list
/Mike
Bookmarks