MyBB Community Forums
Help with template_ - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Help with template_ (/thread-22981.html)



Help with template_ - Ryan Gordon - 2006-03-11

find_replace_templatesets("private_read", '#\$lang->delete_pm</a>(\r?)(\n?)#', "\$lang->delete_pm</a>\n| <a href=\"pmreport.php\?pmid=\$pm\[pmid\]&amp;action=report\" onClick=\"popupWin('pmreport.php\?pmid=\$pm\[pmid\]&amp;action=report', 'reportPm', 400, 300); return false;\">Report</a>\n");

find_replace_templatesets("private_read", '#| <a href="pmreport.php\?pmid=\$pm\[pmid\]&amp;action=report" onClick="popupWin(\'pmreport.php\?pmid=\$pm\[pmid\]&amp;action=report\', \'reportPm\', 400, 300); return false;">Report</a>(\r?)(\n?)#', "", 0);


Those dont seem to work Sad Am I doing something wrong?


RE: Help with template_ - decswxaqz - 2006-03-11

Which part is it not doing?

find_replace_templatesets("private_read", "#\$lang->delete_pm</a>(\r|\n)*#", "\$lang->delete_pm</a>\n| <a href=\"pmreport.php\?pmid=\$pm\[pmid\]&amp;action=report\" onclick=\"popupWin('pmreport.php\?pmid=\$pm\[pmid\]&amp;action=report', 'reportPm', 400, 300); return false;\">Report</a>\n");

And I would also store them as strings. It makes life easier if you need to change one of them. Only do the below once you know the above works.
$find = "\$lang->delete_pm</a>(\r|\n)*";
$replace = "\$lang->delete_pm</a>\n| <a href=\"pmreport.php\?pmid=\$pm\[pmid\]&amp;action=report\" onclick=\"popupWin('pmreport.php\?pmid=\$pm\[pmid\]&amp;action=report', 'reportPm', 400, 300); return false;\">Report</a>\n";

find_replace_templatesets("private_read", '#'.preg_quote($find).'#', $find."\n".$replace);
....
find_replace_templatesets("private_read", '#'.preg_quote($replace).'#', "", 0);



RE: Help with template_ - Ryan Gordon - 2006-03-11

none works