Home | Add News | Edit News | Options | Help/About | Logout


Enable Hack Manually - PHP Enabled Templates v1.2

Installation notes:

This should add the ability to use PHP in your templates. Be carefull with this addon!

Add block in "./inc/options.mdu":

Automatically Generated, be sure to be very precise on tabs and spaces.

Add this:

// PHP Enabled Templates v1.2 - addblock
$$template = str_replace('$', '\\$', $$template);
// PHP Enabled Templates v1.2 - End addblock

Between:

$$template = stripslashes($$template);

And:

    }

Change block in "./inc/shows.inc.php":

Automatically Generated, be sure to be very precise on tabs and spaces.

Replace this:

			$output = str_replace("{title}", $news_arr[2], $template_full);

With:

// PHP Enabled Templates v1.2 - changeblock - Old
  // 			$output = str_replace("{title}", $news_arr[2], $template_full);
// PHP Enabled Templates v1.2 - changeblock - New
$output = $template_full;

if (!function_exists('phpTemplateEval')) {
	function phpTemplateEval($match) {
		ob_start();
		@eval($match[1]);
		return ob_get_clean();
	}
}
$output = preg_replace_callback('/<\\?php(.*?)\\?>/is', 'phpTemplateEval', $output);

$output = str_replace("{title}", $news_arr[2], $output);
// PHP Enabled Templates v1.2 - End changeblock

Change block in "./inc/shows.inc.php":

Automatically Generated, be sure to be very precise on tabs and spaces.

Replace this:

                    	$output = str_replace("{author}", "<a $url_target href=\"$mail_or_url".stripslashes($comment_arr[2])."\">".stripslashes($comment_arr[1])."</a>", $template_comment);
                    }
					else{ $output = str_replace("{author}", $comment_arr[1], $template_comment); }

With:

// PHP Enabled Templates v1.2 - changeblock - Old
  //                     	$output = str_replace("{author}", "<a $url_target href=\"$mail_or_url".stripslashes($comment_arr[2])."\">".stripslashes($comment_arr[1])."</a>", $template_comment);
  //                     }
  // 					else{ $output = str_replace("{author}", $comment_arr[1], $template_comment); }
// PHP Enabled Templates v1.2 - changeblock - New
						$output = str_replace("{author}", "<a $url_target href=\"$mail_or_url".stripslashes($comment_arr[2])."\">".stripslashes($comment_arr[1])."</a>", $output);
					} else {
						$output = str_replace("{author}", $comment_arr[1], $output);
					}
// PHP Enabled Templates v1.2 - End changeblock

Add block in "./inc/shows.inc.php":

Automatically Generated, be sure to be very precise on tabs and spaces.

Add this:

// PHP Enabled Templates v1.2 - addblock
$output = $template_comment;

if (!function_exists('phpTemplateEval')) {
	function phpTemplateEval($match) {
		ob_start();
		@eval($match[1]);
		return ob_get_clean();
	}
}
$output = preg_replace_callback('/<\\?php(.*?)\\?>/is', 'phpTemplateEval', $output);
// PHP Enabled Templates v1.2 - End addblock

Between:

$comment_arr[4] = stripslashes(rtrim($comment_arr[4]));

And:

					if($comment_arr[2] != "none"){

Add block in "./inc/shows.inc.php":

Automatically Generated, be sure to be very precise on tabs and spaces.

Add this:

// PHP Enabled Templates v1.2 - addblock
if (!function_exists('phpTemplateEval')) {
	function phpTemplateEval($match) {
		ob_start();
		@eval($match[1]);
		return ob_get_clean();
	}
}
$template_form = preg_replace_callback('/<\\?php(.*?)\\?>/is', 'phpTemplateEval', $template_form);
// PHP Enabled Templates v1.2 - End addblock

Between:

$template_form = str_replace("{config_http_script_dir}", "$config_http_script_dir", $template_form);

And:

    $smilies_form = "\n<script type=\"text/javascript\">

Add block in "./inc/shows.inc.php":

Automatically Generated, be sure to be very precise on tabs and spaces.

Add this:

// PHP Enabled Templates v1.2 - addblock
if (!function_exists('phpTemplateEval')) {
	function phpTemplateEval($match) {
		ob_start();
		eval($match[1]);
		return ob_get_clean();
	}
}
$output = preg_replace_callback('/<\\?php(.*?)\\?>/is', 'phpTemplateEval', $output);
// PHP Enabled Templates v1.2 - End addblock

Between:

$output = $template_active;

And:

        $output = str_replace("{title}", $news_arr[2], $output);

Add block in "./inc/shows.inc.php":

Automatically Generated, be sure to be very precise on tabs and spaces.

Add this:

// PHP Enabled Templates v1.2 - addblock
if (!function_exists('phpTemplateEval')) {
	function phpTemplateEval($match) {
		ob_start();
		@eval($match[1]);
		return ob_get_clean();
	}
}
$prev_next_msg = preg_replace_callback('/<\\?php(.*?)\\?>/is', 'phpTemplateEval', $prev_next_msg);
// PHP Enabled Templates v1.2 - End addblock

Between:

$prev_next_msg = $template_prev_next;

And:

    //----------------------------------

End installation notes:

You can now use PHP in all of your templates. You should use it as usual PHP code in php documents, like
<?php
...
?>
You may not use short php tags (<? ... ?>), they won't work.

Powered by CuteNews v1.3.1 © 2003 CutePHP.