_replace_ templates?

dieketzer

Well-known member
is it possible to release template modifications as addons?
ideally, i would like to simply replace an existing template with new template code. it seems it would be pretty simple and straightforward, but i have yet to find an example of somebody doing something like this.
 

Jaxel

Well-known member
I do it in my XenPorta modification... However, I do not replace any base templates, only existing XenPorta block templates. I do not recommend doing what you are trying to do, because in order to do this, you pretty much have to update the MASTER template... which is something you should never do, because you are essentially releasing a mod that changes core functionality of XenForo at that point.

Code:
        $className = 'EWRporta_Block_'.$file->module_name;
        $dw3 = XenForo_DataWriter::create('XenForo_DataWriter_Template');
        if ($template = $this->getModelFromCache('XenForo_Model_Template')->getTemplateInStyleByTitle($className))
        {
            $dw3->setExistingData($template);
        }
        $dw3->bulkSet(array(
            'title' => $className,
            'template' => $file->module_template,
            'style_id' => '0',
        ));
        $dw3->save();
 

dieketzer

Well-known member
yeah, the master style isnt something i would want to alter. users being unable to revert their template could turn into a nightmare.
thanks for the infos jaxel

xf need a way to share template mods other than 'styles'.
 
Top