shopxx4.0做的很不错.前台模版大气,后台功能全面,代码注释完整,逻辑清晰.做二次开发非常爽.还有各种插件功能.
1.模版开发(或叫做主题吧)
shopxx4.0用的是freemark模版,不过它的模版文件夹结构有一点特殊.
模版目录下有个 theme.xml,内容如下.
<?xml version="1.0" encoding="UTF-8"?> <theme> <id>ID</id> <name>名称</name> <version>版本号</version> <author>作者</author> <siteUrl>网址</siteUrl> <preview>预览图片</preview> </theme>
一套模版上传之后,程序会读取theme.xml,返回给前台.
theme.xml包含了一套模版的基础信息,项目中的shopxx.xml包含了模版详细配置.其中部分配置如下:
<templateConfig id="shopCommonJs" type="page" name="shop_common_js" templatePath="/shop/${theme}/js/common.ftl" staticPath="/resources/shop/${theme}/js/common.js" /> <templateConfig id="adminCommonJs" type="page" name="admin_common_js" templatePath="/admin/js/common.ftl" staticPath="/resources/admin/js/common.js" /> <templateConfig id="sitemapIndex" type="page" name="sitemap索引" templatePath="/shop/${theme}/xml/sitemap_index.ftl" staticPath="/sitemap/index.xml" /> <templateConfig id="sitemap" type="page" name="sitemap" templatePath="/shop/${theme}/xml/sitemap.ftl" staticPath="/sitemap/${index}.xml" /> <templateConfig id="header" type="page" name="头部" templatePath="/shop/${theme}/include/header.ftl" /> <templateConfig id="footer" type="page" name="底部" templatePath="/shop/${theme}/include/footer.ftl" /> <templateConfig id="login" type="page" name="登录" templatePath="/shop/${theme}/login/index.ftl" /> <templateConfig id="register" type="page" name="注册" templatePath="/shop/${theme}/register/index.ftl" /> <templateConfig id="index" type="page" name="首页" templatePath="/shop/${theme}/index.ftl" staticPath="/index.html" /> <templateConfig id="articleList" type="page" name="文章列表" templatePath="/shop/${theme}/article/list.ftl" /> <templateConfig id="articleSearch" type="page" name="文章搜索" templatePath="/shop/${theme}/article/search.ftl" /> <templateConfig id="articleContent" type="page" name="文章内容" templatePath="/shop/${theme}/article/content.ftl" staticPath="/article/content/${article.createDate?string('yyyyMM')}/${article.id}/${pageNumber}.html" /> <templateConfig id="goodsList" type="page" name="商品列表" templatePath="/shop/${theme}/goods/list.ftl" /> <templateConfig id="goodsSearch" type="page" name="商品搜索" templatePath="/shop/${theme}/goods/search.ftl" /> <templateConfig id="goodsContent" type="page" name="商品内容" templatePath="/shop/${theme}/goods/content.ftl" staticPath="/goods/content/${goods.createDate?string('yyyyMM')}/${goods.id}.html" /> <templateConfig id="brandList" type="page" name="品牌列表" templatePath="/shop/${theme}/brand/list.ftl" /> <templateConfig id="brandContent" type="page" name="品牌内容" templatePath="/shop/${theme}/brand/content.ftl" /> <templateConfig id="promotionContent" type="page" name="促销内容" templatePath="/shop/${theme}/promotion/content.ftl" /> <templateConfig id="productCategory" type="page" name="商品分类" templatePath="/shop/${theme}/product_category/index.ftl" /> <templateConfig id="friendLink" type="page" name="友情链接" templatePath="/shop/${theme}/friend_link/index.ftl" /> <templateConfig id="cart" type="page" name="购物车" templatePath="/shop/${theme}/cart/list.ftl" /> <templateConfig id="orderPrint" type="print" name="订单打印" templatePath="/admin/print/order.ftl" /> <templateConfig id="productPrint" type="print" name="购物单打印" templatePath="/admin/print/product.ftl" /> <templateConfig id="shippingPrint" type="print" name="发货单打印" templatePath="/admin/print/shipping.ftl" /> <templateConfig id="testSmtpMail" type="mail" name="SMTP测试" templatePath="/admin/mail/test_smtp.ftl" /> <templateConfig id="findPasswordMail" type="mail" name="找回密码" templatePath="/shop/${theme}/mail/find_password.ftl" /> <templateConfig id="productNotifyMail" type="mail" name="到货通知" templatePath="/shop/${theme}/mail/product_notify.ftl" /> <templateConfig id="registerMemberMail" type="mail" name="会员注册" templatePath="/shop/${theme}/mail/register_member.ftl" /> <templateConfig id="createOrderMail" type="mail" name="订单创建" templatePath="/shop/${theme}/mail/create_order.ftl" /> <templateConfig id="updateOrderMail" type="mail" name="订单更新" templatePath="/shop/${theme}/mail/update_order.ftl" /> <templateConfig id="cancelOrderMail" type="mail" name="订单取消" templatePath="/shop/${theme}/mail/cancel_order.ftl" /> <templateConfig id="reviewOrderMail" type="mail" name="订单审核" templatePath="/shop/${theme}/mail/review_order.ftl" /> <templateConfig id="paymentOrderMail" type="mail" name="订单收款" templatePath="/shop/${theme}/mail/payment_order.ftl" /> <templateConfig id="refundsOrderMail" type="mail" name="订单退款" templatePath="/shop/${theme}/mail/refunds_order.ftl" /> <templateConfig id="shippingOrderMail" type="mail" name="订单发货" templatePath="/shop/${theme}/mail/shipping_order.ftl" /> <templateConfig id="returnsOrderMail" type="mail" name="订单退货" templatePath="/shop/${theme}/mail/returns_order.ftl" /> <templateConfig id="receiveOrderMail" type="mail" name="订单收货" templatePath="/shop/${theme}/mail/receive_order.ftl" /> <templateConfig id="completeOrderMail" type="mail" name="订单完成" templatePath="/shop/${theme}/mail/complete_order.ftl" /> <templateConfig id="failOrderMail" type="mail" name="订单失败" templatePath="/shop/${theme}/mail/fail_order.ftl" /> <templateConfig id="registerMemberSms" type="sms" name="会员注册" templatePath="/shop/${theme}/sms/register_member.ftl" /> <templateConfig id="createOrderSms" type="sms" name="订单创建" templatePath="/shop/${theme}/sms/create_order.ftl" /> <templateConfig id="updateOrderSms" type="sms" name="订单更新" templatePath="/shop/${theme}/sms/update_order.ftl" /> <templateConfig id="cancelOrderSms" type="sms" name="订单取消" templatePath="/shop/${theme}/sms/cancel_order.ftl" /> <templateConfig id="reviewOrderSms" type="sms" name="订单审核" templatePath="/shop/${theme}/sms/review_order.ftl" /> <templateConfig id="paymentOrderSms" type="sms" name="订单收款" templatePath="/shop/${theme}/sms/payment_order.ftl" /> <templateConfig id="refundsOrderSms" type="sms" name="订单退款" templatePath="/shop/${theme}/sms/refunds_order.ftl" /> <templateConfig id="shippingOrderSms" type="sms" name="订单发货" templatePath="/shop/${theme}/sms/shipping_order.ftl" /> <templateConfig id="returnsOrderSms" type="sms" name="订单退货" templatePath="/shop/${theme}/sms/returns_order.ftl" /> <templateConfig id="receiveOrderSms" type="sms" name="订单收货" templatePath="/shop/${theme}/sms/receive_order.ftl" /> <templateConfig id="completeOrderSms" type="sms" name="订单完成" templatePath="/shop/${theme}/sms/complete_order.ftl" /> <templateConfig id="failOrderSms" type="sms" name="订单失败" templatePath="/shop/${theme}/sms/fail_order.ftl" />
其中的shopCommonJs,adminCommonJs虽然是模版配置,但其中的内容确实js,只不过这些js中包含了动态地址,这样通过模版加载的时候就不用担心路径错误了.
shopxx 二次开发交流可联系我 qq911198983