MyBB Community Forums

Full Version: Problem with replacing in template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I have one small problem. I want to insert the variable $navi_header into the header template:
...
<hr class="hidden" />
<div id="panel">
$welcomeblock
</div>
</div>
<hr class="hidden" />
[color=blue]<br class="clear" />[/color]
<div id="content">
$bannedwarning
$bbclosedwarning
$unreadreports
<navigation>
[color=blue]<br class="clear" />[/color]
[color=red]$navi_header[/color]
So I want to replace
<navigation>
<br class="clear" />
with
<navigation>
<br class="clear" />
$navi_header
When I only search for "<br class="clear" />" in the replacement procedure it's working but it's at the wrong line because "<br class="clear" />" exists 2 times. But when I search for
<navigation>
<br class="clear" />
it's not working...

Do you have a clue how to get around that?
do you use preg_replace or str_replace? or do you use the find_replace_templatesets function?
In preg_replace and find_replace_templatesets, you need to add a # in front of the find term, and #s at the end of the find term. (s is for multiline). However, using find_replace_templatesets may cause some problems. the function doesn't really work with multiple lines. I don't know why. The code seems to be ok.
Thanks a lot, it's working now. Big Grin