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

Dizkus

Bottom
Block and module...
  • Posted: 10.07.2007, 00:29
     
    Jusuff
    rank:
    Helper Helper
    registered:
     April 2005
    Status:
    offline
    last visit:
    21.11.08
    Posts:
    163
    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
  • Posted: 10.07.2007, 00:53
     
    nestormateo
    rank:
    Professional Professional
    registered:
     September 2006
    Status:
    offline
    last visit:
    21.11.08
    Posts:
    1450
    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
  • Posted: 15.07.2007, 16:40
     
    Jusuff
    rank:
    Helper Helper
    registered:
     April 2005
    Status:
    offline
    last visit:
    21.11.08
    Posts:
    163
    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
  • Posted: 15.07.2007, 21:32
     
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    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

    --
    Photography | PHP | Other
  • Posted: 29.07.2007, 18:56
     
    Jusuff
    rank:
    Helper Helper
    registered:
     April 2005
    Status:
    offline
    last visit:
    21.11.08
    Posts:
    163
    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
  • Posted: 29.07.2007, 21:30
     
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    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.

    :)

    --
    Photography | PHP | Other

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula