search
Homephp教程PHP开发UCenter Home Secondary Development Guide

Preface
This article will focus on the core theme of secondary development of UCH, focusing on the codes of various implementations. The auxiliary part will briefly explain how to carry out secondary development for UCH. UCH will be open sourced in a while, and I will write a detailed analysis of the UCH mechanism when the time comes.

By the way, this document was written about two weeks ago, but I haven’t had time to compile and publish it. Today I heard that UCH will be open sourced in the near future. Publishing it by then will not be of much help to everyone, so I decided not to organize it anymore. Although some of the instructions in the article are not detailed yet, they have been basically written.

Data call
The data call here is to use the built-in data call of UCenter Home. There is "data call" management in the "Advanced Application" in the background. The following codes are added in the template and then called data.
1. In-site data call

<!--{template data/blocktpl/1}-->

2. Off-site JS call

<script language="javascript" type="text/javascript" src="http://www.ccvita.com/js.php?id=1"></script>

Use of block
This block data call is different from the previous data call, from the data source and In terms of generation, it is basically similar.




  • $value[subject]
  • > ;

    Use of eval
    Reasonable use of the eval syntax in the Ucenter Home template syntax will reduce secondary development in certain programs difficulty. For example:
    1. Execute PHP statements in the template through eval syntax


    2. Introduce an external PHP file through eval syntax
    Introduce external files


    Note: You can do anything you want by introducing external files into the template.

    Direct external file
    Extension of do.php
    1. First, add a new allowed method in the do.php file
    That is, in

    $acs = array ('login', 'comment', 'wall', 'register', 'lostpasswd', 'swfupload', 'inputpwd',
    'sns', 'viewspace', 'relatekw', 'ajax', 'seccode ');

    add

    $acs[] = 'demo';

    2. Then, create a new do_demo.php file in the source directory, and the calling address is do .php?ac=demo
    Although the files released by UCH are encrypted information, we can obtain valuable information for UCH secondary development from its open source files.
    For example, the /source/cron directory and the source/class_mysql.php file are all open source. We can find out some information that is very useful for secondary development of UCH, such as how to perform SQL queries. Through analysis, We can write the following file.

    < ?php
    !defined(&#39;IN_UCHOME&#39;) && exit(&#39;Access Denied&#39;);
    $query = $_SGLOBAL[&#39;db&#39;]->query(&#39;SELECT * FROM &#39;.tname(&#39;blog&#39;).&#39; ORDER BY dateline DESC LIMIT 10&#39;);
    $bloglist = array();
    while ($value = $_SGLOBAL[&#39;db&#39;]->fetch_array($query)) {
    $bloglist[] = $value;
    }
    include template(&#39;do_demo&#39;);
    ?>

    The content of the template file templates/default/do_demo.htm is

    <!--{template header}-->
    <div class="side_right">
    <div class="wide">
    <div class="post_list">
    <ul>
    <!--{loop $bloglist $value}-->
    <li>
    <div class="title">
    <h4 id="a-nbsp-href-space-php-uid-value-uid-do-blog-id-value-blogid-value-subject-a"><a href="space.php?uid=$value[uid]&do=blog&id=$value[blogid]">$value[subject]</a></h4>
    <a href="space.php?uid=$value[uid]">$value[username]</a> <span class="time"><!--{date(&#39;Y-m-d H:i&#39;,$value[dateline])}--></span>
    </div>
    <div class="status">
    <!--{if $value[viewnum]}--><a href="space.php?uid=$value[uid]&do=blog&id=$value[blogid]">$value[viewnum] 次阅读</a><span class="pipe">|</span><!--{/if}-->
    <!--{if $value[replynum]}--><a href="space.php?uid=$value[uid]&do=blog&id=$value[blogid]#comment">$value[replynum] 个评论</a><!--{else}-->没有评论<!--{/if}-->
    </div>
    </li>
    <!--{/loop}-->
    </ul>
    </div>
    </div>
    </div>
    <!--{template footer}-->

    Summary
    Although the current UCH is not open source, it is fully modifiable in the template interface and makes reasonable use of the above data calling mechanism. In this case, there are few page effects and data call requirements that we cannot achieve.

    For more articles related to UCenter Home secondary development guide, please pay attention to 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

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot 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.

    SecLists

    SecLists

    SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

    EditPlus Chinese cracked version

    EditPlus Chinese cracked version

    Small size, syntax highlighting, does not support code prompt function

    Dreamweaver Mac version

    Dreamweaver Mac version

    Visual web development tools

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    Powerful PHP integrated development environment