Sidebox customization on the bar of Zen cart

Source: Internet
Author: User
Tags zen cart

The left and right sides of Zen cart are distinctive. It is combined by a piece of sidebox and a sidebox is created in the sidebox folder of the template.ProgramAfter logging on to the management background, select Appearance Control. The system will automatically detect the newly added sidebox program and remind you to perform the operation. Store all sidebox configuration information in the layout_boxes table.

The program call sidebar is controlled by column_left.php and column_right.php under the "des/modules" directory.

The source code for analysis is also very simple: query the layout_boxes data table on the homepage, retrieve all sideboxes displayed in the left and right columns, and then directly request the sidebox name marked by the layout_box_name field.

Open a sideboxSource codeFor example, if the built-in des/modules/sideboxes/banner_box.php and banner_box.php are used to obtain the sidebox display data,

Then, use require ($ template-> get_template_dir ('tpl _ banner_box.php ', dir_ws_template, $ current_page_base, 'sideboxes') to load the template that displays the sidebox,

In fact, this so-called template is to generate a $ content string,

Then require ($ template-> get_template_dir ($ column_box_default, dir_ws_template, $ current_page_base, 'common'). '/'. $ column_box_default)

Use a public template that displays sidebox to print the content of $ content in $ column_box_default,

This sidebox is displayed!

 

How to add a sidebox of your own? In fact, it is very simple to create a file in the includes/modules/sideboxes/{template directory}/, which is a sidebox. You can control whether the file is displayed in the left-side bar and sorted by default in the background. Output any content in this file. Of course, you can follow the standard mode and create a template file require under the templates des/templates/{template directory}/sideboxes, try to separate M/V, which will be easier to modify later!

In the left column of Zen cart, each small module is displayed in the box mode. The zen_get_box_id () function of Zen cart mainly processes box_id. while (strstr ($ box_id, '_') $ box_id = str_replace ('_', ", $ box_id); $ box_id = str_replace ('. PHP ', ", $ box_id); return $ box_id;

As you can see, its main function is to remove the suffixes "_" and ". phquot; to form a new string. The comments will be <! -// BOF: <? PHP echo $ box_id;?> //-> <Div linoleic = "leftboxcontainer" id = "lt ;? PHP echo str_replace ('_', '-', $ box_id);?> Quot; style = "width: <? PHP echo $ column_width;?> Quotgt; <H3 linoleic = "leftboxheading" id = "lt ;? PHP echo str_replace ('_', '-', $ box_id). 'heading';?> Quotgtlt ;? PHP echo $ title;?> Lt;/h3> the $ box_id can also form the ID of the style html

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.