Home> php教程> PHP开发> body text

UCenter Home Secondary Development Guide

高洛峰
Release: 2016-12-30 16:48:05
Original
1289 people have browsed it

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

Copy after login

2. Off-site JS call

Copy after login

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('IN_UCHOME') && exit('Access Denied'); $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('blog').' ORDER BY dateline DESC LIMIT 10'); $bloglist = array(); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $bloglist[] = $value; } include template('do_demo'); ?>
    Copy after login

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

    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!

  • 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 Recommendations
      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!