所以我的想法是我最终会从以杂志风格格式化的数据库中显示数据。我希望将字符串拆分为列,但由于它在某些浏览器中不兼容,因此不使用 css3 的列功能。
我已经在一个新的 div 中停止并开始字符串,它停止了,显然后来我会有分页的东西,但是目前我的一些单词在它分裂成时分成了两部分另一个分区。但是,这不应该发生,因为我按照此处另一页上的一些说明进行操作,这应该已经停止了单词分裂,所以我不知道发生了什么。想问问大家能不能帮忙。这是页面:
这是临时从中提取字符串的 PHP 文件“./data/lost.php”(不过,这里缩短了正文字符串,因为你明白了):
<?php
$title = "This is where the title will go...";
$username = "[Full Name]";
$date = "[Creation Date]";
$body = 'The first season begins with a plane crash that leaves the surviving passengers of Oceanic Airlines Flight 815 on what seems to be a deserted tropical island. Their survival is threatened by a number of mysterious entities, including polar bears, an unseen creature that roams the jungle (the "Smoke Monster"), and the island\'s malevolent inhabitants known as "the Others"...';
$quote = '"This is a space reserved for a quote..."';
?>
这是页面的php:
<?php
require_once('./data/lost.php');
function text($text,$limit,$length)
{
$newbody = substr($text, $length, strpos(wordwrap($text, $limit), "\n"));
global $newlength;
$newlength = ($length + strlen($newbody));
return $newbody;
};
echo "
<div id='wrapper'>
<div id='articlecont'>
<div id='title'>". $title ."</div>
<div class='col12'>
<div id='artimage'>An Image will go here...</div>
<div class='col1'><span style='font-size:0.8em;'>Author: ". $username ." on: ". $date ."</span><br />
<br />". text($body,495, 0) ."</div>
<div class='col2'>". text($body,520, $newlength) ."</div>
</div>
<div class='col22'>
<div class='col31'>". text($body,390, $newlength) ."</div>
<div class='quote'>". $quote ."</div>
<div class='col32'>". text($body,260, $newlength) ."</div>
</div>
<div class='col4'>". text($body,3000, $newlength) ."</div>
</div>
</div>
</body>
</html>";
?>
提前感谢您提供的任何帮助。我会继续检查回复。