phpcms:五、网站首页(index.html)
1、经典案例:
图文列表:
{pc:content action="position" posid="2" order="listorder DESC" num="4"}
{loop $data $r}
<h4 class="blue"><a href="{$r[url]}" title="{$r
[title]}">{str_cut($r[title],36,'')}-----------88888778-----</a></h4>
<p>{if $n==1}<img src="{thumb($r[thumb],90,60)}"
width="90" height="60"/>{/if}{str_cut($r[description],112)}</p>
<div class="bk20 hr"><hr /></div>
{/loop}
{/pc}
2、标题截取
{str_cut($r[title],36,'')}:截取36个字符
3、是不是第一条数据
{if $n==1}<img src="{thumb($r[thumb],90,60)}" width="90" height="60"/>
{/if}:如果是第一条数据,就显示缩略图({thumb($r[thumb],90,60)})
4、焦点图调用
{pc:content action="position" posid="1" order="listorder DESC"
thumb="1" num="5"}
<div class="content" id="main-slide">
<div class="changeDiv">
{loop $data $r}
<a href="{$r['url']}" title="{str_cut($r
['title'],30)}"><img src="{thumb($r['thumb'],310,260)}" alt="{$r
['title']}" width="310" height="260" /></a>
{/loop}
</div>
</div>
{/pc}
必须有缩略图:thumb="1"
5、碎片
{pc:block pos="index_block_1"}{/pc} (pos:碎片位置标识符)
6.碎片格式化数据默认模板:
{$name}
<ul>
{loop $data $i $r}
<li style="clear:both">
<a href="{$r[url]}">{$r[title]}</a><br />
<div style="color:#ccc;">{if $r[thumb]}<img src="{$r[thumb]}"
style="float:left">{/if}{$r[desc]}
</div>
{/loop}
</li>
</ul>
如果存在缩略图,就显示出来:{if $r[thumb]}<img src="{$r[thumb]}"
style="float:left">{/if}
{thumb($r[thumb],110,0)}宽度:100,高度:自动。
7.隔行运算符:
{if $num%2!=0}style=" margin-right:10px"{/if}(如果是奇数行,就跟右边的距
离为10px)。
{if $num%2==0}<div class="bk10"></div>{/if}(如果是偶数行,就显示<div
class="bk10"></div>)
-----------------------------------------------
8.各个模型+一级栏目+最新缩略图+几篇文章
{loop subcat(0,0,0,$siteid) $r}
{php $num++}
<div class="box cat-area" {if $num%2!=0}style=" margin-
right:10px"{/if}>
<h5 class="title-1">{$r[catname]}{$r[catid]}<a
href="{$r[url]}" class="more">更多>></a></h5>
<div class="content">
{pc:content action="lists" catid="$r[catid]"
order="updatetime DESC" thumb="1" num="1" return="info"}
{loop $info $v}
<p>
<img src="{thumb($v[thumb],90,0)}" width="90"
height="60"/>
<strong><a href="{$v['url']}" target="_blank"
title="{$v['title']}"{title_style($v[style])}>{str_cut($v['title'],28)}
</a></strong><br />{str_cut($v['description'],100)}
</p>
{/loop}
{/pc}
<div class="bk15 hr"></div>
{pc:content action="lists" catid="$r[catid]" num="5"
order="id DESC" return="info"}
<ul class="list lh24 f14">
{loop $info $v}
<li>·<a href="{$v['url']}" target="_blank"
title="{$v['title']}"{title_style($v[style])}>{str_cut($v['title'],40)}
</a></li>
{/loop}
</ul>
{/pc}
</div>
</div>
{if $num%2==0}<div class="bk10"></div>{/if}
{/loop}
-------------------------------------------------
9.公告:
没有url,只能这样
{pc:announce action="lists" siteid="$siteid" num="2"}
<ul class="list lh24 f14">
{loop $data $r}
<li> <a href="{APP_PATH}index.php?
m=announce&c=index&a=show&aid={$r['aid']}">{$r['title']}</a></li>
{/loop}
</ul>
{/pc}
10.专题
{pc:special action="lists" siteid="$siteid" elite="1" listorder="3"
num="2"}
{loop $data $r}
{if $n!=1}<div class="hr bk15"></div>{/if}
<p style="margin:0">
<a href="{$r[url]}"><img src="{$r[thumb]}"
width="90" height="70" /></a>
<strong><a href="{$r[url]}">{str_cut($r
[title],'18')}</a></strong><br />{str_cut($r['description'],50)}
</p>
{/loop}
{/pc}
elite="1":精华、加精
11.排行
{pc:content action="hits" catid="6" num="10" order="views DESC"}
{loop $data $r}
<li><a href="{$r[url]}"
target="_blank" title="{$r[title]}"{title_style($r[style])}>{$r[title]}
</a></li>
{/loop}
{/pc}
11.投票
<h5 class="title-2">调查问卷<a href="{APP_PATH}index.php?
m=vote&c=index&siteid={$siteid}" class="more">更多>></a></h5>
<script language="javascript" src="{APP_PATH}index.php?
m=vote&c=index&a=show&action=js&subjectid=1&type=3"></script>
12.申请友情链接
<h5><a href="{APP_PATH}index.php?m=link&siteid={$siteid}"
hidefocus="true" class="rt">更多>></a>友情链接<a href="{APP_PATH}
index.php?m=link&c=index&a=register&siteid={$siteid}" class="red">申请链
接</a></h5>
友情链接的设置内容:
{pc:link action="type_list" siteid="$siteid" linktype="1"
order="listorder DESC" num="8" return="pic_link"}
{loop $pic_link $v}
linktype="4" :文字的友情链接
linktype="1" :图片的友情链接
13.嵌套说明
{pc:link action="type_list" siteid="$siteid" order="listorder DESC"
num="10" return="dat"}
{loop $dat $v}
<!--循环体-->
{pc:link action="type_list" siteid="$siteid" linktype="1"
order="listorder DESC" num="8" return="pic_link"}
{loop $pic_link $v}
<!--循环体-->
{/loop}
{/pc}
phpcms:五、网站首页(index.html)的更多相关文章
- phpcms v9网站搬家更换域名的方法
PHPCMS 是国内领先的网站管理系统,同时也是一个开源的PHP开发框架. 本文介绍phpcms v9网站搬家更换域名的方法. 1.在新的主机空间把phpcms安装好. 新安装的版本一定要和准备搬迁的 ...
- dedecms如何随机调用指定分类下的文章到网站首页
dedecms是全静态的,有时会因为其他事情好几天没写文章推荐到首页,那样对se不是很友好.原本ytkah是想在网站首页上半部分调用几篇id从200到500的文章随机展示的,这样每次更新首页给se的赶 ...
- 基于jQuery的网站首页宽屏焦点图幻灯片
今天给大家分享一款基于jQuery的网站首页宽屏焦点图幻灯片.这款焦点图适用浏览器:IE8.360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之窗.效果图如下: 在线预览 ...
- YII中面包屑制作(当前位置:网站首页 >> 会员登陆)
面包屑制作(当前位置:网站首页 >> 会员登陆) 作用:就是在布局里要显示的信息,但这个信息在不同的页面里显示的内容不一样,例如:网页的title.网页的当前位置等等 1.布局中每个页面t ...
- 织梦DEDECMS网站首页如何实现分页翻页
织梦DEDECMS模板网站首页如何实现首页分页和翻页 方法如下:(三种方法,自己选择一种来实现分页吧) 第一种:调用ajax和参数的(不推荐)1.必须在DEDE首页模板中的<head>&l ...
- 一种基于自定义代码的asp.net网站首页根据IP自动跳转指定页面的方法!
一种基于自定义代码的asp.net网站首页根据IP自动跳转指定页面的方法! 对于大中型网站,为了增强用户体验,往往需要根据不同城市站点的用户推送或展现相应个性化的内容,如对于一些大型门户网站的新闻会有 ...
- wamp phpcms部署网站问题
服务器使用自己的服务器,域名申请后通过信息服务iis管理器建网站,并将物理地址指定到wamp的www目录中的网站的根目录.这时候如果网站首页已经生成后访问域名将进入网站首页. 出现的问题: 1.导航( ...
- 保持url唯一性 解决多个网站首页问题
原文地址:http://www.seowhy.com/bbs/thread-2694339-1-1.html 在网站SEO优化过程中,经常会遇到这样或者那样的常见技术型问题,达闻现将此类常见技术问题总 ...
- dedecms中去除首页index.html的方法
本文介绍了dedecms中去除首页index.html的方法,有需要的朋友参考下. dedecms织梦cms建站程序输入地址后,而打开的实际地址后面有个index.html. 这里分享下两种解决方 ...
- HTML&CSS——使用DIV和CSS完成网站首页重构
1.DIV 相关的技术 Div 它是一个 html 标签,一个块级元素(单独显示一行).它单独使用没有任何意义,必须结合CSS来使用.它主要用于页面的布局. Span 它是一个 html 标签,一个内 ...
随机推荐
- 初学者使用IntellJ IDEA建立Struts2项目
1.建立项目,打开IDEA,点击File——>new project,选择Java Module,点击Next 选中Web Application,Version选中3.0,选中create w ...
- [Angular 2] @ViewChild to access Child component's method
When you want to access child component's method, you can use @ViewChild in the parent: Parent Compo ...
- javascript封装id|class|元素选择器
由于各个浏览器都支持的选择方法只有如下三种: 1 document.getElementById() 2 document.getElementsByName() 3 document.getElem ...
- Python序列的方法(转)
在快速教程中,我们了解了最基本的序列(sequence).回忆一下,序列包含有定值表(tuple)和表(list).此外,字符串(string)是一种特殊的定值表.表的元素可以更改,定值表一旦建立,其 ...
- 如何查看Android SDK源码版本
PLATFORM_VERSION := 4.2.2 位于/build/core/version_defaults.mk # # Copyright (C) 2008 The Android Open ...
- oracle 查询前一小时、一天、一个月、一年的数据
查询一小时 select concat(to_char(sysdate,'yyyy-mm-dd ')||(to_char(sysdate,'hh24')-1),':00:00') start_time ...
- linux挂载查看、添加与取消
挂载概念: 查看挂载:df 添加挂载mount:mount 挂载的源 目的点 mount /dev/sdb1 /mnt mount挂载常用参数(Option) -t 指定文件系统类型,例如:-t ex ...
- php json_decode 后,数字对象转换成了 科学计数法 的解决方案
php json_decode 后,数字对象转换成了 科学计数法 $obj='{"order_id":213477815351175,"buyer":10000 ...
- HTML&CSS基础学习笔记1.25-input标签隐藏元素
隐藏元素 有时候我们编写前端代码的时候,可能需要把一些数据告诉后台,但是这些数据又不想让用户看到,我们可以设置<input>标签的[type]属性为"hidden". ...
- python 解决递归调用栈溢出
递归函数 2578次阅读 在函数内部,可以调用其他函数.如果一个函数在内部调用自身本身,这个函数就是递归函数. 举个例子,我们来计算阶乘n! = 1 x 2 x 3 x ... x n,用函数fact ...