如何使用css,把div设置为一个椭圆容器,在做html页面开发时,我们一般都是使用div来做容器的,如果你需要一个椭圆形的容器,我们可以使用div来实现的,下面来看一下。......
dede织梦分类信息栏目生成wap手机版的html页
前面文章介绍过dede织梦系统实现发布栏目和发布文章后同时自动生成pc版和手机版静态内容页,这里介绍发布分类栏目页同时生产手机版栏目页。
工具/原料
- dedecms
- 已按上一篇完整版修改过代码
方法/步骤
首先创建手机版的栏目模板,这里自己创建,跟其他模板一样,不过保存路径/templets/wap/list_infos.htm和/templets/wap/index_infos.htm,详情看前面文章介绍
首先找到include目录下的arc.sglistview.class.php,修改文件前最好备份一下,找到function CountRecord
给函数加一个参数修改成function CountRecord($iswap=0)
并在函数中235行左右 if(!file_exists($tempfile))前加入代码
if($iswap==1){
$tempfile = str_replace('/'.$GLOBALS['cfg_df_style'].'/',DEDEWAPTEMPLATESPATH,$tempfile);
}
找到函数function MakeHtml
把最后面
return $murl;修改成
$reurl=$murl;
$this->MakeWapHtml($startpage, $makepagesize, $isremote);
return $reurl;
添加函数MakeWapHtml
代码如下
function MakeWapHtml($startpage=1,$makepagesize=0)
{
global $cfg_arcdir;
if(empty($startpage))
{
$startpage = 1;
}
//创建封面模板文件
if($this->TypeLink->TypeInfos['isdefault']==-1)
{
echo '这个类目是动态类目!';
return '';
}
//单独页面
else if($this->TypeLink->TypeInfos['ispart']>0)
{
$reurl = $this->MakePartTemplets();
return $reurl;
}
$this->CountRecord(1);
//初步给固定值的标记赋值
$this->ParseTempletsFirst();
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage==0)
{
$totalpage = 1;
}
CreateDir(MfTypedir($this->Fields['typedir']));
$murl = '';
if($makepagesize > 0)
{
$endpage = $startpage $makepagesize;
}
else
{
$endpage = ($totalpage 1);
}
if( $endpage >= $totalpage 1 )
{
$endpage = $totalpage 1;
}
if($endpage==1)
{
$endpage = 2;
}
for($this->PageNo=$startpage; $this->PageNo $endpage; $this->PageNo )
{
$this->ParseDMFields($this->PageNo,1);
$makeFile = $this->GetMakeFileRule($this->Fields['id'],'list',$this->Fields['typedir'],'',$this->Fields['namerule2']);
$makeFile = str_replace("{page}",$this->PageNo,$makeFile);
$murl = $makeFile;
if(!preg_match("/^\//",$makeFile))
{
$makeFile = "/".$makeFile;
}
$makeFile = $this->GetTruePath().$makeFile;
$makeFile = preg_replace("/\/{1,}/", "/", $makeFile);
$makeFile=str_replace($cfg_arcdir.'/',DEDEWAPPATH . '/',$makeFile);
$murl = $this->GetTrueUrl($murl);
$this->dtp->SaveTo($makeFile);
}
if($startpage==1)
{
//如果列表启用封面文件,复制这个文件第一页
if($this->TypeLink->TypeInfos['isdefault']==1
&& $this->TypeLink->TypeInfos['ispart']==0)
{
$onlyrule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],'',$this->Fields['namerule2']);
$onlyrule = str_replace("{page}","1",$onlyrule);
$list_1 = $this->GetTruePath().$onlyrule;
$list_1=str_replace($cfg_arcdir.'/',DEDEWAPPATH . '/',$list_1);
$murl = MfTypedir($this->Fields['typedir']).'/'.$this->Fields['defaultname'];
$indexname = $this->GetTruePath().$murl;
$indexname=str_replace($cfg_arcdir.'/',DEDEWAPPATH . '/',$indexname);
copy($list_1,$indexname);
}
}
}
找到函数function MakePartTemplets
修改最后面的代码
return $this->GetTrueUrl($makeUrl);修改成
$returl=$this->GetTrueUrl($makeUrl);
$this->MakeWapPartTemplets();
return $returl;
添加函数function MakeWapPartTemplets()
代码如下
function MakeWapPartTemplets()
{
global $cfg_df_style,$cfg_arcdir;
$this->PartView = new PartView($this->TypeID,false);
$this->PartView->SetTypeLink($this->TypeLink);
$nmfa = 0;
$tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
if($this->Fields['ispart']==1)
{
$tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']);
$tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
$tempfile = $tmpdir."/".$tempfile;
$tempfile=str_replace('/'.$GLOBALS['cfg_df_style'].'/',DEDEWAPTEMPLATESPATH,$tempfile);
if(!file_exists($tempfile))
{
$tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_default_sg.htm";
}
$this->PartView->SetTemplet($tempfile);
}
else if($this->Fields['ispart']==2)
{
//跳转网址
return $this->Fields['typedir'];
}
CreateDir(MfTypedir($this->Fields['typedir']));
$makeUrl = $this->GetMakeFileRule($this->Fields['id'],"index",MfTypedir($this->Fields['typedir']),$this->Fields['defaultname'],$this->Fields['namerule2']);
$makeUrl = preg_replace("/\/{1,}/", "/", $makeUrl);
$makeFile = $this->GetTruePath().$makeUrl;
$makeFile=str_replace($cfg_arcdir.'/',DEDEWAPPATH . '/',$makeFile);
if($nmfa==0)
{
$this->PartView->SaveToHtml($makeFile);
}
else
{
if(!file_exists($makeFile))
{
$this->PartView->SaveToHtml($makeFile);
}
}
}
注意事项
- 必须按照上一篇文章添加了模板目录和生成目录变量
- 分类文章生成静态页在上一篇完整版已完成
以上方法由办公区教程网编辑摘抄自百度经验可供大家参考!
标签: HTML
相关文章
- 详细阅读
- 详细阅读
-
HTML5创作工具,MAKA 2.0史上最全操作指南详细阅读
HTML5创作工具,MAKA 2.0史上最全操作指南,超过15000种模板组合。还怕你没有发挥的空间吗?MAKA(中文:码卡)作为中国最早推出移动端卡片式交互模式的创新者,随着HTML5技术的日渐成熟......
2023-03-16 407 HTML