Forum Moderators: coopster
My PHP knowledge is limited.
Thanks in advance
babil
If you're bound and determined, make sure you're opening the file in a binary safe method. Look at [wotsit.org...] for some information on file formats.
If these are your files, you might try RTF. You can save in RTF from Word, and they're somewhat similar to HTML (although you would have to do some conversion).
- Ryan
(I think it can be done with mySQL, but no time to learn how to use it)
cheers
babil
babil
<?
$file = 'TAE/tae21.htm';
$data = file($file) or die('Could not read file!');
foreach ($data as $line) {
echo nl2br($line);
};
?>
try putting this in the first line of that code and see if it fixes it.
header('Content-Type: text/html');
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
š› —¡˜¤•
¤— ¤• Virtual
bhma
2
17
2005-02-04T17:09:00Z
2005-02-24T18:41:00Z
2005-02-24T18:41:00Z
1
572
3265
27
7
3830
10.2625
Clean
Clean
MicrosoftInternetExplorer4
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
š›
—¡˜¤• ¤—
¤• style='font-size:9.0pt;color:black;mso-ansi-language:EN-US;font-weight:normal;
mso-bidi-font-weight:bold'>Virtual.
ÀÄ¿¯
Ư¿¹ ÄÂ
•¹º®Â
•¹º¿¹º®Â
º¹ (¹Ä¹ Ìǹ ;)
ÄÂ real style='font-size:9.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman";
color:black'> style='mso-spacerun:yes'> µÁ¿À¿Á¯Â style='mso-spacerun:yes'> ¼¹
ÀÁ¼Ä¹ºÌÄÄ
À¿Å ¸ µ¹
Ä
ÇÁ¿¿¼Ç®
¼ÀÁ¿ÃÄ ¹
¼Â ÆÁµ¹ ̼ÉÂ
À¯ÃÉ ÃÄ¿ ÇÁÌ¿
µ¯¹ µ¿ÌÂ.
Á̺µ¹Ä¹
¹ Ä
µ¾¿¼¿¯Éà ÄÂ
¤• (¤µÇ¹º¯
º¹ µÁ¿À¿Á¹º¯
•º¼µÄµÍõ¹Â
Ÿ.• - style='mso-spacerun:yes'> Technical and Aeronautical Exploitations Co.
Ltd.). style='mso-spacerun:yes'> Ä
ÀÁÎÄ ,
¿ÅùÃĹº,
¹´¹ÉĹº® style='mso-spacerun:yes'> À¿¹Ä¹º®
µÁ¿À¿Á¹º®
µÄ¹Áµ¯ À¿Å
´ÁÃÄÁ¹¿À¿¹®¸ºµ
ÃÄ •´
ÀÌ Ä¿ 1935 É Ĺ 6
ÀÁ¹¯¿Å ĿŠ1957,
ÌÄ ¹´Á͸ºµ
ŸÅ¼À¹º®
µÁ¿À¿Á¯.
style='mso-spacerun:yes'> œ¹ÃÄ,
ÌÀÉÂ
ÀµÁ¹Áȵ style='mso-spacerun:yes'> ¿ ºÅµÁ®ÄÂ
ĿŠDC lang=EL style='font-size:9.0pt;font-family:Arial;mso-bidi-font-family:"Times New Roman";
color:black'>-3 Í¿Â
™É¯´Â ¹
Ä ¼Á
and it goes on and on.....
The fonts don't display correctly due to the encoding (greek)
It's pretty frustrating the whole thing.
babil
INDEX.PHP
----------
<?php
require_once("class.php");
if(!isset($fpage))
{
$fpage = "news.php";
}
else {
$fpage ;
}
$page = new Page("template.html");
$page->replace_tags(array(
"title"=>"Hoav Website",
"contenthd"=>"Anouncements",
"content" => $fpage,
"navbar" => "board2.htm",
));
$page->output();
?>
END INDEX.PHP
-------------
BEGIN CLASS.PHP
---------------
<?php
class Page
{
var $page;
function Page($template = "template.html") {
if (file_exists($template))
$this->page = join("", file($template));
else
die("Template file $template not found.");
}
function parse($file) {
ob_start();
include($file);
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
function replace_tags($tags = array()) {
if (sizeof($tags) > 0)
foreach ($tags as $tag => $data) {
$data = (file_exists($data))? $this->parse($data) : $data;
$this->page = eregi_replace("{" .$tag. "}", $data,
$this->page);
}
else
die("No tags designated for replacement.");
}
function output() {
echo $this->page;
}
}
?>
END CLASS.PHP
-------------
BEGIN TEST.CSS
--------------
#body {margin:0px;
background-color: #336699;
overflow:auto;
}
#main {
width:100%;
vertical-align: top;
height:100%;
border: none;
overflow:scroll;
}
#head {
background-image:url('head.jpg') ;
background-repeat:repeat-x;
height:60px;
position: relative;
}
#navbar {
width: 20%;
background-color:#336699 ;
vertical-align:top;
border:solid 2px #336699;
}
#content {
width: 80%;
background-color:#003366;
vertical-align:top;
border:solid 5px #000000;
text-align: center;
color:#FFFFCC;
font-size: 35px;
font-family: serif;
overflow: scroll;
font-weight: bold;
}
#p {
color:#ffff99;
font-size: 15px;
text-align: left;
font-family: serif;
font-weight: lighter;
padding-left: 5%;
}
END TEST.CSS
-------------
BEGIN TEMPLATE.HTML
-------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>{title}</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="test.css" />
</head>
<body id="body">
<table id="main" cellpadding="0" cellspacing="0" >
<tr>
<td id="head" colspan="2">{head}</td>
</tr>
<tr>
<td id="navbar">{navbar}
</td>
<td id="content">{contenthd} <p id="p">
{content}
</p>
</td>
</tr>
</table>
</body>
</html>
END TEMPLATE.HTML
-----------------
BEGIN NEWS.PHP
--------------
<?
$file = 'news.txt';
$data = file($file) or die('Could not read file!');
foreach ($data as $line) {
echo nl2br($line);
};
?>
END NEWS.PHP
------------
BEGIN TAE.PHP
--------------
<?
header('Content-Type: text/html');
$file = 'TAE/tae2.htm';
$data = file($file) or die('Could not read file!');
foreach ($data as $line) {
echo nl2br($line);
};
?>
END TAE.PHP
-----------
Sorry for the long post, but now you can have an overview of my project. My aim is to make a website which will be easily updateable. No need to write html code, placing images etc. Just create a word, pdf etc document with the updated content the plus images and then upload it on the server.
cheers
babil
Just get a copy of FCK Editor install on the Server with a simple CMS of some kind. The editor will allow you to copy and paste from Word to the Editor HTML with "cleaning". It works pretty good.
My 2 cents.