View Issue Details

IDProjectCategoryView StatusLast Update
0003411OXID eShop (all versions)4.07. Source code, Testpublic2012-12-10 13:44
Reporterwanis 
PriorityurgentSeveritytweakReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version4.5.10 revision 44222 
Summary0003411: Use oxView::getTemplateName() getter in oxView::render()
Descriptionright now, if you write module or extend by other class function getTemplateName it is usefull only for /views/alist.php and /views/info.php .

After this change, you could change template path by extending oxView::getTemplateName()
Additional Informationexample of usage:
we could write new parent view class for module which will add prefix where templates should be placed:

class moduleview extends oxAdminView
{
    public function getTemplateName()
    {
        return 'moduledir/' . $this->_sThisTemplate;
    }
}
----------------------------------------
after this we can write simple controller only for displaying template:

class sampleview extends moduleview
{
    protected $_sThisTemplate ='sampleview.tpl';
}

----------------------------------------
and this will make test pass:

class unit_admin_sampleviewTest extends OxidTestCase
{
    public function testRender()
    {
        $oView = $this->getProxyClass('sampleview');
        $this->assertEquals( 'moduledir/sampleview.tpl', $oView->render() );
    }
}



---------------------------------
now you can easily change module template dir or even module name without changing each module view controller
 
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Versionany
MySQL Versionany

Activities

There are no notes attached to this issue.