• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

manipulate template

R

ragtek

Guest
#1
Anybody found a method, to change automatic the template?

For my own Board, i'm creating a copy of the template, manipulate it and use the manipulated template with overwriting the whole controller method.

For example:
PHP:
class Ragtek_DeveloperTools_ControllerAdmin_AddOn extends XFCP_Ragtek_DeveloperTools_ControllerAdmin_AddOn
{
    /**
     * overwrite the original index action, so i can use a other template because of the export link
     */
    public function actionIndex()
    {
            $addOnModel = $this->_getAddOnModel();
            $viewParams = array(
                    'addOns' => $addOnModel->getAllAddOns(),
                    'canAccessDevelopment' => $addOnModel->canAccessAddOnDevelopmentAreas()
            );
            return $this->responseView('XenForo_ViewAdmin_AddOn_List', 'addon_list_ragtek', $viewParams);
    }

    public function actionCreateZip()
as you see i'm using 'addon_list_ragtek'instead of addon_list

But IMHO that's a very ugly way for this.

A other way would be to try a str_replace of the output, but that's IMHO too much overhead and also very ugly.
Anybody know a better way?:)

That's why we need something like TMS. PLS PLS Kier;)
 

Jeremy

Well-known member
#3
If you edit the template and do this it should work:
PHP:
<?php

class myClass extends xenClass
{
	public function actionIndex()
    {
    	$addOnModel = $this->_getAddOnModel();
    	$xenView = parent::actionIndex();
    	$xenView->params['canAccessDevelopment'] = $addOnModel->canAccessAddOnDevelopmentAreas();
    	return $xenView;
    }
    // OR (depending on if they have subView
    public function actionIndex()
    {
    	$addOnModel = $this->_getAddOnModel();
    	$xenView = parent::actionIndex()
    	$xenView->subView->params['canAccessDevelopment'] = $addOnModel->canAccessAddOnDevelopmentAreas();
    	return $xenView;
    }
I'm not entirely sure of what you were attempting to add, but the idea is there.
 
R

ragtek

Guest
#4
Yes, i know that i can do this, but i can't add new elements (text, link, etc...) WITHOUT editing the template manual.
 
R

ragtek

Guest
#6
ThatÄs what i'm talking about: export.PNG

Is it possible to add this "link => "Zip erstellen" without editing the template manual, or overwritung the action and using a complete different template?