Quote:
Originally Posted by kh99
You also need to set the 'template' field to the compiled template, which you can get like this:
Code:
$template_un = "Some message";
require_once(DIR . '/includes/adminfunctions_template.php');
$template = compile_template($template_un);
|
Okay, so this should work:
Code:
require_once(DIR . '/includes/adminfunctions_template.php');
$template_un = 'message';
$template = compile_template($template_un);
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template_un='" . $template_un . "' WHERE title='ad_navbar_below'");
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template='" . $template ."' WHERE title='ad_navbar_below'");
?
Thanks
--------------- Added [DATE]1352945845[/DATE] at [TIME]1352945845[/TIME] ---------------
Actually, Scratch that.
I mean;
Code:
require_once(DIR . '/includes/adminfunctions_template.php');
$template_un = 'message';
$template = compile_template($template_un);
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template_un='" . $template_un . "' WHERE title='ad_navbar_below'");
? I tried it, but it doesn't update on the main page.
Still requires me to press the save and reload button in the styles manager.
--------------- Added [DATE]1352947788[/DATE] at [TIME]1352947788[/TIME] ---------------
Think I've found it.
print_rebuild_style
Let's see.. I'll test it out now.
--------------- Added [DATE]1352948337[/DATE] at [TIME]1352948337[/TIME] ---------------
Code:
require_once(DIR . '/includes/adminfunctions_template.php');
$template_un = 'message';
$template = compile_template($template_un);
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template_un='" . $template_un . "' WHERE title='ad_navbar_below'");
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template='" . $final_rendered ."' WHERE title='ad_navbar_below'");
print_rebuild_style(-1, '', 0, 0, 0, 0);
also doesn't work.
makes me have to press save and reload in template.php still..
ugh..
--------------- Added [DATE]1352950211[/DATE] at [TIME]1352950211[/TIME] ---------------
Well, I'm stumped.
I finished w/ this code and it doesnt work either. still requires manual save.
Code:
require_once(DIR . '/includes/adminfunctions_template.php');
$template_un = 'messgaaaage';
$template = compile_template($template_un);
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template_un='" . $template_un . "' WHERE title='ad_navbar_below'");
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template='" . $final_rendered . "' WHERE title='ad_navbar_below'");
$vbulletin->db->query_write("update" . TABLE_PREFIX . " template set dateline = " . TIMENOW . " WHERE title='ad_navbar_below'");
print_rebuild_style(-1, '', 0, 0, 0, 0);
--------------- Added [DATE]1352960530[/DATE] at [TIME]1352960530[/TIME] ---------------
...Got it!!
Just for future reference, this is how to do it:
Code:
require_once(DIR . '/includes/adminfunctions_template.php');
$template_un = "lol7";
$template = compile_template($template_un);
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template_un='" . $template_un . "' WHERE title='ad_navbar_below'");
$vbulletin->db->query_write("update " . TABLE_PREFIX . "template set template='" . addslashes($template) . "' WHERE title='ad_navbar_below'");
$vbulletin->db->query_write("update" . TABLE_PREFIX . " template set dateline = " . TIMENOW . " WHERE title='ad_navbar_below'");
print_rebuild_style(-1, 'ad_navbar_below', 0, 0, 0, 0);
build_style_datastore();