Some time ago, I heard from a friend that the mobile terminal of phpcms has modules, but it is not very comfortable to use in some places. Among them, the mobile terminal column cannot be bound to templates, which is not very convenient. As shown in the figure, the templates bound to all columns are fixed. This article mainly describes how to bind templates to mobile columns in PHPCMS v9. Friends in need can take a look.
This time we will deal with how to set the corresponding template on the mobile terminal.
It is a bit false to say that setting a template here is because setting a template requires developing a lot of things. Just like the phpcms column, you can choose a template to bind by yourself. We have a simpler method here for speed and convenience.
We bind the mobile column and the PC column to the same template. Binding the same template here means binding the same template name.
phpcms PC side template path phpcms\templates\default\content The default files are these:
If your PC side column binding template rules are as follows:
Picture category_picyure.html
Beautiful pictures list_picture.html ----->Content page template show_picture.html
Handsome guy pictures list_picture.html ----->Content page template show_picture.html
Then the binding result of the mobile terminal is as follows \phpcms\templates\default\wap
Picture category_picyure.html
Beautiful Pictures list_picture. ---- & gt; Content page template show_picture.html
Handsome guy picture list_picture.html ---- & gt; content page template show_picture.html
You only need to add corresponding to the module template on the mobile terminal. Template files, mobile columns can be automatically bound.
The following are the specific code modifications
1. Because the mobile homepage template is bound to wap\index.html, no modifications are required.
2. Open \phpcms\modules\wap\index.php
In the method lists, about line 47 $template = ($TYPE[$typeid]['parentid']==0 && in_array($typeid , array_unique($parentids))) ? $WAP_SETTING['category_template'] : $WAP_SETTING['list_template']; Comment it
Then add code
/*$template = ($TYPE[$typeid][ 'parentid']==0 && in_array($typeid,array_unique($parentids))) ? $WAP_SETTING['category_template'] : $WAP_SETTING['list_template']; */
// Transform the default template of wap to use It follows the pc template rules
$setting = string2array($setting);
$template = $setting['category_template'] ? $setting['list_template'] ? $setting['list_template'] : 'list';
$template = $child ? $template : $template_list;
Re -assembled data for Catgory's templates can also use
if ($ child) {
$ cat_Str = $ Arrchildidididididididididididididid = substr ($catids_str, $pos); *', $offset.','.$pagesize,'inputtime DESC');
list = $this->db->select(array('status'=>'99','catid'=>$catid), '*', $offset.','.$pagesize,' Inputtime desc ');
}
// Re -assembled the data to end
Category and list, both of which are bound to the corresponding column template. The data is $list. You can use $list to iterate.
3. Open \phpcms\modules\wap\index.php
In the method show, about line 206 $template = $WAP_SETTING['show_template'] ? $WAP_SETTING['show_template'] : 'show '; Comment it
//$template = $WAP_SETTING['show_template'] ? $WAP_SETTING['show_template'] : 'show';
//Processing template calls
$template = $CAT[ 'setting']['show_template'] ? $CAT['setting']['show_template'] : 'show';
ok In this way, the mobile terminal of phpcms is processed!
Related tutorials:
PHP video tutorial
The above is the detailed content of How to bind templates to mobile columns in PHPCMS v9. For more information, please follow other related articles on the PHP Chinese website!