PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_Template_Flexy » Bug #2959

%s where template output should be

Details

Submitted2004-12-13 16:36 UTC
Fromjohn at curioussymbols dot com
Assignedalan_k
StatusClosed
PackageHTML_Template_Flexy
PHP Version4.3.1
OSWinXP
Roadmaps(Not assigned)

Comments

[2004-12-13 16:36 UTC] john at curioussymbols dot com

Description:
------------
For the template excerpt shown below, my compiled template looks like that below. Full of %s where stuff should be.

Flexy is being called via

// prepare the message proper, including the {signature}

$template = new HTML_Template_Flexy(array(
'compiler'=>'Regex',
'filters' => array('SimpleTags', 'Mail'),
));

$template->compile($this->template);
$this->Body = $template->bufferedOutputObject($this->object);

It doesn't seem to be easily reproduceable. I have two templates with identical stuff here but different stuff above; one version works, and the other always compiles wrong as shown - maybe the lexer is getting confused by something further up the page, but it's not letting me know what that is.

Reproduce code:
---------------
_________________________________________________________________

Item total (ex tax): {totals.itemstotal:h}

Item taxes: {totals.itemstax:h}

Shipping: {totals.shippingcharges:h}

Tax on shipping: {totals.shippingtax:h}

*GRAND TOTAL*: {totals.grandtotal:h}

_________________________________________________________________

Expected result:
----------------
_________________________________________________________________

Item total (ex tax): <?php echo $t->totals->itemstotal;?>

Item taxes: <?php echo $t->totals->itemstax;?>

Shipping: <?php echo $t->totals->shippingcharges;?>

Tax on shipping: <?php echo $t->totals->shippingtax;?>

*GRAND TOTAL*: <?php echo $t->totals->grandtotal;?>

_________________________________________________________________

Actual result:
--------------
_________________________________________________________________

Item total (ex tax): %s

Item taxes: %s

Shipping: %s

Tax on shipping: %s

*GRAND TOTAL*: %s

_________________________________________________________________

[2004-12-13 16:55 UTC] john at curioussymbols dot com

Actually, replace

$template = new HTML_Template_Flexy(array(
'compiler'=>'Regex',
'filters' => array('SimpleTags', 'Mail'),
));

by

$template = new HTML_Template_Flexy();

I was using the default compiler actually.

[2004-12-14 04:40 UTC] john at curioussymbols dot com

I can't use a later version of PHP because I'm using this in a production environment. PHP 4.3.1 is the latest PHP4 version that is offered by the ISP, and I am not ready to move to PHP5.

I will put together a complete self-contained test case, stay tuned.

[2004-12-14 04:44 UTC] john at curioussymbols dot com

But where could these %s things be coming from?

Is it part of the lexer? Is there some kind of $compiled = sprintf($template,$phpcode,$phpcode,$phpcode) going on or something?

[2004-12-14 05:24 UTC] john at curioussymbols dot com

I don't suppose there's a way I can turn off the i18n substitutions for the purpose of testing to see if that's where the problem's coming from?

[2004-12-14 13:15 UTC] john at curioussymbols dot com

Hi Alan

Thinking about how to build a test case to give you, is there any dependence in the template compiler on the object which is being assigned to the template? Can I leave the 'output' stage out of the test case?

JP

[2004-12-15 03:08 UTC] john at curioussymbols dot com

Here is a COMPLETE template that does not compile properly with the latest release version of Flexy, but does compile correctly with Flexy 0.8.2. I am using PHP 4.2.2 here on Red Hat.

-------------------------
Dear Administrator,

-- Automatically Generated Email from XXXXXXXXXX --
{if:hasmessage}

*NOTE*: {message:h}.
{end:}

O R D E R A W A I T I N G A U T H O R I S A T I O N
_________________________________________________________________

ORDER:

ID: {order.h}

*Edit*: http://{host}/admin/sales/orders/edit?id={order}

_________________________________________________________________

CUSTOMER DETAILS:

Name: {customer.firstname:h} {customer.lastname:h}

Email: mailto:{customer.email:h}

*Edit*: http://{host}/admin/sales/customers/edit?id={customer.id}

_________________________________________________________________

SHIPPING TO:

*{deliveryname:h}*
{deliveryaddress:h}

_________________________________________________________________

XXXXXXXXXXXXXXXXXXX:

*{post.transactionstatus:h}*

{if:post.dubious}
*WARNING*! - This may not be a bona fide order! - *WARNING*!

*Reason*: {post.dubiousreason:h}

/Contact tech support/ before proceeding with this order!

{end:}
Total (currency?): {post.total:h}

Client ID (XXXXXXXX): {post.clientid:h}

Order ID: {post.oid:h}

Charge type: {post.chargetype:h}

Timestamp (from XXXXXXXX): {post.datetime:h}

VbV Status: {post.ecistatus:h}

https://XXXXX.XXXXXXXX.XXXXXX.com/XXXXX/XXXXXXX/XXXXXx
_________________________________________________________________

{foreach:orderlines,i,o}
{if:i}

- - - - - - - - - - - - - - - - - - - - - - - -

{end:}
*PRODUCT*:{o.productname:h}

({o.producttypename:h})

*Edit*: http://{host}/admin/catalog/products/edit?id={o.product:u}

FABRIC: {o.fabricname:h}

SIZE: {o.sizename:h}

Eurostop: {o.altid:h}

QUANTITY: {o.quantity:h}

Price ea: {o.eachprice:h}

Tax each: {o.eachtax:h}

Sub-total: {o.totalinctax:h}
{if:o.isgift}

*GIFT MESSAGE* FOR THIS ITEM:
{o.giftmessage}{end:}{end:}

_________________________________________________________________

Item total (ex tax): {totals.itemstotal:h}

Item taxes: {totals.itemstax:h}

Shipping: {totals.shippingcharges:h}

Tax on shipping: {totals.shippingtax:h}

*GRAND TOTAL*: {totals.grandtotal:h}

_________________________________________________________________

{totals.itemsdiscountinfo:h}

{totals.itemstaxinfo:h}

{totals.shippinginfo:h}

{totals.shippingtaxinfo:h}

_________________________________________________________________

blah blah

--------------------------

[2004-12-15 07:24 UTC] john at curioussymbols dot com

Such a small change to make it work... thanks Alan

JP