mrbiesheuvel
01-03-2012, 09:35 PM
If written code in an external file witch loads at init startup. I use the code for plugins. It loads an external html or php file and then splits the head and body from that file. The body is used in a plugin to any kind of template that and the head is added to the headinclude template {vb:raw head_include}. By doing so I can load every external file (php or html) into a template and create widgets to place them on the screen. Because the head of the external (html/php)file is written to the head include i can also load the css and javascript from the external file.
So this works fine with plugins -> template -> widget
function load_file_for_plugin ($pathToFile) {
global $custom_header;
$content = get_file_content($pathToFile);
$head = get_head_section($content);
$custom_header .= $head;
preregister("headinclude","head_include",$custom_header);
return get_body_section($content);
}
Now ihave tried to create a (cms-)php page in the cms wich loads a html file into the page and also writes the head of the html file to {vb:raw head_include} template. The code of the php page looks like this:
$output= load_file_for_plugin ($_SERVER['DOCUMENT_ROOT']."/custom/static_html/voorpagina.html");
Now the body of the external html file loads perfectly into the (cms-)php page, but the head isn't written to {vb:raw head_include}
Is there any way to write a variable from a (cms-)php page to a template using vb:raw?
So this works fine with plugins -> template -> widget
function load_file_for_plugin ($pathToFile) {
global $custom_header;
$content = get_file_content($pathToFile);
$head = get_head_section($content);
$custom_header .= $head;
preregister("headinclude","head_include",$custom_header);
return get_body_section($content);
}
Now ihave tried to create a (cms-)php page in the cms wich loads a html file into the page and also writes the head of the html file to {vb:raw head_include} template. The code of the php page looks like this:
$output= load_file_for_plugin ($_SERVER['DOCUMENT_ROOT']."/custom/static_html/voorpagina.html");
Now the body of the external html file loads perfectly into the (cms-)php page, but the head isn't written to {vb:raw head_include}
Is there any way to write a variable from a (cms-)php page to a template using vb:raw?