求助林先生!关于主页显示方式的修改。
请问林先生,我想把主页帖子的显示方式改成类似微博、qq空间那样,就是没有标题,直接能看到每个人发的动态,请问我该怎么改啊,有没有连带要改的,要注意哪些呢?本人学编程仅仅1年还是个小白。。。
一年够久了,怎么还会是个小白。
Java学三天都可以直接进行Android开发了。
https://www.94cb.com/users/following
参照这个直接改,就非常简单,移除十几个字符就行了。
回复#2 @lincanbin :
小白求教林先生!我想在home页显示每个人发布的内容,图片什么的经过缩略图处理,我的修改方式如下:
index.php----从posts表里查询出内容(非回复)
//后加的
$contents = array();
//$contents = $DB->query('SELECT TopicID,Content FROM ' . $Prefix . 'posts WHERE IsTopic=1 ORDER BY PostTime DESC');
if ($Page <= 10) {
$contents = $DB->query('SELECT TopicID,Content FROM ' . $Prefix . 'posts force index(PostTime)
WHERE IsTopic=1
ORDER BY PostTime DESC
LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ',' . $Config['TopicsPerPage']);
if ($MCache && $Page == 1) {
$MCache->set(MemCachePrefix . 'Homepage', $TopicsArray, 600);
}
}
else {
$contents = $DB->query('SELECT TopicID,Content FROM ' . $Prefix . 'posts force index(PostTime)
WHERE PostTime<=(SELECT PostTime
FROM ' . $Prefix . 'posts
WHERE IsDel=0
ORDER BY PostTime DESC
LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ',1)
and IsDel=0
ORDER BY PostTime DESC
LIMIT ' . $Config['TopicsPerPage']);
}home.php----找到位置,遍历出内容
<div class="item-content">
<h2><!-- 标题 -->
<a href="<?php echo $Config['WebsitePath']; ?>/t/<?php echo $Topic['ID']; ?>">
<?php echo $Topic['Topic']; ?>
</h2>
<!--文本后加的-->
<?php
foreach ($contents as $content) {
echo strip_tags(mb_substr($content['Content'], 0, NULL, 'utf-8'),'<img><br><a>'); //主题内容
}}
?>
现在的效果是每个标题后面显示的是全部的内容,肯定是我foreach的不对,求问林先生我要怎么修改,或者林先生有很简单的方法,求赐教。
回复#8 @lincanbin :
多谢林先生,已经改好了,是参考二楼的改的,但是我是修改了一下数据库查询语言,把index.php页面的查询添加了一个posts表里的content字段。
if (!$TopicsArray) {
if ($Page <= 10) {
$TopicsArray = $DB->query('SELECT carbon_topics.*,carbon_posts.Content
FROM ' . $Prefix . 'topics force index(LastTime),'.$Prefix.'posts WHERE carbon_topics.ID=carbon_posts.TopicID
AND carbon_topics.IsDel=0
ORDER BY LastTime DESC
LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ',' . $Config['TopicsPerPage']);
if ($MCache && $Page == 1) {
$MCache->set(MemCachePrefix . 'Homepage', $TopicsArray, 600);
}
} else {
$TopicsArray = $DB->query('SELECT carbon_topics.*,carbon_posts.Content
FROM ' . $Prefix . 'topics force index(LastTime),'.$Prefix.'posts WHERE carbon_topics.ID=carbon_posts.TopicID
AND LastTime<=(SELECT LastTime
FROM ' . $Prefix . 'topics force index(LastTime)
WHERE IsDel=0
ORDER BY LastTime DESC
LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ',1)
and carbon_topics.IsDel=0
ORDER BY LastTime DESC
LIMIT ' . $Config['TopicsPerPage']);
}
}我这样可以吗
?因为我实在找不到移除哪十几个字符。。
登录后方可回帖
好 我试试 是大白了 哈哈

粤公网安备 44030602003677号
标题不可以用title标签吗?我好想看看你的QQ空间微博风格首页,可以拿来看看吗?