Ajaxboy
Active member
I am trying to get a template from a stand alone file..
So far this is what I got..
I tried every combination to try to render it , but can't seen find a way to.
The template I am trying to get is "account_alerts_popup"
Last thing I tried was
But it has a problem with the $view object not being the correct one. This is tricky as you can't interact with the view object and controllers the same way you can from within, just wondering if there is a way?.
So far this is what I got..
I tried every combination to try to render it , but can't seen find a way to.
The template I am trying to get is "account_alerts_popup"
Last thing I tried was
PHP:
XenForo_ViewPublic_Helper_Alert::getTemplates($view, $alertResults['alerts'], $alertResults['alertHandlers']);
But it has a problem with the $view object not being the correct one. This is tricky as you can't interact with the view object and controllers the same way you can from within, just wondering if there is a way?.
PHP:
//Initializing XenForo
$startTime = microtime(true);
$xenforoRoot = str_replace("\\","/", (dirname(dirname(dirname(dirname(__FILE__))))));
$roorDir = $xenforoRoot;
// Setup XenForo's autoloader
require_once($xenforoRoot . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($xenforoRoot . '/library');
//die($xenforoRoot);
XenForo_Application::initialize($xenforoRoot . '/library', $roorDir);
XenForo_Application::set('page_start_time', $startTime);
// Not required if you are not using any of the preloaded data
$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();
//Start Session
XenForo_Session::startPublicSession();
[INDENT=1]$alertModel = XenForo_Model::create('XenForo_Model_Alert');[/INDENT]
$alertResults = $alertModel->getAlertsForUser(
$visitor['user_id'],
XenForo_Model_Alert::FETCH_MODE_POPUP
);
$alertsUnread = array();
$alertsRead = array();
foreach ($alertResults['alerts'] AS $alertId => $alert) {
if ($alert['unviewed']) {
$alertsUnread[$alertId] = $alert;
} else {
$alertsRead[$alertId] = $alert;
}
}