Ectouch Tenth Ecshop in the DWT, LBI file detailed

Source: Internet
Author: User

Original: http://www.yunmoban.cn/article-241.html

Ecshop includes folders such as admin, API, cert, data, images, includes, JS, languages, plugins, temp, theme, WAP, widgets, and all. php files under the root directory. These files and folders make up the entire ecshop. If you analyze ecshop from a software engineering perspective, the Ecshop level two can be viewed as admin and two parts of the front desk. The admin is primarily service-oriented, and the foreground is client-facing, which is the most obvious difference between the two parts. The following is a two-level flowchart for Ecshop:

This level two flowchart gives a relationship between the admin module, the foreground display module, and the database module. As can be seen from the above diagram, the admin module to read and write to the database, where the reading and writing constitute the entire backstage management, including the increase and deletion of goods, message management, order processing and so on. Front-desk module also to read and write to the database, its reading and writing is mainly to complete the transaction process, the content is basically written with the number of goods, click on the number of these in the commodity trade must change the number. In the admin module can also write to the foreground display section, this writing process is mainly to complete the foreground display mode changes, such as the admin module can choose template, also can change each small module in a page display, as well as display location (if displayed).

About DWT files and LBI files

1,DWT files are page template files (Dreamweaver template), when you create multiple pages of a Web site, you can often create a common part of a Web page as a template, and then call multiple pages to make the page code reusable. When you make a template, you can customize the template editable regions and non-editable regions, and the editable regions will populate the code again in the page that invokes the template.

2,lbi library files when a library file in Dreamweaver whether it is a DWT, a library file, or a code snippet is placed in a template file that can be reused and then used in a place called, their difference is DWT is to save multiple duplicate modules in different locations into a DWT file and reuse it, LBI is to save a module as a library file

3, how to build DWT file in DW file-new, New document-blank page-html template-then Ctrl+s (if you do not have a site, select the. DWT in the Save type)

4. Create a LBI file, CTRL + N (new)---a blank page---the library item and then save it to the library path, or redesign the page to select the section to save as a library item select Modify-Library-add objects to the library or drag the selected section directly into the library

Images folder:

This folder has subfolders under which the original images and thumbnails of the current site's products are stored under these subfolders. These subfolders are named regularly, and their filenames are the year in which the item was added to their directory. That is, in the same month to add products, their pictures are in the same folder, and the name of this folder is the current year and month. In the background each add a picture of the product, this side will be in a folder under the submission of a copy of the picture.

Data folder:

This folder includes some fixed data, such as fixed configurations, images, and so on. In the data this folder config.php record some fixed information of the database, afficheimg folder to store the first page of the most middle flash image source. The implementation of the Afficheimg folder to load the picture into the first page of the Flash is through the folder Flashdata the following folder Dynfocus JavaScript in the implementation. Folder Brandlogo Store the logo of the company that has the brand, and the background image of the CAPTCHA under the other folder.

Theme folder:

The display of the page is theme this folder is entirely responsible. And how are these prepared data displayed in the theme. DWT? The data is loaded through Smarty. In each. php file in the root directory there will be similar $smarty->assign (' Page_title ', $position [' title ']); Such a sentence, so Page_ The title can be used as a variable in the corresponding DWT file. This will be a very good combination of PHP file very dwt file.

Here's a little bit about the DWT file. Most of the information in this file is generated automatically. In the DWT file will see such a block, which is quickly used to determine the location of each module display, if a module selection in the background display in the "left area", then the code of this module will be generated in the above area. Of course, in the DWT file we will also see everywhere the code is automatically generated, to change it can only be the. lbi file. There is no direct editing of the code between the two flags before it appears, and the code to add to it must be inserted before the next beginlibraryitem.

Program:

The program consists of all of the PHP scripts, includes,js folders, in the root directory (which is said about the foreground), all of which complete the data preparation for the foreground display. So they are very important in the structure of the whole ecshop, and the changes to Ecshop are mainly focused on these scripts, and the specific analysis of these scripts is given in the late one by one.

In the previous article, we have brought the overall framework of ecshop. From the overall view of the ecshop, I believe that everyone's thinking should be very clear. As a modification to the open source project you, can have a preliminary understanding of the ecshop, I will give you the following I am in the process of revising ecshop some experience.

Remember that in the previous article we talked about Adobe's templates. Let's talk about the template according to Ecshop. When it comes to templates, this is the main file that the Ecshop front desk displays, and if you can understand theme template files and style sheet files, there should be no problem with the Ecshop foreground display. How is the page in Ecshop displayed? Let's put aside this question first, let's look at how Ecshop is reading a series of data from the database and uploading it to the display page. To solve this problem we need to use the index.php under the root directory and the INDEX.DWT under Theme/default as use cases. The corresponding two folders are used because the data to be displayed in INDEX.DWT is loaded through Smarty from the index.php. The following code is in the index.php:

Page title  Current position

First it is called the function assign_ur_here, so that the variable $position, in the variable $position has the title and Ur_here these two variables. The following code will be in the INDEX.DWT:

<title>{$page _title}<title>

Yes, once $smarty->assign (' Page_title ', $position [' title ') is executed, the $page _title becomes a variable that can be used in INDEX.DWT. So far we know how to pass the variables we need from the PHP script to the DWT file. Smarty is the mechanism by which the content that needs to be displayed is uploaded to the corresponding DWT file, thus separating the page from the content. The data in the PHP script is already available in the DWT file, and the following is how to display the data. The variables that are loaded into the DWT file by Smarty are displayed with {} when displayed. If an array is loaded then it is shown by the Smarty loop, and if I pass in an array that is $school and has name in each entry in the array, the following code is the name of each entry that implements the array to display in the page.

Foreach ($school as $k) {echo $k [' name ']. ‘ ’; }

This will print out all the contents of the array in the page.

Let's give an example to illustrate how the DWT is displayed.

Write Smarty->assign (' Test ', ' This is just a test! ') somewhere in the index.php;

Then write {$test} somewhere in the INDEX.DWT, and there will be "this is a test!" in the home page. Of course it shows where it's related to where you put {$test}. Of course, this position is a rule, the DWT is not any place can be edited, some places are not moving, these we will be in the back of one by one to explain. At this time if you do not appear in your home page "This is a test!" This content, then you also do not worry, because the default cache in the Ecshop is open, can not display the cache is definitely the problem, this we will also give explanations. Today we are discussing how to transfer parameters and parameters to a DWT. The next one will explain the above-mentioned problems, Thanks.

Hello everyone, today we will solve the problem left over from the last. The last time we talked about how to transfer parameters from a PHP script to a DWT template, we left two questions, the first is that some places in the DWT are not editable, and the second is to pass parameters to the DWT and let it show, it doesn't necessarily show up.

First of all, let's discuss the first question-why there are places where you can't edit. We analyzed the cause of the problem by discussing INDEX.DWT. In the index.dwt we will see a lot of shapes like

Such a statement. If you have a little knowledge of the backstage management of the ecshop, the words "left area" should be familiar to the people! Yes, in the background template management--settings template you will see the following picture

On the surface, it should be known that the "Commodity Classification tree" is displayed in the middle area of the entire page. So why in the background to re-select and OK, the page display will follow your choice to display it? The essence of it is this, each of the above modules is corresponding to a library file (that is, theme under the library under the LBi file), when you put the above these according to your layout settings and click OK, The program will write the contents of each LBI file to the INDEX.DWT according to your layout's choice, so where does the content in the LBi file go?

This sentence will play a role, such as the above "sales ranking" is the right area of choice, then when you are sure, the program will be index.dwt rewrite one side, where "sales" corresponding to the The contents of LBI (that is, TOP10.LBI) are fully read and written to INDEX.DWT and between. So this time you may have a question, if there is a lot of content to go to the right area to write, which first write it? There is a "serial number" in the diagram above, which is the order in which you decide to write. Here is a snippet of code between and in the index.dwt file after writing:

class class class class= "Top10list" > <ul>  <li>$smarty. Foreach.top_goods.iteration}.gif "> <a title=" {$goods. Name|escape: HTML} "href=" {$goods. URL} ">{$goods .short_name}a>  class=" Blank5 ">div>

OK, here I believe you should know a lot, then why in the index.dwt some of the places are not editable. People think of the above code is from which side, right, is read from the Top10.lbi, and then write here, if you edit here, and then the next time re-layout, the content is not to be rewritten out of it! So in index.dwt similar and between the content is dynamically generated, is not editable, if you really want to edit this side of the content, then edit the corresponding LBI file.

I believe you already know why some parts of DWT files are not editable. So today we'll talk about this, and next time we'll look at the cache problem. I feel this is a headache (if you add a session yourself).

The last time we discussed the problem of the template, we left a question--cache. I think this problem should not be discussed in the present position, and then we will analyze the problem. By now we know some of the template's operations, but we are still depressed because we are only under the control of the Ecshop's foreground frame. So how can we get out of it? If we can do our own to add to their own or can put the things we want to put the template, then it should be a higher step to see Ecshop.

To be able to add a template, you must do the foreground can display the template, the background can edit the template. Let's step-by-step to teach you how to add a template that belongs to you. Before we add a little bit of analysis, to a template, in the foreground must have a PHP file and it corresponds (it is obvious that this PHP file is implemented to the template file to transfer data). And in the background can edit the template for the module, that is, in the template management-set the template has the template you add options. Let's add a home template below. Start by creating new HOME.DWT and home.php in the root directory. The contents of INDEX.DWT and index.php are then copied to HOME.DWT and home.php respectively. The content of this template is entirely up to you, and your content will determine how you want to modify HOME.DWT and home.php. Of course, the content of this template is limited, first of all, the Home Template candidate library files are present. What does this mean? This means that for each template file, the library files that can be called are fixed, and the library files that can be called are defined in the file admin/includes/lib_templete.php. First of all in the background to put home this template into the template can be set content, some of the code is as follows:

/ * You can set the template for content */$template _files = Array (' home.dwt ', ' index.dwt ', ' zhiku.dwt ', ' article.dwt ', ' article_cat.dwt ') , ' brand.dwt ', ' category.dwt ', ' user_clips.dwt ', ' compare.dwt ', ' gallery.dwt ',

The

adds home.dwt to the editable template in the background in the code above, so that you can edit the home template in the template management settings template in the background. But here we find a very small problem, that is the home template in the background is displayed in what name. In fact this is very simple, as long as the file language/zh_cn/admin/template.php add $_lang[' template_files ' [' home '] = ' home template '; Then the name of the home template you see in the background is the "home template", and of course it can be set to another name. In the above we have said that each template can be called the library file is fixed, since it is fixed, which should be? Take index for example, in the file admin/includes/lib_templete.php has the following code:

 ' index ' = = Array ('/library/ur_here.lbi ' = + 0, '/library/search_form.lbi ' = + 0, '/library/member.lbi ' = > 0, '/library/new_articles.lbi ' + 0, '/library/success_article.lbi ' + 0, '/library/dynamic_article.lbi ' = > 0, '/library/school_article.lbi ' + 0, '/library/category_tree.lbi ' + 0, '/library/top10.lbi ' + 0, '/libr Ary/invoice_query.lbi ' + 0, '/library/recommend_best.lbi ' + 3, '/library/recommend_new.lbi ' + 3, '/library/ Recommend_hot.lbi ' + 3, '/library/recommend_promotion.lbi ' + 4, '/library/group_buy.lbi ' + 3, '/library/ Auction.lbi ' + 3, '/library/brands.lbi ' + 0, '/library/promotion_info.lbi ' + 0, '/library/cart.lbi ' + 0, ' /library/order_query.lbi ' = 0, '/library/email_list.lbi ' + 0, '/library/vote_list.lbi ' + 0 ', 

Then the library file that this side enumerates to can be called for INDEX.DWT. According to gourd painting scoop, home.dwt need to call which library files, then the corresponding above this write is, I believe everyone has this level. OK, so far a template file has been added successfully, then its display in the browser will be determined by the background settings template. OK, add a template of your own I'll talk about it here, and we'll go on to discuss ecshop in the next issue. thanks!!!

Ectouch Tenth Ecshop in the DWT, LBI file detailed

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.