search
HomeCMS TutorialDEDECMSHow to let dedecms implement shtml

How to let dedecms implement shtml

Dec 07, 2019 am 10:50 AM
dedecms

How to let dedecms implement shtml

How to let dedecms implement shtml?

Let dedecms implement shtml inclusion. This is a very simple and easy problem. We can realize the top navigation, middle part, public part on the right, and bottom of dedecms through the secondary development of dedecms

Recommended learning: 梦Weavercms

Let dedecms implement shtml inclusion. This is a very simple and easy problem. We can achieve good support for the top navigation, middle part, right public part, and bottom of dedecms through secondary development of dedecms, thereby reducing the frequent consumption of system resources when generating html to generate dedecms html. Function. This can speed up how dedecms generates HTML.

First we need to implement shtml inclusion on the right side of the dedecms column. Regarding the dedecms configuration of the shtml environment, the previous article has described it.

1: First create the right public template templates/default/right.htm

2: Write the following tags

The code is as follows:

function lib_shtml(&$ctag,&$refObj)
{
if(isset($_GET['tid'])){
return file_get_contents('../data/'.$refObj->Fields['id'].'right.htm');
}else{
return &#39;<!--#include virtual="&#39;.$GLOBALS[&#39;cfg_cmspath&#39;].&#39;/data/&#39;.$refObj->Fields[&#39;id&#39;].&#39;right.htm"-->&#39;;
}
}

3:Generate When creating a column, the right side of the corresponding column is generated.

   arc.listview.class.php

The code is as follows:

var $tcp1;
var $tcp3;</p> <p> $this->tcp1 = new DedeTagParse();
$this->tcp1->SetRefObj($this);
$this->tcp1->SetNameSpace("dede", "{", "}");

Load the right.htm template

  $this->tcp1->LoadTemplate($GLOBALS[&#39;cfg_basedir&#39;].$GLOBALS[&#39;cfg_templets_dir&#39;]."/".$GLOBALS[&#39;cfg_df_style&#39;]."/right.htm");

Generate html

   $file = $this->Fields[&#39;id&#39;].&#39;right.htm&#39;;
            $rightfile = $GLOBALS[&#39;cfg_basedir&#39;].$GLOBALS[&#39;cfg_cmspath&#39;]."/data/".$file;
           
            if(!file_exists($rightfile)){
                $this->tcp1->SaveTo($rightfile);
           
            }else{
                if((time()-filectime($rightfile))>3600){
                    $this->tcp1->SaveTo($rightfile);
                }
            }

Assign a value to the template

     MakeOneTag($this->tcp1,$this);

4: Directly call {dede:shtml/}

in the template to generate background, and then let dedecms implement shtml inclusion.

The above is the detailed content of How to let dedecms implement shtml. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft