PDA

View Full Version : XTemplate engine


AlanT
1st April 2006, 11:40 PM
The current 'templating' of PAP is nearly impossible for me to customize to match the design of the rest of my site. About all I can modify is the header/footer, but that leaves all of the menus and tables that are in the default blue tones with the default graphics.

I'm moving the core of my site to CubeCart rather than X-Cart, and I have a new CMS (Seditio from www.neocrome.net) also running part of my site. Both of these use the XTemplate engine and I love it.

Frankly, I'm getting very frustrated with my site and the hobbled together look that it has had over the past year. I'm doing everything I can to make it look completely integrated, and the last piece of the puzzle is the affiliate software.

I know that moving the layout out from the PHP is a major undertaking, but it is SOOOOOO worthwhile. This would really help PAP lose the unpolished look that it has had for too long.

This is one thing that will really make the software worth twice as much.

mark
4th April 2006, 12:10 PM
Hi Alan,

how exactly do you imagine it could be made? PAP uses template system Savant, and it is possible to change it's design, although it is not for beginner user.

How do you want to "move the layout out from the PHP"? Do you mean to use some template system not bound with PHP, such as Smarty?

By the way, why you go from X-Cat to CubeCart?

regards,

mark

AlanT
8th April 2006, 09:12 PM
Okay, let's see if I can clarify myself on this.

Here is an example of the current templates, the main.tpl.php file:

<? include('./header.htm'); ?>

<tr height="100%">

<? if($this->a_Auth->isLogged()) { ?>
<td class="leftMenu" bgcolor=ff0000 height="100%">
<table width="182" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="leftMenuContentBorder"></td>
<td class="leftMenuMain" valign="bottom">


<? include('left_menu.tpl.php'); ?>


</td>
<td class="leftMenuContentBorder"></td>
<td class="leftMenuBorder"></td>
</tr>
</table>
</td>
<? } ?>

<td width="5"></td>
<td class="contents">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td valign="top" align="left">



<? if($this->a_Auth->isLogged()) { ?>

<? include('error_msg.tpl.php'); ?>

<? } ?>


<?= $this->content ?>

</td>
</tr>
</table>
</td>
</tr>

<? include('./footer.htm'); ?>

There is way too much logic in this and it completely confuses the layout. Here is an example of a template in the XTemplate system, also a main template (from CubeCart):


<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={VAL_ISO}" />
<title>{META_TITLE}</title>
<meta name="description" content="{META_DESC}" />
<meta name="keywords" content="{META_KEYWORDS}" />

<link href="skins/{VAL_SKIN}/styleSheets/layout.css" rel="stylesheet" type="text/css" />
<link href="skins/{VAL_SKIN}/styleSheets/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/jslibrary.js" type="text/javascript"></script>
</head>

<body>
<div id="pageSurround">

<div id="subSurround">

<div id="topHeader"> </div>
<div style="margin: 5px;">{SESSION}</div>


<div>

<div class="colLeft">
{CATEGORIES}
{SHOPPING_CART}
{RANDOM_PROD}
{POPULAR_PRODUCTS}
{MAIL_LIST}
</div>

<div class="colMid">
{PAGE_CONTENT}
</div>

</div>

<br clear="all" />

{SITE_DOCS}

</div>

</div>
</body>
</html>


There is absolutely no PHP code in this template, and is much easier for someone like me (a non-programmer) to understand and to edit. The above is my customization of a 3 column layout to a 2 column layout and can be seen at http://www.PowerKeysPub.com/cc3/.

Incidentally, the above code generates all pages except the checkout pages. The {PAGE_CONTENT} tag generates the home page, the product pages, or anything else that needs to be displayed. Templates for each type of page are defined separately.



What I mean by "move the layout out from the PHP" is that there should be no PHP in the templates - AT ALL! A complete separation of code and design gives the webmaster the option to create static HTML templates and insert data codes that will be replaced at run time with the required data.

Some data calls for the use of other templates, and these are also static HTML with data codes. Again, this is much easier for me to understand and I can customize the look of a system using XTemplate, but I cannot with the current templating system (Savant).



You asked about my reasons for switching from X-Cart to CubeCart.

My reasons for moving away from X-Cart are primarily due to the business policies of the X-Cart development team. They have released very buggy add-on modules and refuse to acknowledge their mistakes. They claim that the erroneous behaviors of the modules are "by design".

One example of this is a module they create to allow webmasters to offer "buy 3 get 1 free" specials. For some reason, the software gives the most expensive item for free rather than the least expensive one, and everyone is complaining about it.

The same module was supposed to allow for other types of specials, such as "buy 2 or more and get 15% off, up to $50". If a customer buys enough so that the 15% off would be greater than the $50 maximum, the customer gets NO discount rather than the $50 maximum. Again, the developers refuse to acknowledge this as a bug.

Beyond that, I have noticed that a lot of my site visitors are leaving the site before completing a purchase, and I suspect that they are confused by the process.

The template system is a minor reason. CubeCart templates (based on XTemplate) are much easier for me to use than the X-Cart templates, which are based on Smarty.

Overall, X-Cart is a very powerful shopping cart system that has the most options for the price.

CubeCart is more limited in some areas, but seems to be more robust and stable. Stability is very important, more important than the quantity of features. I'd much rather have a few features that I can count on than a hundred features that are unpredictable.

When I was researching shopping carts, I fell in love with CubeCart but passed by it because of the template system that version 2 had. At that time, version 2 used a similar template system to what PAP uses now, PHP mixed with HTML.

Version 3 was just coming out and had not become stable at that point. There were also a couple of features that I felt that I had to have and did not appear to be available to CubeCart at that time.

Over the past year, CubeCart has grown and the new version (with some mods) is now capable of meeting my current needs. I also have confidence in the development community to respond to user requests. Also, custom development can be acquired at a lower cost than what was available for X-Cart.


Did I explain myself well enough? I'd be happy to elaborate if needed.

mark
10th April 2006, 11:53 AM
Hello Alan,

you explained it well, and I understand your point. We will consider it, changing template engine would mean adding 2-4 weeks more to the development of the new version.

I'm keen to do it, but I'll have to talk with my partners about it first. I'll post our decision here in the next few days.

regards,

mark

AlanT
10th April 2006, 04:03 PM
If I were in your position, I suppose I would postpone the new template system until the rest of the new version is completed. This way, you can test the other new features without having to wonder if any bugs are the result of the new template system.

And then I would implement the new template system as a separate project - to isolate any bugs to that one subsystem. I imagine that the template system is intertwined with practically every aspect of the software and will be a major undertaking to change.

Since the affiliate software is only seen by affiliates and not the world at large, I can wait until a future version for this feature request.

Obviously, the functionality of the software is more important than its appearance. And I certainly appreciate having bug free software.