One of the items on my todo list is to merge the domarkup and
templatemarkup functions for various reasons. 1) shorter code. 2) more
features. However I find myself a bit stumped.
This is the code I have working on my machine right now. All seems well...
function BOLTdomarkup($content, $page, $zone='', $rules='', $replace=true) {
global $MarkUpTable, $Token, $BOLTvar, $pageLink;
if ($page == '') $page = $pageLink;
$content = preg_replace('/\{\*\:([-_a-zA-Z0-9]+)\}/',
'{'.$page.'*:$1}', $content); // base pages
if ($replace == true) {
$content = preg_replace('/\{\+([-_a-zA-Z0-9]+)\}/',
'{'.$page.':$1}', $content); // template replacements
$content = preg_replace('/\{\+:?([-_a-zA-Z0-9\:]+)\}/',
'{'.$page.':$1}', $content);
}
$myMarkUpTable = $MarkUpTable;
foreach($myMarkUpTable as $i => $order) {
if ($rules != '' && strpos($rules, $i) === false) continue;
foreach ($order as $ii => $rule) {
$content = preg_replace($rule['pattern'],
$rule['replace'], $content);
}
}
$content = preg_replace('/\~\~([0-9]+)\~\~/e', '$Token[$1]', $content);
return BOLTstripslashes($content);
}
function BOLTtemplatemarkup($content, $page, $zone='', $rules='',
$replace=true) {
global $MarkUpTable, $Token, $BOLTvar, $pageLink;
if ($page == '') $page = $pageLink;
$content = preg_replace('/\{\*\:([-_a-zA-Z0-9]+)\}/',
'{'.$page.'*:$1}', $content); // base pages
if ($replace == true) {
$content = preg_replace('/\{\+([-_a-zA-Z0-9]+)\}/',
'{'.$page.':$1}', $content); // template replacements
$content = preg_replace('/\{\+:?([-_a-zA-Z0-9\:]+)\}/',
'{'.$page.':$1}', $content);
}
$myMarkUpTable = $MarkUpTable;
foreach($myMarkUpTable as $i => $order) {
if ($rules != '' && strpos($rules, $i) === false) continue;
foreach ($order as $ii => $rule) {
$content = preg_replace($rule['pattern'],
$rule['replace'], $content);
}
}
$content = preg_replace('/\~\~([0-9]+)\~\~/e', '$Token[$1]', $content);
return BOLTstripslashes($content);
}
/*
function BOLTtemplatemarkup($content, $page, $zone='', $rules='',
$replace=true) {
BOLTdomarkup($content, $page, $zone, $rules, $replace);
}
*/
As you can see the two functions are exact 100% duplicates. However,
when I uncomment the second template function and comment the one out
first instead, it fails to display properly. Maybe the solution will
come to me eventually, but I thought I'd ask if anyone sees whatever
it is I'm missing, or has a suggestion. It's quite peculiar...
Cheers,
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---