Briefly describe the shopex template creation process

Source: Internet
Author: User

Environment: I am using the PHP integrated environment, XAMPP 1.7.2

The PHP version is version 5.2.9.

Zendoptimizer v3.3.3

Apache2.2.11

The environment installation editor will not be outlined here

First, the file directory of the template is under the \ themes folder. First, set the config Configuration Parameter without_cache under the config file to true, and the template creation effect can be displayed in a timely manner. To create a template, you need to create a template directory folder under the file, and then the following files are required in the template directory:

Info. xml

If preview.jpg has these two files, you can view the basic information and thumbnails of the template on the background Template Selection page.

Generally, the following folders exist in the template. You can create them as needed.

Block folder, which is generally public block content, such as header and footer. In this way, our code is reused.

Border folder. This folder is mainly used to create various border styles during template creation. When selecting the border attribute. after the settings are completed in the XML file, various border styles will be listed.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4C/85/wKiom1Q_NBiyG6JCAACw4oWdBvM935.jpg "Title =" 1.png" alt = "wkiom1q_nbiyg6jcaacw4owdbvm935.jpg"/>

Image folder, which stores image resources and related JS and CSS files.

 

First, make the HTML file at the header and tail, which is usually placed in the block folder. Then, in the HTML file of the template root directory, we directly reference this part of the block file, <{header}> must be added between

Note: <{header}> and <{footer}> are the view files in the referenced core files. The header.htmland footer.html files under: \ core \ shop \ view \ commonare used.

 

When creating a template file under the template root directory, we can directly consume the files in the header and tail.

<{Requirefile = "Block/header.html"}>

<{Requirefile = "Block/footer.html"}>

 

Shopex's template creation is indispensable because its pendant mechanism is widgets. The blank section area we see in the visual editor in the background is the pendant slot. There are already many built-in pendants in shopex and we can apply them directly.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4C/86/wKioL1Q_NGnAeZcpAAIFmqpWTBI189.jpg "Title =" 1.png" alt = "wkiol1q_ngnaezcpaaifmqpwtbi189.jpg"/>

Of course, we can also make our own pendants. When the pendant is referenced in the template, the template code is written as follows:

<{Widgetsid = "usercustom"}>

 

The content in the ID is the name of this pendant.

After writing this sentence, you can see the blank section area in the visual editing. We need to add the section. If the section does not exist in the system, of course, we need to make it by ourselves at this time.

Below, let's talk about how to make a pendant.

The pendant file is stored in the \ plugins \ widgets directory. to distinguish it from the system pendant, we need to create a folder for the pendant when adding a pendant, it is recommended that you have your own prefix when naming folders.

The pendant file will contain: (In this example, the pendant folder is AD)

Widgets. php: This is the setting file for the pendant.

Processing background settings by widget_ad.php

Widget_cfg_ad.php configuration and method for some functions

Default.html this is the front-end display interface of the pendant.

_Config.html this is the selection interface that appears during background settings

 

Here we will describe the content of the widgets. php file:

<? PHP

$ Setting ['author'] = 'tina. Lil'; // producer of the pendant

$ Setting ['name'] = 'Article list'; // The Name Of The pendant.

$ Setting ['version'] = '1. 0'; // the version of the pendant.

$ Setting ['catalog '] = 'tina application'; // category of the pendant

$ Setting ['usual'] = '1 ';

$ Setting ['stime'] = '2017-10-10 '; // production time

$ Setting ['template'] = array (// template file corresponding to the pendant

'Default.html '=> 'default ',

'Default2.html '=> 'Promotion topic'

);

The name of the widget_ad.php function is described here.

Widget_ad (& $ setting, & $ System ){}

The function name is the name of the widget.

$Settinghere are some parameter settings in the _config.html template file.

 

The returned data is the content displayed on the front-end page. The returned content is in the form of an array.


By the way, after all your templates have been created, how can we install them elsewhere? We can directly click to download the template in the background.

If you have widgets and view views, you also need to package these contents.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4C/86/wKioL1Q_NWCCr_40AAGrFNkYg7A217.jpg "Title =" 1.png" alt = "wkiol1q_nwccr_40aagrfnkyg7a217.jpg"/>


This article is from the blog of "ba fei yu", please be sure to keep this source http://bafeiyu.blog.51cto.com/5401101/1564679

Briefly describe the shopex template creation process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.