Heim  >  Artikel  >  Backend-Entwicklung  >  typecho前后端分离?

typecho前后端分离?

WBOY
WBOYOriginal
2016-09-06 08:57:071474Durchsuche

typecho的前后端感觉没有做到分离,比如这些代码,

<code><?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>

    <div class="col-mb-12 col-8" id="main" role="main">
        <h3 class="archive-title">
<?php $this->archiveTitle(array(
            'category'  =>  _t('分类 %s 下的文章'),
            'search'    =>  _t('包含关键字 %s 的文章'),
            'tag'       =>  _t('标签 %s 下的文章'),
            'author'    =>  _t('%s 发布的文章')
        ), '', ''); ?></h3>
        <?php if ($this->have()): ?>
        <?php while($this->next()): ?>
            <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
                <h2 class="post-title" itemprop="name headline"><a itemtype="url" href="<?php%20%24this->permalink()%20?>"><?php $this->title() ?></a></h2>
                <ul class="post-meta">
                    <li itemprop="author" itemscope itemtype="http://schema.org/Person">
<?php _e('作者: '); ?><a itemprop="name" href="<?php%20%24this->author->permalink();%20?>" rel="author"><?php $this->author(); ?></a>
</li>
                    <li>
<?php _e('时间: '); ?><time datetime="<?php $this->date('c'); ?>" itemprop="datePublished"><?php $this->date('F j, Y'); ?></time>
</li>
                    <li>
<?php _e('分类: '); ?><?php $this->category(','); ?></li>
                    <li itemprop="interactionCount"><a href="<?php%20%24this->permalink()%20?>#comments"><?php $this->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a></li>
                </ul>
                <div class="post-content" itemprop="articleBody">
                    <?php $this->content('- 阅读剩余部分 -'); ?>
                </div>
            </article>
        <?php endwhile; ?>
        <?php else: ?>
            <article class="post">
                <h2 class="post-title"><?php _e('没有找到内容'); ?></h2>
            </article>
        <?php endif; ?>

        <?php $this->pageNav('« 前一页', '后一页 »'); ?>
    </div>
<!-- end #main -->

    <?php $this->need('sidebar.php'); ?>
    <?php $this->need('footer.php'); ?>
</code>

那有没有什么方法能做到前后端的分离呢。

回复内容:

typecho的前后端感觉没有做到分离,比如这些代码,

<code><?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>

    <div class="col-mb-12 col-8" id="main" role="main">
        <h3 class="archive-title">
<?php $this->archiveTitle(array(
            'category'  =>  _t('分类 %s 下的文章'),
            'search'    =>  _t('包含关键字 %s 的文章'),
            'tag'       =>  _t('标签 %s 下的文章'),
            'author'    =>  _t('%s 发布的文章')
        ), '', ''); ?></h3>
        <?php if ($this->have()): ?>
        <?php while($this->next()): ?>
            <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
                <h2 class="post-title" itemprop="name headline"><a itemtype="url" href="<?php%20%24this->permalink()%20?>"><?php $this->title() ?></a></h2>
                <ul class="post-meta">
                    <li itemprop="author" itemscope itemtype="http://schema.org/Person">
<?php _e('作者: '); ?><a itemprop="name" href="<?php%20%24this->author->permalink();%20?>" rel="author"><?php $this->author(); ?></a>
</li>
                    <li>
<?php _e('时间: '); ?><time datetime="<?php $this->date('c'); ?>" itemprop="datePublished"><?php $this->date('F j, Y'); ?></time>
</li>
                    <li>
<?php _e('分类: '); ?><?php $this->category(','); ?></li>
                    <li itemprop="interactionCount"><a href="<?php%20%24this->permalink()%20?>#comments"><?php $this->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a></li>
                </ul>
                <div class="post-content" itemprop="articleBody">
                    <?php $this->content('- 阅读剩余部分 -'); ?>
                </div>
            </article>
        <?php endwhile; ?>
        <?php else: ?>
            <article class="post">
                <h2 class="post-title"><?php _e('没有找到内容'); ?></h2>
            </article>
        <?php endif; ?>

        <?php $this->pageNav('« 前一页', '后一页 »'); ?>
    </div>
<!-- end #main -->

    <?php $this->need('sidebar.php'); ?>
    <?php $this->need('footer.php'); ?>
</code>

那有没有什么方法能做到前后端的分离呢。

这种就是类似于wordpress那样的混写 这样方便一键更换主题啊,而且每个模块都是独立显示出来的 就算套模板也很快啊,而且typecho有大概两年没更新了

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn