你现在的位置:首页 > PHP网站建设知识库 > ZenCart > 正文

复制网站zencart模板的方法

情况是在这个模板是标准的模板 很多情况下都经过了修改了程序的 所以这方法并不很适用 . 首先说明的是,这里只是说明复制网站模板的理论,用于学习用途,复制并使用未经授权的模板是非法的。  
这里以zencart或者osc的模板为例,其他的模板也是同样的方法。 
1. 首先在你的模板目录下,建立一个新的模板,例如:includestemplatesmytemplate 
复制includestemplatestemplate_default下的所有目录和文件到新的目录中 
2. 用文本编辑器修改includestemplatesmytemplatetemplate_info.php,修改其中的名称、版本、作者等内容。 
3. 在后台打开新的模板,然后再工具-外观控制中,点击重置 
4. 获取网站模板的图片 
用整站下载软件实现,例如Teleport Pro,下载全站的所有图形文件,要保留原站的文件结构。 
图片通常都在/images目录下,将下载到的/images下的图形文件都复制到zencart的/images目录下。 
5. 获取网站模板的按钮 
也可以用Teleport Pro下载所有按钮,通常是英文的,osc的按钮图片在/includes/languages/english/images/buttons目录下。 
将下载的按钮保存到zencart的按钮目录/includes/templates/mytemplate/buttons/english/ 和 /includes/templates/mytemplate/buttons/schinese/ 中,在schinese目录中的按钮,可以自己用图像处理软件转换成中文。 
osc模板中,可供下载的按钮有: 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_address_book.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_add_address.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_back.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_buy_now.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_change_address.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_checkout.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_confirm_order.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_continue.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_continue_shopping.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_delete.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_edit_account.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_in_cart.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_login.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_notifications.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_quick_find.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_remove_notifications.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_reviews.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_search.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_shipping_options.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_tell_a_friend.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_update.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_update_cart.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/button_write_review.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/small_delete.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/small_edit.gif 
http://www.domainname.com/osc/includes/languages/english/images/buttons/small_view.gif 
类似的,zencart模板的按钮有 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_add_address.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_back.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_buy_now.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_change_address.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_checkout.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_confirm_order.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_continue.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_continue_shopping.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_delete.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_download.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_in_cart.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_login.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_next.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_ppcheckout.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_prev.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_redeem.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_return_to_product_list.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_reviews.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_search.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_send.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_shipping_estimator.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_sold_out.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_sold_out_sm.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_submit.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_TellAFriend.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_tell_a_friend.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_unsubscribe.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_update.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_update_cart.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/button_write_review.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/small_delete.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/small_edit.gif 
http://www.domainname.com/zencart/includes/languages/english/images/buttons/small_view.gif 
上面的列表中,自己替换www.domainname.com/osc 或者 www.domainname.com/zencart 为你需要复制的网站地址。 
6. 获取网站模板的CSS文件。osc的stylesheet.css文件在根目录下。stylesheet.css文件的具体路径在查看页面源代码时能看到。 
打开获得的stylesheet.css文件,剪贴到/includes/templates/mytemplate/css /stylesheet.css文件中,追加在原来的css文件后,不要覆盖原有的内容。 
7. 打开需要复制的zencart或者osc网站,查看源代码。(有些网站不允许你查看源代码,要一些技巧,这里就不详细讨论这个问题了) 
8. 在源代码中复制 
<!– header //–> 到 <!– header_eof //–> 之间的内容作为includestemplatesmytemplatecommontpl_header.php,删除该文件内原来的内容。 
<!– footer //–> 到 <!– footer_eof //–> 之间的内容作为includestemplatesmytemplatecommontpl_footer.php,删除该文件内原来的内容。 
(有些模板把边框部分的显示也放到header.php中,那么你需要找出属于边框的部分并删除) 
9. 现在,整个网站的外观已经基本出来了。需要替换上面的这两个文件内的链接,这里是模板转换的关键。根据下面的模式替换,第一行是需要替换的类似链接,第二行是正确的代码: 
http://www.domainname.com/osc/index.php 
<?php echo zen_href_link(FILENAME_DEFAULT); ?> 
http://www.domainname.com/osc/account.php 
<?php echo zen_href_link(FILENAME_ACCOUNT, ”, ‘SSL’); ?> 
http://www.domainname.com/osc/shopping_cart.php 
<?php echo zen_href_link(FILENAME_SHOPPING_CART, ”, ‘NONSSL’); ?> 
http://www.domainname.com/osc/checkout_shipping.php 
<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, ”, ‘SSL’); ?> 
http://www.domainname.com/osc/shipping.php 
<?php [...]