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

_replace_ templates?

Discussion in 'XenForo Development Discussions' started by dieketzer, Mar 24, 2011.

  1. dieketzer

    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.
     
  2. Jaxel

    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 likes this.
  3. dieketzer

    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'.
     

Share This Page