making PageMain.php work...

Ok, what is the trick for making BxxxxPageMain to work?

I tried to create a module and I end up with a box inside a box...

in my module.php I have

        function actionHome () {
             
        if(!$this->_iProfileId){
         $this->_oTemplate->displayAccessDenied ();
          return;
        }
    
      
        $this->_oTemplate->pageStart();
        bx_import ('PageMain', $this->_aModule);
        $sClass = $this->_aModule['class_prefix'] . 'PageMain';
        $oPage = new $sClass ($this);


        echo $oPage->getCode();
   
        $this->_oTemplate->addCss ('main.css');
        $this->_oTemplate->addCss ('unit.css');
        $this->_oTemplate->addCss ('HTML5Games_select.css');
           
        $this->_oTemplate->pageCode(_t('_ss_HTML5Games_page_title_home'), false, false); 
        }      
   
in my PageMain.php I have

    function getBlockCode_ShowGames(){
    return MsgBox(_t('_ss_HTML5Games_no_games'));    
    }

Why do I get Games Block inside the HTML5 Games block?

The HTML5 Games block shouldn't even show up.

It's driving me nuts!

Thanks!

pagemain.png · 144.2K · 263 views
http://www.mytikibar.com
Quote · 11 Jul 2014

That code i nearly identical to what i use. It looks fine.

What does your template class look like? Any custom functions in it? Is the parent class BxDolTwigTemplate?

The only thing i can think of is that it's not using the proper getCode and pageCode functions.

https://www.deanbassett.com
Quote · 11 Jul 2014

Well I have another module, I just ripped the guts from it.  LOL  IDK what I did wrong!

http://www.mytikibar.com
Quote · 12 Jul 2014

Not totally sure, but I believe it has something to do with your using a template page in the actionHome section. Most of my custom modules use the default BxDolTwigModule pages, and my actionHome section is like this:

 

function actionHome ()
    {
        parent::_actionHome(_t('_cf_organizations_page_title_home'));
    }

 

For those that I needed to do something a lil different, I copied the default code from the BxDolTwigModule.php page in inc/classes. Like so:

 

function _actionHome ($sTitle)
    {
        $this->_oTemplate->pageStart();
        bx_import ('PageMain', $this->_aModule);
        $sClass = $this->_aModule['class_prefix'] . 'PageMain';
        $oPage = new $sClass ($this);
        echo $oPage->getCode();
        $this->_oTemplate->addCss (array('unit.css', 'main.css', 'twig.css'));
        $this->_oTemplate->pageCode($sTitle, false, false);
    }

 

So, I am guessing your problem is with this:

 

$this->_oTemplate->pageCode(_t('_ss_HTML5Games_page_title_home'), false, false); 

caredesign.net
Quote · 12 Jul 2014

 

 

So, I am guessing your problem is with this:

 

$this->_oTemplate->pageCode(_t('_ss_HTML5Games_page_title_home'), false, false); 

 
That is the reason i asked what the template class file looks like. As that function is part of the template class and depending on which parent class is defined in his template class may affect how the pageCode function works.

https://www.deanbassett.com
Quote · 12 Jul 2014

 You mean I may actually be on the right track? (lol - just kidding)

 

 

So, I am guessing your problem is with this:

 

$this->_oTemplate->pageCode(_t('_ss_HTML5Games_page_title_home'), false, false); 

 
That is the reason i asked what the template class file looks like. As that function is part of the template class and depending on which parent class is defined in his template class may affect how the pageCode function works.

 

caredesign.net
Quote · 12 Jul 2014

OR....

I could have been missing page_500.html from my template folder.  LOL!

Now it works!

Thanks for all the help.

http://www.mytikibar.com
Quote · 12 Jul 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.