Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Display txt-File in Boardindex (Read 2901 times)
mick
Senior Member
****
Offline


I love YaBB

Posts: 345
Location: Dorsten
Joined: Nov 29th, 2005
Gender: Male
Display txt-File in Boardindex
Jan 13th, 2009 at 8:55pm
Print Post  
Hi @All,

I've installed the IRC-Mod in our 2.3.1-Board. The Mod
only shows the User online, that are logged in with the
Mod.

Also we have a Script, that send a Bot in our Chat, "looks"
who is online the and save the names in a txt-File. This
Textfile is shown at our Starting-Page (www.info4alien.de).

I want to display this file now on our Board. I have to
change the marked Code in ChatIRConline.pl:

Code
Select All
	<td class="windowbg2">
		<div style="float: left; width: 100%; text-align: left;">
		<span class="small"><b>$ChatIRC{'17'}</b> $chatguests $ChatIRC{'19'} $chatnumusers $ChatIRC{'20'}<br /><b>$ChatIRC{'18'}</b> $chatusers</span>
		</div>
	</td>
 


But what have I to write in there, to display the Text of the
txt-File. Or have I to place the code of the Script there?

Thanks for Input.

Mick

P.S.: All Admins are in the Chat with MIRC-Client. So we are
not dispayed on Boardindex. That we want to change.
  
Back to top
WWW  
IP Logged
 
mick
Senior Member
****
Offline


I love YaBB

Posts: 345
Location: Dorsten
Joined: Nov 29th, 2005
Gender: Male
Re: Display txt-File in Boardindex
Reply #1 - Jan 20th, 2009 at 7:44pm
Print Post  
Nobody with an Idea? I need to explain it more?
  
Back to top
WWW  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: Display txt-File in Boardindex
Reply #2 - Jan 21st, 2009 at 10:51am
Print Post  
So you just want to read the content of a text file and display it? That's strait forward:

Code
Select All
fopen(TXTFILE, "/foo/bar/myfile.txt") || &fatal_error('cannot_open', "/foo/bar/myfile.txt", 1);
my @txtfile = <TXTFILE>;
fclose(TXTFILE);
$txtfilecontent = "";
foreach (@txtfile) { $txtfilecontent .= $_; } 



Now you can add the variable $txtfilecontent to your html code in ChatIRConline.pl.
  

The Administrator.
Back to top
WWW  
IP Logged
 
mick
Senior Member
****
Offline


I love YaBB

Posts: 345
Location: Dorsten
Joined: Nov 29th, 2005
Gender: Male
Re: Display txt-File in Boardindex
Reply #3 - Jan 21st, 2009 at 1:28pm
Print Post  
Hi Michael,

thank you! Thats, what I need. I change the
variables $chatusers with $txtfilecontent.

One more Question:

In my textfile are in first line a timestamp. The
users-display begins in second line. Is there a way
not to display the first line in the variable?
  
Back to top
WWW  
IP Logged
 
deti
Full Member
***
Offline


YaBB is the best!!!

Posts: 101
Location: Prien am Chiemsee
Joined: Mar 13th, 2008
Re: Display txt-File in Boardindex
Reply #4 - Jan 21st, 2009 at 1:39pm
Print Post  
mick wrote on Jan 21st, 2009 at 1:28pm:
Is there a waynot to display the first line in the variable?

Code
Select All
fopen(TXTFILE, "/foo/bar/myfile.txt") || &fatal_error('cannot_open', "/foo/bar/myfile.txt", 1);
my @txtfile = <TXTFILE>;
fclose(TXTFILE);
$txtfilecontent = "";
for (my $x = 1; $x < @txtfile; $x++) { $txtfilecontent .= $txtfile[$x]; } 


  

Was immer Du tun kannst
oder erträumst tun zu können,
beginne es.
Kühnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
Johann Wolfgang Goethe
Back to top
 
IP Logged
 
mick
Senior Member
****
Offline


I love YaBB

Posts: 345
Location: Dorsten
Joined: Nov 29th, 2005
Gender: Male
Re: Display txt-File in Boardindex
Reply #5 - Jan 21st, 2009 at 9:23pm
Print Post  
Hi,

thx, so I see only the second line in boardindex.

It's ok, but not perfect...

The txt-file only refresh, wenn the external Home-
page is called (then the script start, which "look"
into our irc-channel).

I test to start the script when users call the board-
index, but don't find the solution. When I call the
script inside ChatIRConline.pl I get blanc page with
the name of the users, that are online.


It's ok! The Homepage is viseted often enough, so
the script start and we get a new txt-File.

Thanks again, I'm happy Wink

« Last Edit: Jan 22nd, 2009 at 10:29pm by mick »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint