Posted by "Shaun" on 12/03/05 12:12
Hi,
The following code matches all occurences of <p> tags within an html page
and wraps form tags around it:
echo preg_replace(
'/<p[^>]*>(.*?)<\/p>/ms',
'<form name="form" target="_parent"
action="'.$CFG->edit_pages_adm.'/index.php?action=edit_paragraph"
method="post">
<input type="hidden" name="text" value="$1">
<p><a href="javascript:;" onclick="document.form.submit();">$1</a></p>
</form>',
file_get_contents($CFG->frontenddir_editable.'/'.$file) );
Unfortunately if there is more than one match the form won't submit because
the forms have the same name. Does anyone know how can I modify this so that
each occurence is numbered sequentially i.e.
form'.$count.'...
As I am using version 4.4.1 I don't have access to the count paramter in
version 5.1.
Thanks for your advice
[Back to original message]
|