Current location: Hot Scripts Forums » Programming Languages » PHP » How do I format text from a flat file with CSS?


How do I format text from a flat file with CSS?

Reply
  #1 (permalink)  
Old 10-14-03, 04:50 PM
TinnyFusion TinnyFusion is offline
New Member
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question How do I format text from a flat file with CSS?

Hi all, I have a guestbook script I have done in php that stores all data in a .TXT document, is there any way to format this text after reading/displaying it using CSS?

Here is a bit of my code if it helps:
PHP Code:

<?

$file
=fopen("guestbook.txt""r");
$size=filesize("guestbook.txt");
$contents=fread($file$size);
$contents=nl2br($contents);
echo 
"Guestbook is currently $size bytes";
?>
For instance I would like to format the text "Guestbook is currently $size bytes" by using something like:
Code:
style="font-size: 12px"
or
Code:
<font face="Arial" size="2">Guestbook is currently $size bytes</font>
Regards, TinnyFusion
__________________
"I disagree, Trinity. I think the Matrix can be more real than this world."
- Cypher - The Matrix -

Last edited by TinnyFusion; 10-14-03 at 04:57 PM.
Reply With Quote
  #2 (permalink)  
Old 10-15-03, 04:40 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
you just posted it
just make it like this :
PHP Code:

echo"<font face=\"Arial\" size=\"2\">Guestbook is currently $size bytes</font>"
or use single quote :
PHP Code:

echo'<font face="Arial" size="2">Guestbook is currently '.$size bytes.'</font>'
or just use the Style you want in the HTML header and just print everything in plain text and it will be 'styled' the way you want ..
I am using the header style method in my scripts and it works fine ..
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 03-19-04, 05:40 PM
Dabrowski Dabrowski is offline
New Member
 
Join Date: Mar 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
NeverMind,

What's the deal with using dots with variables in the echo statement? I've seen it around, but I can't really find out the answer. I know that echo with single quotes works as long as there are no variables, and I know that you're supposed to use double quotes when there are variables. But everything else confuses me.

Thanks.
Ben
Reply With Quote
  #4 (permalink)  
Old 03-22-04, 09:42 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
using single quotes is faster because PHP will not bother looking for a variable to parse..
see the example:
PHP Code:

$name 'NeverMind';

echo 
'My name is $name.';
//this will produce : My name is $name.

echo "My name is $name";
//this will produce : My name is NeverMind 
the dot is to chain whats before it and after it together !
it's like the + in JavaScript !
example:
sometimes you want to have a fixed dir name but the file name is a variable provided via a form to include files from the dir 'articles' so this how it can be done:
PHP Code:

include_once('articles/' $filename); 

altho these lines are almost useless but it helps in explaning..

hope that was clear
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP code to edit a text file mdhall Script Requests 12 12-23-10 04:03 AM
Editing a text file. cjh_60 PHP 1 10-14-03 03:59 PM
Writes to a text file gamextremer2003 JavaScript 4 09-11-03 09:43 AM
text file to link rush989 Script Requests 3 08-29-03 06:12 PM
Need to submit form to database and text file - Any ideas how? dpreiss ASP 1 08-21-03 06:02 PM


All times are GMT -5. The time now is 07:07 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.