Fork me on GitHub

Block and module...  Bottom

  • I've wrote a block using this guide: http://community.postnuke.com/Wiki-WritingABlock.htm
    Block is written for PN 764

    This block allows to build tree-like menu and is not connected with any module...
    Because method described in above-mentioned guide requires a module with which block is associated temporary I've wrote this block as Admin module's block.

    And my questions is: is this a good choice? Probably the better choice would be the Block module... but in pn764 its impossible (Block module have hardcoded block dir includes/blocks/). Or maybe there is another way to write a block in this way?
    Will be appreciate for any suggestions.


    --
    Polish Zikula Team
    Bianor Works - my Zikula works on CoZi
  • Hi Jusuff!
    You have to know that the guide is for PN 0.8, there the blocks usually belongs to a module.

    If you're writing a 0.764, i recomment you to take the code of an 0.764 existing block, may be includes/blocks/mainmenu.php and modify the info, permissions and all that you need.

    If you want a templated module, you must build this into one module, may be Admin, and put yours templates (admin_blocks_*.htm) in there, and again, reading the code of an existing block will, may help you a lot.

    Good luck!

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Thanks for your reply.
    I think the Admin module would be a good "parent" for my block :)

    --
    Polish Zikula Team
    Bianor Works - my Zikula works on CoZi
  • Best case scenario: don't upload the block file into the core! :) Every little change you make to the core files/directories is something that you must keep diligent track of when you upgrade the site. Even a seemingly simple item to remember can easily be forgotten.

    If you do feel compelled to upload any blocks into the core, however, consider placing them into the ../system/Blocks/pnblocks/.. directory, where the other stand-alone blocks reside. This decision would observe 2 golden rules:

    1) keep like things together, and
    2) don't re-invent the wheel.

    :)

    Another approach, while it might seem a bit much, is to create a module for your block based on the 'blank' module, and including your block file there instead. (The block can then be installed/uninstalled and the 'module' name can be reflective of the block, even.) Doing it this way allows you to use the block, while at the same time removing the need to alter the PostNuke core.

    Just a few ideas...

    ;)

    - John



    edited by: alarconcepts, Jul 15, 2007 - 11:34 AM
  • alarconcepts: thanks for suggestion.
    Separated module for a block looks like best solution.
    Admittedly I already wrote for pn764 block as the element of the module Admin, however in the pn8 case I would have to modify core - and definitely I wouldn't like it.
    So its time to consider wise advice :)




    edited by: Jusuff, Jul 29, 2007 - 02:57 PM

    --
    Polish Zikula Team
    Bianor Works - my Zikula works on CoZi
  • No problem ... it so happens that I faced the exact same question at one time and issues only became apparent at upgrade time or shortly thereafter when some of my content was missing or broken.

    Glad to help.

    :)
  • 0 users

This list is based on users active over the last 60 minutes.