MyBB Community Forums

Full Version: find_replace_templatesets() problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I tried many ways and this function refused to change.
apparently it don't like spaces?


 find_replace_templatesets("forumbit_depth2_forum_lastpost", "#".preg_quote("<br />{\$lang->by} {\$lastpost_profilelink}</span>")."#i", "</span>", 0);




[edit]

I'm trying this way now.
find_replace_templatesets("forumbit_depth2_forum_lastpost", "#".preg_quote("<br />{\$lastpost_date} {\$lastpost_time}<br />{\$lang->by} {\$lastpost_profilelink}</span>")."#ism", "<br />{\$lang->by} {\$lastpost_profilelink}<br />{\$lastpost_date} {\$lastpost_time}</span>");


here is the template, Im trying to change last line in this template
<span class="smalltext">
<a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date} {$lastpost_time}<br />{$lang->by} {$lastpost_profilelink}</span>
Did you also try to use this?
find_replace_templatesets("forumbit_depth2_forum", "#".preg_quote("<br />{$lang->by} {$lastpost_profilelink}</span>")."#i", "</span>", 0);

I guess you also put this line before using find_replace_templatesets?
require_once MYBB_ROOT . '/inc/adminfunctions_templates.php';
Probably not, as that's the only way I've had it not work lol!

Let us know, and if you have we'll help you some more.

Hmm, also as another thought, should that be a 0? I don't remember offhand.
yes, I have tried that way.
it do not work at all.
I guess the only thing I can say is that your pattern must not match whats already in the template.
I'm trying to replace the whole last line now.
seem not working for some reason.
I did got it working now.

This code did it!

  find_replace_templatesets("forumbit_depth2_forum_lastpost", "#<br(.*?)</span>#ism", "<br />{\$lastpost_date} {\$lastpost_time}<br />{\$lang->by} {\$lastpost_profilelink}</span>", 0);