This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

need help with adding html code to script

Old posts that have not been replied to for several years.
Locked
B
Bytez
Op
Posts: 168
Joined: Mon Aug 11, 2003 1:42 pm

need help with adding html code to script

Post by Bytez »

Hi, I'm using the script called pxi2h that makes a html file of the irc channel and puts it on a specified directory of your choice. I want to add a couple of lines to the script itself, I don't know what the syntax of the script itself.

I want to add the following html codes:

Code: Select all

<META HTTP-EQUIV="REFRESH" CONTENT="10;URL=#bottom">
at the top

and

Code: Select all

<p id=bottom>
at the bottom to the following code within the TCL script:

Code: Select all

  set html [open $pxi2h_chan($chan) w]
  puts $html "<HTML>\n<HEAD>\n <TITLE>$pxi2h(title)</TITLE>\n <META HTTP-EQUIV=\"Refresh\" CONTENT=\"$pxi2h(refresh)\">\n</HEAD>"
  puts $html "<BODY TEXT=\"$pxi2h(text)\" BGCOLOR=\"$pxi2h(bgcolor)\" LINK=\"$pxi2h(heading)\" VLINK=\"$pxi2h(heading)\">"
  puts $html " <FONT COLOR=\"$pxi2h(heading)\"><FONT SIZE=\"+1\" FACE=\"sans-serif\">$chan</FONT> <FONT SIZE=\"-1\" FACE=\"monospace\">\[[lindex [getchanmode $chan] 0]\]: '[pxi2h:html [topic $chan]]'</FONT></FONT><P>"
  puts $html " <FONT SIZE=\"-1\" FACE=\"$pxi2h(font)\">"
  puts $html "  <B>Server.</B>: [string range $server 0 [expr [string last ":" $server] - 1]]<BR>"
  puts $html "  <B>Users..</B>: [pxi2h:unconvert $nicks]<BR>\n  <HR SIZE=\"1\">"
  close $html
  set html [open $pxi2h_chan($chan) a]
  if {$pxi2h(status) == "on"} {
    for {set i 0} {$i < [llength $pxi2h_history($chan)]} { incr i } {
      puts $html "  \[[strftime "%H:%M"]\][pxi2h:unconvert [lindex $pxi2h_history($chan) $i]]<BR>"
    }
  } else {
    puts $html "  <BR><CENTER><B>O F F L I N E !</B></CENTER><P>"
  }
  #puts $html " </FONT>\n <HR SIZE=\"1\">\n <CENTER><FONT SIZE=\"-1\" FACE=\"sans-serif\"><I>Powered by <A HREF=\"http://www.egghelp.org/\">www.egghelp.org</A></I></FONT></CENTER>\n</BODY>\n</HTML>"
  close $html
I tried copying and pasting the html codes to the script but it gives me errors that I can't figure out, the script looks confusing to edit. Basically, all I want to do is when the html page refreshes, I want it to be all the way at the bottom instead of the top since it will show a lot of lines. I don't want to manually scroll all the way to the bottom. Thanks a lot for your help. :D
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: need help with adding html code to script

Post by CrazyCat »

You allready have the refresh in your generated page, so you have a choice:

Code: Select all

  set html [open $pxi2h_chan($chan) w]
  puts $html "<HTML>\n<HEAD>\n <TITLE>$pxi2h(title)</TITLE>\n <META HTTP-EQUIV=\"Refresh\" CONTENT=\"$pxi2h(refresh)\">\n</HEAD>"
Either you replace $pxi2h(refresh) with 10;URL=#bottom, either you find the line containing set pxi2h(refresh) and you put 10;URL=#bottom in :)

And for your bottom, it's false so it won't work...
try replacing

Code: Select all

#puts $html " </FONT>\n <HR SIZE=\"1\">\n <CENTER><FONT SIZE=\"-1\" FACE=\"sans-serif\"><I>Powered by <A HREF=\"http://www.egghelp.org/\">www.egghelp.org</A></I></FONT></CENTER>\n</BODY>\n</HTML>"
whith:

Code: Select all

#puts $html " </FONT>\n <HR SIZE=\"1\">\n <CENTER><FONT SIZE=\"-1\" FACE=\"sans-serif\"><a name=\"bottom\"></a><I>Powered by <A HREF=\"http://www.egghelp.org/\">www.egghelp.org</A></I></FONT></CENTER>\n</BODY>\n</HTML>"
B
Bytez
Op
Posts: 168
Joined: Mon Aug 11, 2003 1:42 pm

Post by Bytez »

Thanks so much!!! :D What are the \n and \ on the script for? :)
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Have you ever read "The Manual"?
B
Bytez
Op
Posts: 168
Joined: Mon Aug 11, 2003 1:42 pm

Post by Bytez »

Hey, a few problems:

1) The page would only automatically refresh one time then it no longer refreshes again. I set the script to refresh every 10 seconds, it was working before I changed the code to what you wrote.
2)when I manually refreshed the page, the page would no longer automatically refresh by itself.
3)if I clicked on the refresh button on my browser, it goes all the way to top instead of the bottom

What gives?
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

You got all the info you needed regarding your tcl problem I think. Now you're left with html-related problems which is kinda off-topic in this forum.
Have you ever read "The Manual"?
Locked