In a nutshell, this lets you specify page titles by wrapping text in a custom tag while editing that page, e.g. -
Code: Select all
<wcms_title>Your page title</wcms_title>
Code: Select all
// regEx courtesy http://bit.ly/tTTdP
function getSpecialTags($string, $tags, $option) {
$pattern = "/<$tags ?.*>(.*)<\/$tags>/";
preg_match($pattern, $string, $matches);
if ($option == "withtags") {
return $matches[0];
}
if ($option == "withouttags") {
return $matches[1];
}
}
Code: Select all
$content[0] = @file_get_contents("files/$contentfile.txt");
Code: Select all
$page_title = getSpecialTags($content[0], "wcms_title", "withouttags");
$page_title_withtags = getSpecialTags($content[0], "wcms_title", "withtags");
$content[0] = str_replace($page_title_withtags, "", $content[0]);
$content[0] = trim($content[0]);
Code: Select all
function displayMainContent() {
global $cookie, $content, $page, $page_title_withtags;
if($_COOKIE[$cookie])
{
$content[0] = $page_title_withtags."\n\n\n".$content[0];
echo "<div class='title'><div id='change'><span id='$page' class='editText'>$content[0]</span></div></div>";
}
else { echo $content[0]; }
}
Code: Select all
$content = strip_tags($content, "<wcms_title><audio><embed><p>...
Code: Select all
echo "<title>$page_title</title>\n\n";
Code: Select all
<wcms_title>Unique page title comes here</wcms_title>
Enter your regular text content here...
P.S. i know, referencing line numbers would have made things simpler