Hi,
first, Im sorry if its in wrong category, but IDK where else should I put it.
I have a non Php-Fusion web where I need to use this function, so I edited my web and added this function (everything I found I think is needed for it) & now it have code like this (its easier for me to show you code than explain everything, cos mine english is bad):
core:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]$fusion_page_replacements = "";
$fusion_output_handlers = "";
$fusion_page_title = $settings['sitename'];
$fusion_page_meta = array("description" => $settings['description'], "keywords" => $settings['keywords']);
$fusion_page_head_tags = "";
$fusion_page_footer_tags = "";
function set_title($title=""
{
global $fusion_page_title;
$fusion_page_title = $title;
}
function add_to_title($addition=""
{
global $fusion_page_title;
$fusion_page_title .= $addition;
}
function set_meta($name, $content=""
{
global $fusion_page_meta;
$fusion_page_meta[$name] = $content;
}
function add_to_meta($name, $addition=""
{
global $fusion_page_meta;
if(isset($fusion_page_meta[$name])){
$fusion_page_meta[$name] .= $addition;
}
}
function add_to_head($tag=""
{
global $fusion_page_head_tags;
if(!stristr($fusion_page_head_tags, $tag)){
$fusion_page_head_tags .= $tag."\n";
}
}
function add_to_footer($tag=""
{
global $fusion_page_footer_tags;
if(!stristr($fusion_page_footer_tags, $tag)){
$fusion_page_footer_tags .= $tag."\n";
}
}
function replace_in_output($target, $replace, $modifiers=""
{
global $fusion_page_replacements;
$fusion_page_replacements .= "\$output = preg_replace('^$target^$modifiers', '$replace', \$output);";
}
function add_handler($name){
global $fusion_output_handlers;
if(!empty($name)){
$fusion_output_handlers .= "\$output = $name(\$output);";
}
}
function handle_output($output){
global $fusion_page_head_tags ,$fusion_page_footer_tags, $fusion_page_title, $fusion_page_meta, $fusion_page_replacements, $fusion_output_handlers, $settings;
if(!empty($fusion_page_footer_tags)){
$output = preg_replace("#</body>#", $fusion_page_footer_tags."</body>", $output, 1);
}
if(!empty($fusion_page_head_tags)){
$output = preg_replace("#</head>#", $fusion_page_head_tags."</head>", $output, 1);
}
if($fusion_page_title != $settings['sitename']){
$output = preg_replace("#<title>.*</title>#i", "<title>".$fusion_page_title."</title>", $output, 1);
}
if(!empty($fusion_page_meta)){
foreach($fusion_page_meta as $name => $content){
$output = preg_replace("#<meta (http-equiv|name)='$name' content='.*' />#i", "<meta \\1='".$name."' content='".$content."' />", $output, 1);
}
}
if(!empty($fusion_page_replacements)){
eval($fusion_page_replacements);
}
if(!empty($fusion_output_handlers)){
eval($fusion_output_handlers);
}
return $output;
}[/syntaxhighlighter]
Header:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false] if (function_exists("get_head_tags"
) { echo get_head_tags(); }
echo"</head><body>";
ob_start();[/syntaxhighlighter]
Footer (I had to coment out the first 2 lines, cos it totally deformed the main page with page_nav):
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]/*define("CONTENT", ob_get_contents());
ob_end_clean();*/
echo "
some content, blah blah...
</div>
</body>
</html>
";
$output = ob_get_contents();
if (ob_get_length() !== FALSE){
ob_end_clean();
}
echo handle_output($output);
if (ob_get_length() !== FALSE){
ob_end_flush();
}
mysql_close($db_connect);[/syntaxhighlighter]
When I add to page something like:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]add_to_head("<link rel='stylesheet' href='../core/styles.css' media='screen'>"
;[/syntaxhighlighter]
It just doesnt work. Does somebody know what am I missing or some mistake I did?
I need only add_to_head & add_to_footer function, nothing else.