Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Module specific template for EZComments
  • Posted: 11.07.2006, 02:15
     
    TTH_Erik
    rank:
    Freshman Freshman
    registered:
     July 2006
    Status:
    offline
    last visit:
    16.08.06
    Posts:
    11
    Hey.

    I'd like to write several EZComments templates and have them used in specific modules. I think it was possible to do this by creating templates with the same name as the module earlier (the early versions at lottasophie.sf.net). You could create /modules/EZComments/pntemplates/myModule.htm and it would be used inside myModule. This is not the case any more, right?

    I think it's a good idea and maybe something like the code below could be added to EZComments_user_view?

    Code

    if($pnRender->template_exists(pnVarPrepForOS(pnModGetName() . '/ezcomments_user_view.htm'))){
    $template = pnModGetName() . '/ezcomments_user_view.htm';
    }


    Let me know if there's already an easy way to do this sort of thing without specifying the template every time. I'm aware of the "template" param for the function, but I'd like to avoid using it.

    --
    Erik from www.TenTonHammer.com
  • Posted: 11.07.2006, 03:15
     
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    26.08.08
    Posts:
    7720
    pnRender supports this functionality by default - for all modules nothing to do with EZComments. From pnRender.class.php

    Code

    // Define the locations in which we will look for templates
            // (in this order)
            // Note: Paths 1, 3, 5 - This allows for the hook or block functions
            // (such as ratings and comments) to use different templates depending
            // on the top level module. e.g. the comments dialog can be different
            // for news  and polls...
            // They are only evaluated when the calling module is not the current one.
            //
            // 1. The top level module directory in the requested module folder
            // in the theme directory.
            $themehookpath = "themes/$theme/templates/modules/$module/$pnmodgetname";
            // 2. The module directory in the current theme.
            $themepath = "themes/$theme/templates/modules/$module";
            // 3. The top level module directory in the requested module folder
            // in the modules sub folder.
            $modhookpath = "modules/$modinfo[directory]/pntemplates/$pnmodgetname";
            // 4. The module directory in the modules sub folder.
            $modpath = "modules/$modinfo[directory]/pntemplates";
            // 5. The top level module directory in the requested module folder
            // in the system sub folder.
            $syshookpath = "system/$modinfo[directory]/pntemplates/$pnmodgetname";
            // 6. The module directory in the system sub folder.
            $syspath = "system/$modinfo[directory]/pntemplates";


    So for the EZComments template modules/EZComments/pntemplates/[template set]/ezcomments_user_view you can create a version that will be used for the module mymodule only by creating the file modules/EZComments/pntemplates/mymodule/[template set]/ezcomments_user_view.htm.

    However... i've never used this functionality.

    -Mark
  • Posted: 11.07.2006, 03:24
     
    TTH_Erik
    rank:
    Freshman Freshman
    registered:
     July 2006
    Status:
    offline
    last visit:
    16.08.06
    Posts:
    11
    A-ha!

    Thanks Mark, that's even better! :)

    --
    Erik from www.TenTonHammer.com

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula