Reply to Count and Preg_Replace Using Version 4.4.1

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация