PHP Update Nodes

ScottLott

Member
Hey guys,
I'm trying to setup a PHP file that can update XenForo page nodes.

I found the database location of the node page templates (xf_template) but I can't just modify the mySQL table, it doesn't update the page.

It looks like another file is created in the "template_parsed" column of the database that holds a saved version of the template XenForo actually uses to render the page nodes.

This second column stuff isn't something I can make on the fly, so I'm wondering what can be done to modify Page Nodes from a PHP file?
 
Alright, I've gotten this far:

Code:
        $startTime = microtime(true);
        $fileDir =  "../../../community";

        require($fileDir . '/library/XenForo/Autoloader.php');
        XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');

        XenForo_Application::initialize($fileDir . '/library', $fileDir, true, array('resetOutputBuffering' => false));
        XenForo_Application::set('page_start_time', $startTime);

        $deps = new XenForo_Dependencies_Public();
        $deps->preLoadData();

        $writer = XenForo_DataWriter::create('XenForo_DataWriter_Template');
        $writer->setExistingData($templateId);
        $writer->set('template',$newTemplate);
        $writer->reparseTemplate();
        $writer->updateVersionId();
        $writer->save();

But it's not working and there are no error messages. (The templateID and template are passed into this section of the code from $_POST).

Once again, I'm trying to make changes to XenForo templates using a PHP file outside of XenForo.
 
Top Bottom