Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Just read (don't know how to say it short)

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
What i would like to do is to insert into summary.html a line which says
<!-- reactions -->
(before this line I would create my table)
then, when a person gives a reaction, i would like to insert that reaction in a table as a new row. So, I would like to insert <td>$name \n reaction</td>. But how do I determine that I have reached the line that says that and how do I insert my reaction after this line(the part which comes after that line may not be removed)

I hope you understand what I meen
 
I think I understand what you mean here. Into summary.html I assume you have a table that looks a bit like this:
[tt]
<table>
<tr><td>This is a reaction!</td></tr>
</table>
[/tt]
and when someone wants to submit a reaction it gets entered as a new row. Put the comment in here:
[tt]
<table>
<tr><td>This is a reaction!</td></tr>
<!--reactions-->
</table>
[/tt]

and a line like this in your perl script should put in their reaction into a new row:
[tt]
while <FILE> {
s/<\!--reactions-->/<tr><td>$reaction</td></tr>\/n<\!--reactions-->\/n/;
}
[/tt]
where <FILE> is the file handle associated with summary.html. Someone will almost certainly have to correct my perl there :)

Will.
fortytwo
will@hellacool.co.uk
 
Whoops! Forgot this was the PHP forum. You would want to use ereg_replace:
[tt]
$file = ereg_replace (&quot;<!--reactions-->&quot;,$reaction, $file);
[/tt]
where $file is a variable containing the text of summary.html

Will :)
fortytwo
will@hellacool.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top