Block not showing problem

Ankhaa
2008-12-03
2013-04-25
  • Ankhaa
    Ankhaa
    2008-12-03

    Hi, everybody!
    I'm new in XoopsCube, i trying to build block in my module using [http://xoopscube.wiki.sourceforge.net/Legacy_Module_Development_Block_First]  tutorial, but my block is not showing :( i would be very appreciate if someone even read my post.

    my xoops_version.php
    looks:

    <?php
    $modversion['name'] = 'MyModule';
    $modversion['dirname'] = basename(dirname(__FILE__));

    $modversion['hasMain'] = 1;

    $modversion['templates'][0]['file'] = 'mymod_index.html';

    $modversion['hasAdmin'] = 1;

    $modversion['sub'][0]['name'] = '2page';
    $modversion['sub'][0]['url'] = 'index.php?page=1';

    $modversion['blocks'][0]['name'] = 'Myblock';
    $modversion['blocks'][0]['file'] = 'myblock.php';
    $modversion['blocks'][0]['class'] = 'myblock';
    $modversion['blocks'][0]['template'] = 'myblocktemp.html';
    $modversion['blocks'][0]['func_num'] = 1;
    $modversion['blocks'][0]['visible'] = '1';
    $modversion['blocks'][0]['description'] = '';
    $modversion['blocks'][0]['show_func'] = '';

    ?>

    my xoops/modules/mymod/blocks/myblock.php
    looks:

    <?php
    class myblock extends Legacy_BlockProcedure
    {
        function myblock(&$block)
        {
            parent::Legacy_BlockProcedure($block);
        }
       
        function execute()
        {
            $render =& $this->getRenderTarget();
            $render->setTemplateName($this->_mBlock->get('template'));
            $render->setAttribute('blockdata', 'myblock');
           
            $root =& XCube_Root::getSingleton();
            $renderSystem =& $root->getRenderSystem($this->getRenderSystemName());
            $renderSystem->renderBlock($render);
        }

    }
    ?>

    xoops/modules/mymod/templates/blocks/myblocktemp.html 
    looks:

    <h1><{$blockdata}></h1>

    that's all, is there any mistake?
    thanks for reading.

     
    • Ankhaa
      Ankhaa
      2008-12-03

      By the way i'm running Xoopscube on Japanese language, is there any need to define name of the block in modinfo.php of languages?

       
    • mumin
      mumin
      2008-12-04

      Hi, ankhaa.
      Legacy module search and create '{Dirname}_{class}' instance.
      Maybe change block class name from 'myblock' to 'Mymod_myblock'.

      see : /modules/legacy/class/Legacy_Utils.class.php L99-140

       
    • Ankhaa
      Ankhaa
      2008-12-04

      Thanks Mumin very much, that's solved my problem :)
      When i changed class name to Mymod_myblock it displayed well.
      Thanks again.

      BTW one more begiiner question:
      Where can i set configuration to allow php scripts in a xoopscube template? (my module uses smarty template)