以About Us为范例在Zen cart中增加页面

我们以About Us为例讲解一下zencart中如何新建页面!

方法一:
1.在includes\languages\english\html_includes目录中新建文件define_about_us.php

2.在includes\templates\Your_template\templates目录中新建文件 tpl_about_us_default.php
并在此文件中增加如下代码:

<div id=”aboutUs”>
<h1 id=”aboutUsHeading”><?php echo HEADING_TITLE; ?></h1>
<div id=”aboutUsMainContent”>
<?php
require($define_page);
?>
</div>
<div><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . ‘</a>’; ?></div>
</div>


3.在includes\modules\pages目录中新建about_us目录

4.在新建的about_us目录中新建文件header.php,并在文件中增加如下代码:

require(DIR_WS_MODULES . zen_get_module_directory(‘require_languages.php’));
$breadcrumb->add(NAVBAR_TITLE);
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . ‘/html_includes/’, FILENAME_DEFINE_ABOUT_US, ‘false’);

5.在includes/filenames.php文件增加如下代码:

define(‘FILENAME_DEFINE_ABOUT_US’, ‘define_about_us’);

6.在includes\languages\english目录中新建文件about_us.php,并在文件中增加如下代码:

define(‘NAVBAR_TITLE’, ‘About Us’);
define(‘HEADING_TITLE’, ‘About Us’);

define(‘TEXT_INFORMATION’, ‘About Us information goes here.’);


方法二:

ABOUT_US page for Zen Cart v1.3.x
=================================

Change History:

Date Version Who Why
===============================================================================
08/29/2007 1.3.0.13 webmiss Easier instructions for installing about_us page
05/05/2007 1.3.0.1 swguy Correct use of require_languages.php
06/29/2006 1.3.0 Zen Cart Team Bring up to 1.3.0 Standards

ABOUT US page

To add this page to your system, //要添加此网页到您的系统
1. Install the following files to the appropriate file structure://安装下列文件到相应的文件结构:

/includes/extra_datafiles/about_us_filenames.php

/includes/languages/english/extra_definitions/模板名称/about_us.php

/includes/languages/english/html_includes/define_about_us.php (this adds the page to the drop down box in Define Pages Editor)//这增加了页面到了在页面编辑下拉框

/includes/languages/english/html_includes/模板名称/define_about_us.php

/includes/languages/english/模板名称/about_us.php

/includes/modules/pages/about_us/header_php.php

/includes/modules/sideboxes/模板名称/information.php

/includes/templates/模板名称/templates/tpl_about_us_default.php

--- you can edit this file in Admin with the Define Pages Editor
--- using this file for edits via admin is easier to maintain, and lets you use the
HTMLAREA rich-text editing capabilities of your browser, if enabled in your shop

2. Rename the five "MYTEMPLATE" folders to be the same name as your main template.

3. Upload all the files to your server, using similar folder structure as found in this ZIP.//所有文件上传到您的服务器,使用如本邮编发现了类似的文件夹结构

4. The link to the about_us page has already been added to the information sideboxe or your can add it to another location as desired.//到about_us页的链接已被添加到信息sideboxe或您可以将它添加到另一个所需的位置。
The URL for it is either://对于它的URL可以是
- zen_href_link(FILENAME_ABOUT_US)
or
- http://www.mysite.com/index.php?main_page=about_us

HERE'S AN EXAMPLE ON HOW TO ADD TO THE "information" SIDEBOX: //下面是一个例子关于如何添加到“information”SIDEBOX:
a. edit /includes/modules/sideboxes/MYTEMPLATE/information.php
b. add this line, perhaps right above the "Shipping" link (FILENAME_SHIPPING):

$information[] = '<a href="' . zen_href_link(FILENAME_ABOUT_US) . '">' . BOX_INFORMATION_ABOUT_US . '</a>';

c. Upload these changes to your server, and the link will appear in your "information" sidebox.//上传这些更改到您的服务器,现在链接将出现在您的“information”sidebox。


TO USE THIS PACKAGE FOR OTHER PAGES//以使用此页的其它包装
===================================
It's easy to use this package as a model for other customizable pages.
Let's say you wanted to create another page called "mypage":

- simply rename "about_us" in every filename or folder in this package to "mypage"
- edit the extra_datafiles/mypage_filenames.php and change the define's by changing "ABOUT_US" and "about_us" to "MYPAGE" and "mypage" respectively.
- edit modules/pages/ABOUT_US/header_php.php and change the "ABOUT_US" reference to "MYPAGE"
- edit any of the language files as desired (some heading defines will need changes)

Upload to your server. To add links to a sidebox, see step #4 above.

http://d.namipan.com/d/980cbe9e955c2e7159681fa52ea91bd263a0d6dcde180000


第二种方法是最规范的操作方法,便于Zen cart程序版本的升级,其原因是:

==========================================
调用自定义文件名 - /includes/filenames.php

例子: 你新建了一个页面about_us,需要调用该文件名。

不要在/includes/filenames.php文件中添加一个新的定义,你应该在已有的目录/includes/extra_datafiles中定义该文件名。

建立新文件about_us_filenames.php,然后放在目录/includes/extra_datafiles中。

在该文件中,要有以下代码:

// About Us Filename Define
define('FILENAME_ABOUT_US', 'about_us');

该文件将自动被调用, 就象该目录中的其它文件一样, 因此系统知道你的定制文件。
尽量用同样的办法新建文件...例如, 调用文件blah,将它命名为blah_filenames.php

你可能感兴趣的:(以About Us为范例在Zen cart中增加页面)