How to replace multiline match in find_replace_templatesets() function?
find_replace_templatesets('member_profile', '#'.preg_quote('</table>
<table>').'#i', '</table><hr/><table>');
Doesn't work but:
find_replace_templatesets('member_profile', '#'.preg_quote('</table>').'#i', '</table><hr/>');
Replaces </table> as expected.
What should I do to get the first example to work?
Try something like this:
find_replace_templatesets('member_profile', '#'.preg_quote('</table>'."\n".'
<table>').'#i', '</table><hr/><table>');
Not sure if that'll work, but it's worth a go
Doesn't work. Tried it before.
I think there is no </table><table> in member_profile template, its either </table></td> OR
</table>
<br />
<table
NOTE the ending <table tag, there is no ending > which I've wrote so it could find code you are going to search/replace.
Also There is no <table> tag, it have a code some thing similar to this;
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
Dude, you're missing the point. It's just example.
(2011-06-30, 12:48 PM)Yaldaram Wrote: [ -> ]I think there is no </table><table> in member_profile template, its either </table></td> OR
</table>
<br />
<table
NOTE the ending <table tag, there is no ending > which I've wrote so it could find code you are going to search/replace.
Also There is no <table> tag, it have a code some thing similar to this;
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
You're exactly right Yaldaram, why didn't I think of that? @OP: It's typically best to use other static things such as variables which will always exist anyway - people could remove the tables by creating a table-less theme afterall.
(2011-06-30, 01:04 PM)marines Wrote: [ -> ]Dude, you're missing the point. It's just example.
OK, your find replace function is fine and it should replace the searched code.
So you don't know why it does not? Did you success replacing such a multiline code?
What's more it's not always possible to stick replacements to variables in templates.