2 isaac Aug 07, 2004 00:45

isaac wrote:
Well, yeah... It's displaying a text file. That's how they display.
huh ? .txt files displays without lines breaks ?
When my browser displays that file :
http://turtle.ee.ncku.edu.tw/openwebmail/doc/readme.txt
I see the line breaks and it's quite an easy to read document,
so I don't understand what you meant.
How can I keep the line breaks in the skin ?
Better like this ?
<?php echo url_add_param(get_bloginfo('blogurl'),'disp=extratext');?>
The file is remote for now but at the end both the file and the skin will be on the same server.
When you use an include, all it does is add the text to the source exactly as it is in the file. Carriage returns and blank lines are ignored in html, which is why you use the <br> tag to start a new line. Someone cleverer than me could possibly write a function to substitute a blank line with <br><br>, or else you'll need to save the file in html format.
<?php
switch($disp)
{
case 'extratext':
echo '<pre>';
include("http://www.domain.com/extratext.txt");
echo '</pre>';
break;
}
?>
Excellent ! thanks !
Just another FYI:
You could also wrap it in any element that had the "white-space:pre" CSS property applied to it. The PRE tag has this by default. (PRE stands for PRE-formatted - i.e., "I already formatted this in the source, just spit it out as-is.")
Well, yeah... It's displaying a text file. That's how they display.
Why are you linking to the staticurl, and not to the regular url? (Better yet, use the add_param function.)
By the way, including a remote file based on the url parameter can be HIGHLY insecure. Make sure you're careful!