how to copy a block of codes?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

how to copy a block of codes?

Post by hongco »

hi,

I would like to copy a block of code that is between these two lines of a template file:

<!-- BEGIN eblogs_list -->
...
<!-- BEGIN eblogs_list -->

i'd like to copy anything between the two lines above and save them into another array? how would you do that?
<td class=bluetext2 align=left valign=top bgcolor=#EBF8FB>
<span class=bluetext3>

<!-- BEGIN eblogs_list -->
{title} <br>
posted: {date} <br>
by: {username} <br>
{content}<br>
views: {views} | replies {comments}
<!-- END eblogs_list -->

</span>
<br>
</td>
<td width=16 bgcolor=#EBF8FB></td>
thank you :D
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post by method_man »

i dont get it
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

make the lines of html a php string and send them through a get variable if you want to send them to another file?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

regular expression.
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

Code: Select all

define ('OPENING_TAG', '<!-- BEGIN eblogs_list -->');
define ('CLOSING_TAG', '<!-- END eblogs_list -->');

preg_match_all('/'.OPENING_TAG.'(.*)'.CLOSING_TAG.'/msiU', $input, $matches,PREG_SET_ORDER);
Post Reply