Home > CMS Tutorial > DEDECMS > How to call the template header and bottom of the DreamWeaver message board

How to call the template header and bottom of the DreamWeaver message board

藏色散人
Release: 2020-01-10 09:04:41
Original
3175 people have browsed it

How to call the template header and bottom of the DreamWeaver message board

How to call the header and bottom of the template in the DEDECMS message board?

The header and bottom of the template in the DEDECMS message board Method

Recommended learning: 梦Weavercms

As we all know, DEDE’s message board is independent and does not look very beautiful. Many people want to implement dede tag calling in guestbook.htm. The problem is that dede tags are not supported in plus. It is very troublesome to modify the message board to be consistent with other pages, because many of the original calls cannot be used. Here are two simple methods of calling the unified header and bottom templates of the website: one is to customize Mark the tag with a macro and then call it with JS; the other method is to use PHP to call the original template.

Method 1: Add a tag marked with head in the custom tag, and use JS to call the tag: (Key recommendation method 1)

Step 1: Click "Auto" in "Template" Define macro tag";

Step 2: Add a new macro tag and fill in {dede:include filename="head.htm"/};

Step 3: Save The tag returns to the custom tag list. Click JS call to get the JS call code:

<script src=&#39;/plus/mytag_js.php?aid=1&#39; language=&#39;javascript&#39;></script>
Copy after login

This JS code is equivalent to {dede:include filename="head.htm"/} in an ordinary document. We use This js call code is enough. Paste it to the location of /templets/plus/guestbook.htm where you want to call the message board header file.

Step 4: In the same way, the method of calling the template at the bottom of the message board is the same.

Method 2: How to call the original template in php

Step one: Open "/include/common.func.php"

Then add a Function, the code is as follows:

function pasterTempletDiy($path)
{
require_once(DEDEINC."/arc.partview.class.php");
global $cfg_basedir,$cfg_templets_dir;
$tmpfile = $cfg_basedir.$cfg_templets_dir."/".$path;//模版文件的路径
$dtp = new PartView();
$dtp->SetTemplet($tmpfile);
$dtp->Display();
}
Copy after login

The second step is to open the guestbook template file. The default is /templets/plus/guestbook.htm

Replace the original calling header code with the following code :

<?php 
pasterTempletDiy("default/head.htm"); 
?>
Copy after login

The default here is the default template path. If you use other templates, be careful to modify the default here.

Similarly, replace the bottom code of the reason call with the following code:

<?php 
pasterTempletDiy("default/footer.htm"); 
?>
Copy after login

In this way, you can directly use the system's head and footer templates!

The above is the detailed content of How to call the template header and bottom of the DreamWeaver message board. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template