MyBB Community Forums

Full Version: Adding Item to Menu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
right now I try to add some items to the menu.
It works if I enable it, but it does not remove it, if I try to disable it:

Enable:
find_replace_templatesets("header", '#</ul>#', '<li><a href="{$mybb->settings[\'bburl\']}/mySite.php">mySite</a></li></ul>');

Disable:
find_replace_templatesets("header", "#<li><a href=\"\{\$mybb->settings[\'bburl\']}/mySite.php\">mySite</a></li>#", "", 0);

I tried it again and again, but I can not fix it.
Anyone who knows why?
Try this:
find_replace_templatesets("header", '#'.preg_quote('</ul>').'#', '<li><a href="{$mybb->settings[\'bburl\']}/mySite.php">mySite</a></li></ul>');
and
find_replace_templatesets("header", "#".preg_quote("<li><a href=\"\{\$mybb->settings[\'bburl\']}/mySite.php\">mySite</a></li>")."#", "", 0);


Some characters need to be escaped in regular expression and the preg_quote() function handles those.
Thanks, but that does not work for me, but I don't understand why. At least I use the same expression which I use above, but it won't work Sad
Sorry, my bad. Forgot to unescape the single quotes. Try this for the deactivation:
find_replace_templatesets("header", '#'.preg_quote('<li><a href="{$mybb->settings[\'bburl\']}/mySite.php">mySite</a></li>').'#', "", 0);