Results 1 to 2 of 2

Thread: Adding a custom module

  1. #1
    New user
    Join Date
    12-18-09.
    Posts
    24

    Default Adding a custom module

    i've added a new module named services to handle N-Level pages.
    The only problem i'm facing is on FE when i click on the Services page it should show a list of added services and clicking on one service should take to the services detail page.(redirected using jump to).
    Now clicking services at http://localhost/supercity/index.php/Services.html
    and detail at http://localhost/supercity/index.php/Se ... ail/4.html
    but i found that both these pages are using only one template mod_servicesreader.tpl (ModuleServicesReader.php)
    its not using mod_services.tpl (ModuleServices.php)
    i added a field in tl_module also as services_templates having values as mod_services and mod_servicesreader for modules defined for 2 pages

    in config.php i've added this code
    // Front end module
    array_insert($GLOBALS['FE_MOD'], 0, array
    (
    'services' => array
    (
    'services' => 'ModuleServices',
    'servicesreader' => 'ModuleServicesReader',
    'serviceslist' => 'ModuleServicesList'
    )
    ));


    Classes as following:
    class ModuleServices extends Module
    {
    protected $strTemplate = 'mod_services';

    private static $arrUrlCache = array();

    protected function compile()
    { ......


    class ModuleServicesReader extends ModuleServices
    {
    protected $strTemplate = 'mod_servicesreader';

    private static $arrUrlCache = array();

    protected function compile()
    {


    What wrong i'm doing, how its using mod_servicesreader as default??

  2. #2
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Adding a custom module

    I'm presuming its displaying your template by default as services reader. In your tl_module you've defined a default value, this is the value is in the BE. The Module code you use (ModuleServices, etc) is for the front-end and will only override the back-end, but you still have to go and get the actual template setting and then insert that into the template, and if not set, then use your default template. Check out the News App to see how leo does this in ModuleNewsReader....

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •