Kronos
Привет.
может кто подсказать.
имеется пхп скрипт новостей.
новости пишутся в .тхт файл.
потом выводятся на страницу .пхп на сайте.
проблема в том, что ВСЯ полностью структура текста(абзацы, отступы, табуляция и т.д.) при этом теряется - просто массив слов вываливатся в результате
пример:
было--------------------
14.01.2013
As the coalition government wrestles with an £83bn round of spending cuts to get the UK economy back on track, we will shortly look at cuts to benefits coming into force this year.
Child Benefit
The amount of Child Benefit you can claim and receive is unaffected - £20.30/week for the first and only child, £13.40/week for additional child.
From 7 January 2013, a new income tax charge will be applied where a person has an individual income of over £50,000 and they or their partner gets Child Benefit.
The amount of the charge will depend on how much that person's individual income exceeds £50,000:
• Where a person/partners have an income less than £50,000, the Child Benefit won't change;
• Where a person has an income between £50,000 and £60,000, the charge applied to their income tax will be 1% of their Child Benefit for every £100 of income between £50,000 and £60,000. The income tax charge will never be more than the amount of Child Benefit they receive.
• Where a person has an income of over £60,000 the charge will be equal to the full amoun
стало-------------
14.01.2013 As the coalition government wrestles with an £83bn round of spending cuts to get the UK economy back on track, we will shortly look at cuts to benefits coming into force this year. Child Benefit The amount of Child Benefit you can claim and receive is unaffected - £20.30/week for the first and only child, £13.40/week for additional child. From 7 January 2013, a new income tax charge will be applied where a person has an individual income of over £50,000 and they or their partner gets Child Benefit. The amount of the charge will depend on how much that person's individual income exceeds £50,000: • Where a person/partners have an income less than £50,000, the Child Benefit won't change; • Where a person has an income between £50,000 and £60,000, the cha---------------------------
причем в админ-форме поста новости при написании или редактировании - все отлично на своем месте.
а уже при просмотре в той же админке или на странице сайта - уже месиво
где собака зарыта?
хелп!
Kronos
а куда скинуть то?
дай мыло
плз
или вот код самого вывода
<?php
require('newsconfig.php');
$action = $_GET["action"];
$num = $_GET["num"];
if(!isset($action)){
$action = 1;
}
if(!isset($num)){
$num = $entriesshown;
}
function news($action,$num,$smilies,$sitetitle,$template_file)
{
$template_lines = file($template_file);
$new = $num * $action;
$min = $new - $num;
$file = "news.txt";
$lines = file($file);
$lines = array_reverse($lines, TRUE);
$count = count($lines);
$total = $count / $num;
$total = ceil ($total);
if($action > $total){
die("<html><head><link href=\"general.css\" rel=\"stylesheet\" type=\"text/css\"></head>
<body><center><table border=0 cellspacing=4 cellpadding=4>
<tr>
<td class=maintable>
<table border=0 cellspacing=0 cellpadding=2>
<tr>
<td class=title>Sorry</td>
</tr>
<tr>
<td class=message align=center>Sorry But We Dont Have That Many Entries</td>
</tr>
<tr>
<td class=foot align=right>$sitetitle</td>
</tr>
</td>
</tr>
</table></table>
</center></body></html>");
}
$link = $action + 1;
$lines = array_slice($lines, $min, $num);
foreach($lines as $news) {
list($date,$message,$author,$image,$subject,$skey,$comment) = explode('||',$news);
$replacements = array($date,$message,$author,$image,$subject,$skey,$comment);
$patterns = array('{date}', '{message}', '{author}', '{image}', '{subject}', '{entry}', '{number_comments}');
foreach($smilies as $key=>$value){
$message = str_replace("$key", "$value", "$message");
}
foreach($template_lines as $temp_line){
$temp_line = str_replace($patterns, $replacements, $temp_line);
echo $temp_line;
}
}
for ($i = 1; $i < $action; $i++) {
echo "<a href=\"?action=$i&num=$num\"><font size=+1><b>$i</b></font></a> ";
}
echo "<font size=+1 color=#ff000000><b>$action</b></font> ";
for ($i = $link; $i <= $total; $i++) {
echo "<a href=\"?action=$i&num=$num\"><font size=+1><b>$i</b></font></a> ";
}
}
news($action,$num,$smilies,$sitetitle,$template_file);
?>