phpcmsv9 给url规则添加可用更多自定义可用变量
在phpcms根目录下边的 phpcms\modules\content\classes\url.class.php 中修改以下片段:
$categorydir = $this->get_categorydir($catid);
$catdir = $category['catdir'];
$year = date('Y',$time);
$month = date('m',$time);
$day = date('d',$time);
$hour = date('H',$time);
$minute = date('i',$time);
$second = date('s',$time);
$urls = str_replace(array('{$categorydir}','{$catdir}','{$year}','{$month}','{$day}','{$hour}','{$minute}',
'{$second}','{$catid}','{$id}','{$page}'),
array($categorydir,$catdir,$year,$month,$day,$hour,$minute,$second,$catid,$id,$page),$urlrule);
到此ok了!
在phpcms\modules\admin\templates 路径下,找urlrule_add.tpl.php 和urlrule_edit.tpl.php 文件,添加所增加的自定义变量~
替换下面
<?php echo L('year');?>:<input type="text" name="f1" value="{$year}" size="7" class="input-botton"> <?php echo L('month');?>:<input type="text" name="f1" value="{$month}" size="9" class="input-botton">,<?php echo L('day');?>:<input type="text" name="f1" value="{$day}" size="7" class="input-botton"> ID:<input type="text" name="f1" value="{$id}" size="4" class="input-botton">, <?php echo L('paging');?>:<input type="text" name="f1" value="{$page}" size="7" class="input-botton"> 为<?php echo L('year');?>:<input type="text" name="f1" value="{$year}" size="7" class="input-botton"> <?php echo L('month');?>:<input type="text" name="f1" value="{$month}" size="9" class="input-botton">,<?php echo L('day');?>:<input type="text" name="f1" value="{$day}" size="7" class="input-botton"> 时:<input type="text" name="f1" value="{$hour}" size="7" class="input-botton"> 分:<input type="text" name="f1" value="{$minute}" size="8" class="input-botton"> 秒:<input type="text" name="f1" value="{$second}" size="8" class="input-botton"> ID:<input type="text" name="f1" value="{$id}" size="4" class="input-botton">, <?php echo L('paging');?>:<input type="text" name="f1" value="{$page}" size="7" class="input-botton">