 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
evogroup
Joined: 01 Sep 2009 Posts: 4
|
Posted: Tue Sep 01, 2009 11:54 am Display and format text from .txt file. |
|
|
|
I am trying to display text on a page that is linked to a .txt file.
I have this code which works, but I cannot format the text.
The text is always displayed as black, arial.
<html>
<head>
<title>Untitled Document</title>
<IMG SRC="background.jpg">
<DIV STYLE="position:absolute; top:183px; left:13px; width:500px; height:55px">
<CENTER>
<FONT COLOR="#FF060F" SIZE="+2" face="Georgia, Times New Roman, Times, serif">
<object type="text/html" data="text.txt">
</object>
</FONT>
</CENTER>
<div> <font color="#FF060F">
<?php include("text.txt"); ?>
</font></div>
</div>
</body>
</html> |
|
sticks464

Joined: 31 Dec 2006 Posts: 2311
|
Posted: Tue Sep 01, 2009 1:08 pm |
|
|
|
All you can format is the text color because there are no html tags to set styling rules for except the font. The color can be set like this
| Code: |
<div id="txt">
<?php include("text.txt"); ?>
</div> |
css (put in head section of page)
| Code: |
<style type="text/css">
#txt {color:#FF060F;
font-family:"Georgia", Times New Roman, Times, serif;
font-size:14px;
position:absolute;
top:183px;
left:13px;
width:500px;
height:55px;
}
</style> |
|
|
evogroup
Joined: 01 Sep 2009 Posts: 4
|
Posted: Tue Sep 01, 2009 8:55 pm |
|
|
|
Thanks, although I'm not quite getting it.
Like this?
<html>
<head>
<style type="text/css">
#txt {color:#FF060F;
font-family:"Georgia", Times New Roman, Times, serif;
font-size:14px;
position:absolute;
top:183px;
left:13px;
width:500px;
height:55px;
}
</style>
</head>
<body>
<div id="txt">
<?php include("text.txt"); ?>
</div>
</body></html> |
|
sticks464

Joined: 31 Dec 2006 Posts: 2311
|
Posted: Tue Sep 01, 2009 9:22 pm |
|
|
|
| That's how you do it. CSS inside style tags in the head section. |
|
evogroup
Joined: 01 Sep 2009 Posts: 4
|
Posted: Tue Sep 01, 2009 9:37 pm |
|
|
|
| I just get a blank page in FireFox and Safari. |
|
sticks464

Joined: 31 Dec 2006 Posts: 2311
|
Posted: Wed Sep 02, 2009 4:04 am |
|
|
|
Do you have a server installed (like wamp)?
Php is server side language and is parsed by the server not the browser. You will need to install a server if you want to see the results of php in your browser prior to uploading to a hosting server. |
|
evogroup
Joined: 01 Sep 2009 Posts: 4
|
Posted: Wed Sep 02, 2009 7:28 am |
|
|
|
No server installed.
I just sent you a PM.
Thanks. |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|