vincent Publish time 2013-08-11 19:08

DISCUZ Single page production

本帖最后由 vincent 于 2013-8-16 19:06 编辑

本帖最后由 vincent 于 2013-8-14 05:24 编辑

Single page, including two files:
1. the single page PHP file demo.php
2. the single page template file demo.htm.

demo.php:<?php
define('CURSCRIPT', 'test');
require './source/class/class_core.php';
$discuz = & discuz_core::instance();
$discuz->init();
loadcache('diytemplatename');
$navtitle = 'Demo';
$metakeywords = 'Demo';
$metadescription = 'Demo';
include template('diy:forum/demo');
?>

demo.htm:<!--{template common/header}-->
<style id="diy_style" type="text/css"></style>
<div id="pt" class="bm cl">
    <div class="z">
      <a href="./" class="nvhm" title="{lang homepage}">$_G</a><em>&raquo;</em>
      <a href="forum.php">$_G</a><em>&raquo;</em>
      <a href="javascript:;">$navtitle</a>
    </div>
</div>

<div class="wp">
<!----><div id="diy2" class="area"></div><!---->
</div>


<div id="ct" class="wp cl">
    <div class="mn bm cl">
      <div class="bm_c">
      
            <p style="width:300px; margin:200px auto; text-align:center;">demo</p>
            
      </div>
    </div>
</div>

<!--{template common/footer}-->PHP file code can DIY single page content is as follows:

Find:include template('forum/demo');replace with:include template('diy:forum/demo');
The DEMO for demo.htm


demo.htm Under your template\forum


khalid Publish time 2013-08-13 18:12

Wonderful!

kaaleth Publish time 2013-08-16 15:18

Thanks. But what about header? It's switching default language to english.

vincent Publish time 2013-08-16 18:09

static/image/common/user_online.gif kaaleth static/image/common/clock.gif 2013-8-16 16:18 static/image/common/back.gif
Thanks. But what about header? It's switching default language to english.

I'm very sorry, I can't understand what you mean

demo.php   In the root directory
demo.htm   IN template\forum

vot Publish time 2013-08-16 20:08

I'm very sorry, I can't understand what you mean
Kaaleth said that the code is very good for original Discuz,
but is slightly incompatible with the ML version.

I.e. some additional localization required:...
$discuz->init();
/*vot*/      settings_localize(); // Localize Navigation & Settings
...

Pme Publish time 2014-04-27 13:08

Compatiple with x3.1?
Pages: [1]
View full version: DISCUZ Single page production