修改dedecms 织梦系统 生成静态页面栏目缓存文件路径

 更新时间:2016年11月25日 15:57  点击:1672

修改dedecms 织梦系统 生成静态页面栏目缓存文件路径
由于dedecms 生成频道栏目,要生成一个临时mkall_cache_{adminid}.php教程文件,这对网站做安全会有一定的影响,特别我现在是把我整个网站限制不能上传php,js文件,为了方便起见,今天我就来拿我修改过程记录下来与各位分享吧。
首页我们找到dedecms  的后台管理上当默认是在dede/目录。

找到文件:
makehtml_all.php
找到73行,

//$mkcachefile = DEDEROOT."/data/mkall_cache_{$adminID}.php";
改成你的站外目录如
$mkcachefile = "s:/s/data/mkall_cache_{$adminID}.php";

这是要写缓存文件的,就是把你更新的目录ID保存到一个数组里

再找到147行

//$mkcachefile = DEDEDATA."/mkall_cache_{$adminID}.php";
$mkcachefile = "s:/s/data/mkall_cache_{$adminID}.php";

好了,保存文件,我们再在当前上当找到

makehtml_list_action.php

找到第37行
//$mkcachefile = DEDEROOT."/data/mkall_cache_{$adminID}.php";
$mkcachefile = "s:/s/data/mkall_cache_{$adminID}.php";

保存上传就OK了。

本文章原创于www.111cn.net 转载注明出处

标签是给Smarty的指令符,以模板定界符包住。这些指令符可以是变量,以$符号代表函数、逻辑 或 流程控制 语法。Smarty 允许 PHP 程式设计师以Smarty 标签去定义可存取的函数

smarty 模板if else使用实例与入门教程
smarty 主要功能是完成美工与程序分离,并且使用的缓存技术,减轻服务器的负载,
smarty 以在文件中放置特殊的“Smarty标签”来产生网页内容。这些标签会被处理并替换成其他的内容。

 

*/

require('smarty/libs/Smarty.class.php教程');

$tpl = new Smarty();
$tpl->template_dir   = 'd/'
$tpl->compile_dir    = 'd/template_c';

$tpl->compile_check   = false;//$cfg['debug'];
$tpl->debugging      = false;
$tpl->caching       = false;
$tpl->cache_lifetime  = 3600;

$tpl->left_delimiter  = '<!--{';
$tpl->right_delimiter  = '}-->';

$array = 'www.111cn.net'
$tpl->assign('dataList', $array);
$tpl->display('a.tpl');

/*
a.tpl
<!--{if $dataList =='www.111cn.net'}-->
 <!--{$dataList}-->
<!--{else}-->
 echo 'aaa';
<!--{/if}-->

还有另一种方法

{if $name eq 'Fred'}
    Welcome Sir.
{elseif $name eq 'Wilma'}
    Welcome Ma'am.
{else}
    Welcome, whatever you are.
{/if}

{* an example with "or" logic *}
{if $name eq 'Fred' or $name eq 'Wilma'}
   ...
{/if}

本文章原创于www.111cn.net转载注明出处

<?php教程
class resizeimage
{
    //图片类型
    var $type;
    //实际宽度
    var $width;
    //实际高度
    var $height;
    //改变后的宽度
    var $resize_width;
    //改变后的高度
    var $resize_height;
    //是否裁图
    var $cut;
    //源图象
    var $srcimg;
    //目标图象地址
    var $dstimg;
    //临时创建的图象
    var $im;
    function resizeimage($img, $wid, $hei,$c,$dstpath)
    {
        $this->srcimg = $img;
        $this->resize_width = $wid;
        $this->resize_height = $hei;
        $this->cut = $c;
        //图片的类型
        $this->type = strtolower(substr(strrchr($this->srcimg,"."),1));
        //初始化图象
        $this->initi_img();
        //目标图象地址
        $this -> dst_img($dstpath);
        //--
        $this->width = imagesx($this->im);
        $this->height = imagesy($this->im);
        //生成图象
        $this->newimg();
        ImageDestroy ($this->im);
    }
    function newimg()
    {
        //改变后的图象的比例
        $resize_ratio = ($this->resize_width)/($this->resize_height);
        //实际图象的比例
        $ratio = ($this->width)/($this->height);
        if(($this->cut)=="1")
        //裁图
        {
            if($ratio>=$resize_ratio)
            //高度优先
            {
                $newimg = imagecreatetruecolor($this->resize_width,$this->resize_height);
                imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width,$this->resize_height, (($this->height)*$resize_ratio), $this->height);
                ImageJpeg ($newimg,$this->dstimg);
            }
            if($ratio<$resize_ratio)
            //宽度优先
            {
                $newimg = imagecreatetruecolor($this->resize_width,$this->resize_height);
                imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, $this->resize_height, $this->width, (($this->width)/$resize_ratio));
                ImageJpeg ($newimg,$this->dstimg);
            }
        }
        else
        //不裁图
        {
            if($ratio>=$resize_ratio)
            {
                $newimg = imagecreatetruecolor($this->resize_width,($this->resize_width)/$ratio);
                imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, ($this->resize_width)/$ratio, $this->width, $this->height);
                ImageJpeg ($newimg,$this->dstimg);
            }
            if($ratio<$resize_ratio)
            {
                $newimg = imagecreatetruecolor(($this->resize_height)*$ratio,$this->resize_height);
                imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, ($this->resize_height)*$ratio, $this->resize_height, $this->width, $this->height);
                ImageJpeg ($newimg,$this->dstimg);
            }
        }
    }
    //初始化图象
    function initi_img()
    {
        if($this->type=="jpg")
        {
            $this->im = imagecreatefromjpeg($this->srcimg);
        }
        if($this->type=="gif")
        {
            $this->im = imagecreatefromgif($this->srcimg);
        }
        if($this->type=="png")
        {
            $this->im = imagecreatefrompng($this->srcimg);
        }
    }
    //图象目标地址
    function dst_img($dstpath)
    {
        $full_length  = strlen($this->srcimg);
        $type_length  = strlen($this->type);
        $name_length  = $full_length-$type_length;
        $name         = substr($this->srcimg,0,$name_length-1);
        $this->dstimg = $dstpath;
//echo $this->dstimg;
    }
}
$resizeimage = new resizeimage("1.jpg", "200", "150", "1","2.jpg");
?>

传值方法很多,
参数传值: 可以是urs.php?id=1带参数形式,这是页面之间比较主要的传值方式 ,用request,get 接收值.
from表单传值 : 主要接收request传值 post, get  来接收,from标签可以选择get或者post 通过url传值的是get 还可以利用ajax传值可以选择post或者get.

session传值 : 这个一般是做用户登陆时用的,服务器全局变量,一般不用在页面之前的传值
cookie传值 :把内容保存在客户端,

我们常用的页面传值主要是参数传值  from表单传值传值。

现在来做几个实例
*/
//先用页面参数传值实例

?>

<a href="b.php?action=1">点击我</a>
//输出值为 1

用form传值

<form action="b.php" method="get"> 

<input name="action" type="text" value="5">

<input type="submit" value="submit" /> 

</form>

得出值 5

<form action="b.php" method="POST"> 

<input name="action" type="text" value="5">

<input type="submit" value="submit" /> 

</form>


<?
if( $_GET )
{
 echo 'get传值',$_GET['action'];
}
else
{
 echo 'post传值', $_POST['action'];
}
//本文章原创于www.111cn.net 中国WEB第一站,,转载注明出处

if( $_POST )
{

 $str = '23=12,34  78=1,3 45=12,46,78,89=33'; 

 $content=nl2br($str); 

 $content=str_replace(" ","",$content); 

 $arr=explode("<br/>",$content); 

 $result=array(); 

 foreach ($arr as $value) 

 { 

$k=explode("=",$value); 

 $result[]=array($k[0]=>$k[1]); 

 } 

 //数组转换成字串 

 function arrayeval($array, $level = 0) { 

  $space = ''; 

  for($i = 0; $i <= $level; $i++) { 

  $space .= " "; 

  } 

 $evaluate = "Array $space( "; 

  $comma = $space; 

  foreach($array as $key => $val) { 

   $key = is_string($key) ? '''.addcslashes($key, ''\').''' : $key; 

   $val = !is_array($val) && (!preg_match("/^-?d+$/", $val) || strlen($val) > 12 || substr($val, 0, 1)=='0') ? '''.addcslashes($val, ''\').''' : $val; 

   if(is_array($val)) { 

    $evaluate .= "$comma$key => ".arrayeval($val, $level + 1); 

  } else { 

    $evaluate .= "$comma$key => $val"; 

   } 

   $comma = ", $space"; 

  } 

 $evaluate .= " $space)"; 

  return $evaluate; 

 } 

//把结果写到文件 

 $config=arrayeval($result); 

 $strwrite="<?php ".'$'.'shuzu'.'='.$config." ?>"; 

 $fp=fopen('config.php','w'); 

 fwrite($fp,$strwrite); 

 fclose($fp); 
 }

 ?>

<form action="b.php?action=5" method="get"> 

<textarea name="content"></textarea> 

<input type="submit" value="submit" /> 

</form>

[!--infotagslink--]

相关文章

  • apache .htaccess 伪静态页

    apache .htaccess 伪静态页 静态页的地址: http://211.166.45.10/company/new/new_10000.html 指定的动态地址:php?id=10000">http://211.166.45.10/company/new.php?id=...2016-01-28
  • 百万数据级的网站静态页面的生成方案

    传统的生成静态页面的方法大家都很清楚,无非就是以下两种: 方案一: 1、每增加/修改一个栏目的信息的时候,就生成一次该栏目(包括父栏目)的页面; 2、每增加/修改一...2016-09-20
  • C#生成单页静态页简单实例

    这篇文章主要介绍了C#生成单页静态页简单实例,是一个非常实用的技巧,需要的朋友可以参考下...2020-06-25
  • dedecms 软件批量增加描述连接方法

    mysql教程_connect('localhost','root','root') or die('database connect failer'); mysql_select_db('m'); mysql_query("set Names 'gb2312'"); $sql = "Select...2016-11-25
  • 使用PHP实现生成HTML静态页面

    从PHP生成HTML静态页面并存储到以年份和月份为名称创建的目录。读取全部数据批量生成,全部生成后弹出提示。可指定批次生成数量,建议不超过800,否则执行速度会有问题。(出于众所周知的原因,涉及到数据库的数据字段名称做了...2015-11-24
  • php定时自动生成html静态页面

    php定时自动生成html静态页面 "ob_start()、ob_end_clean()、ob_get_contents()" ob_start():是打开缓冲区的,就是要把您需要生成的静态文件的内容缓存在这里; ob_g...2016-11-25
  • 谈PHP生成静态页面

    一、引 言 在速度上,静态页面要比动态页面的比方php快很多,这是毫无疑问的,但是由于静态页面的灵活性较差,假如不借助数据库或其他的设备保存相关信息的话,整体的治...2016-11-25
  • uchome模板缓存文件存放位置

    uchome模板缓存文件存放位置 /data/tpl_cache/ 删除对应的缓存的php文件,重新刷新页面,系统会再生成一个缓存的php页面 这样可以不用去后台更新缓存了...2013-06-05
  • php ajax仿dedecms 验证新闻是否存在

    本教程是一款利用了php ajax无刷新验证用户输入的新闻标题是否己经存在了数据库中,如果是返回0否则就返回1 代码如下 复制代码 <tr> <td a...2016-11-25
  • 仿dedecms顶评[顶,踩]功能源码下载

    仿dedecms顶评[顶,踩]功能源码下载 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>...2016-11-25
  • dedecms函数分享之获取某一栏目所有子栏目

    以前从来没写过递归(其实想想,对算法完全没概念),刚好有这个需求,试着写了一下,发现也挺容易的,特别记录一下。数据库是dedecms默认的,dede_arctype是保存栏目的表,reid是栏目的父级栏目id。复制代码 代码如下:$array = array(...2014-05-31
  • php生成静态页面程序与原理分析

    生成静态页面是php中来减少服务器负载与seo网站优化一个不错的选择,所以php生成静态页面功能是几乎所有php程序员必须了解并掌握的一个知识点,下面我来给大家介绍php生...2016-11-25
  • php生成静态页面代码

    本款生成静态页面程序实现原理是做好自定的模板标签,然后由str_replace把标签替换成指定的内容,再由fopen生成指定 文件名的静态页面,这样就OK了。 代码如下...2016-11-25
  • php 生成静态页面类,利用ob_start ob_get_content 函数简单实用

    class CreateHtml{ /*function mkdir($prefix= 'article' ){ $y = date('Y'); $m = date('m'); $d = date('d'); $p=DIRECTORY_SEPARATOR; $filePath...2016-11-25
  • php缓存文件技术介绍

    下面总结了三种缓存文件方法,一种是nginx下的缓存fastcgi_cache和proxy_cache,一种利用memcache缓存,另一种是利用php文件缓存哦。 nginx有两种缓存机制:fastcgi_ca...2016-11-25
  • php+jquery在线切图代码[仿dedecms]

    php+jquery在线切图代码[防dedecms] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"...2016-11-25
  • asp.net(C#)禁止缓存文件不让文件缓存到客户端

    IIS会按文件地址及参数将文件缓存到客户端,以便再次访问该内容时速度更快,下面为大家介绍C#禁止缓存文件的方法...2021-09-22
  • 用Apache的rewrite生成伪静态页面

    我们知道,搜索引擎是偏爱静态页面的,因此,把诸如:http://www.jianglb.com/?p=123的页面改成http://www.jianglb.com/apaeche-rewrite.html显然有利于被搜索. 但是,如果一...2016-01-28
  • asp.net实现生成静态页并添加链接的方法

    这篇文章主要介绍了asp.net实现生成静态页并添加链接的方法,非常实用的功能,需要的朋友可以参考下...2021-09-22
  • PHP生成静态页面类

    <?php date_default_timezone_set( "Asia/Shanghai"); class TCreateHTML{ var $HTemplate; //模板的文件 var $FileName; //新文件名称 var $HTFilePath;//...2016-11-25