[PHPTAL] PHPTAL 1.2.0

2009-07-12 Thread Wallace McGee

Hi guys,

A while back I tried PHPTAL 1.2.0 alpha.

I found most of it worked apart from a few things listed below.

I posted this a back in March but have not seen any comments in relation 
to these as yet.


Have others noticed these and/or have any of them been addresses?


1)  The xml parser stops completely if it finds a doubly defined 
attribute like class= and style=.  Previously it would use just the 
last one defined.



2) The error reporting is great in that it tells me the source file the 
exact tag and the exact attribute it didn't like, however:


The srcLine of such errors is off. Look down about 8 lines and you will 
find it.



3) This strange line in the legacy code I inherited tries to define 
values and display them:

span tal:condition=php:col_name=='Office'
tal:define=resp_office offices/${one_row/RESPONSIBLE_OFFICE} | 
false; resp_person 
loggedByList/${one_row/RESPONSIBLE_PERSON}/nameclipped | 
false${resp_office} ${resp_person}/span


Previously this gives a result like 'Houston Bob Smith' but  now gives 
'Houston 0 Bob Smith 0'



Thanks.

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha - is this a bug or my fail?!

2009-05-15 Thread Alister Cameron
Billiant! All fixed :)
Think I went a bit slot-crazy ;)

Cheers,

-Alister

2009/5/15 Kornel Lesiński kor...@aardvarkmedia.co.uk

 It seems that you've used slots where macros would have been more
 appropriate.


 This just defines the same slot many times:

 span tal:repeat=entry entries omit-tag=
span metal:define-slot=cfct_excerpt /
 /span


 and the code below it, outside the loop:

 div metal:fill-slot=cfct_excerpt omit-tag=

div id=post-${entry/the_ID} class=${entry/hybrid_entry_class}


 is run unconditionally, once, after the loop finishes. That's why you're
 getting error about entry variable.


 Change these to:

 tal:block metal:use-macro=cfct_excerpt /

 and

 tal:block metal:define-macro=cfct_excerpt

 --
 regards, Kornel

 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal




-- 
Alister Cameron
Managing Director
Cameron Creative Pty Ltd
www.cameroncreative.com

Creative, Strategic, Innovative... never boring!
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha - is this a bug or my fail?!

2009-05-14 Thread Werner

Hi Alister

Can you please post the code that assigns the variables to the template 
object?


E.g, If you did the var_dump on $data and $data['entries'] is defined, 
and you assigned $data to $template like


$template-data = $data;

...then I would expect  the loop to look like:

span tal:repeat=entry data/entries omit-tag=

...Or did you assign it directly like:

$template-entries = $data['entries'];

As a sidenote, you can make use of the tal:block element if you don't 
want to output the tag:


tal:block tal:repeat=entry entries
span metal:define-slot=cfct_excerpt /
/tal:block


Kind Regards,
Werner


Alister Cameron wrote:

Gents,

Perhaps I should stick to the production version but I hoped to help 
test the latest alpha.


I've encountered an issue where it's not iterating thru a repeat, but 
I don't see what I'm doing wrong.


Could I bother someone to have a look at the processed cache file and 
diagnose?


http://www.alistercameron.com/tal.src.txt

The TPL file is pretty simple:

div metal:fill-slot=cfct_loop omit-tag=

span tal:repeat=entry entries omit-tag=
span metal:define-slot=cfct_excerpt /
/span

/div

You can see the loop there but the persistent error -- even when I 
comment out that entire wrapping span tag -- is:


Unable to find variable 'entry' in current scope

I don't get it.

The var_dump of the data is here:

http://www.alistercameron.com/tal.data.txt

As far as I can tell it's fine... there's an array called entries 
and so forth... don't get the issue.


Cheers,

-Alister

---
Alister Cameron // Blogologist
http://www.alistercameron.com

Mob. 04 0404 
Fax 03 8610 0050

Click here to find me online:
http://clicktoadd.me/alicam


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal
  


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha - is this a bug or my fail?!

2009-05-14 Thread Kornel Lesiński
On 14-05-2009 at 06:34:11 Alister Cameron alister.came...@cameroncreative.com 
wrote:

 Could I bother someone to have a look at the processed cache file and
 diagnose?

 http://www.alistercameron.com/tal.src.txt

This code uses entry variable _after_ the loop (e.g. in 
id=post-${entry/the_ID}). Do you have such code in your template, or is it 
miscompiled? Could you send the source?


BTW: you have lots of divs with omit-tag=. It should be tal:omit-tag=. You 
can also use tal:block.


-- 
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha - is this a bug or my fail?!

2009-05-14 Thread Alister Cameron
Thanks Werner and Kornel...

I'll fix the omit-tag thing. A silly oversight.
Now, I've uploaded the raw and unprocessed template file to:

http://www.alistercameron.com/tal.tpl.txt

To clarify, this is a file that is compiled in a rather complex way which
has to do with how my WordPress theme is built... I'd rather not try to
explain.

However it's clear that if a person was going to built that file up
manually, they'd do it in a different order of slots, better organized, etc.
As long as the content is all there, I trust it's fine. Correct me if I'm
wrong.

As for the data, it's just nested arrays.

In the case of these entries, the PHP there looks something like:

$html_data[entries][item-$id][$fn] = $out;

And later executed like so:

$phptal = new PHPTAL();
$phptal-setSource($html_source, $file);
foreach ($html_data as $k=$v) {
$phptal-$k = $v;
}

echo $phptal-execute();

Hence what you see in the var_dump...

Does that all help at all?

Cheers,

-Alister

PS... one thought... does that foreach above fail if I nest my arrays deeper
than just one level (as I have done)? Should it be recursive??


2009/5/14 Kornel Lesiński kor...@aardvarkmedia.co.uk

 On 14-05-2009 at 06:34:11 Alister Cameron 
 alister.came...@cameroncreative.com wrote:

  Could I bother someone to have a look at the processed cache file and
  diagnose?
 
  http://www.alistercameron.com/tal.src.txt

 This code uses entry variable _after_ the loop (e.g. in
 id=post-${entry/the_ID}). Do you have such code in your template, or is it
 miscompiled? Could you send the source?


 BTW: you have lots of divs with omit-tag=. It should be tal:omit-tag=.
 You can also use tal:block.


 --
 regards, Kornel

 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal




-- 
Alister Cameron
Managing Director
Cameron Creative Pty Ltd
www.cameroncreative.com

Creative, Strategic, Innovative... never boring!
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha - is this a bug or my fail?!

2009-05-14 Thread Kornel Lesiński
It seems that you've used slots where macros would have been more appropriate.


This just defines the same slot many times:

span tal:repeat=entry entries omit-tag=
span metal:define-slot=cfct_excerpt /
/span


and the code below it, outside the loop:

div metal:fill-slot=cfct_excerpt omit-tag=

div id=post-${entry/the_ID} class=${entry/hybrid_entry_class}


is run unconditionally, once, after the loop finishes. That's why you're 
getting error about entry variable.


Change these to:

tal:block metal:use-macro=cfct_excerpt /

and

tal:block metal:define-macro=cfct_excerpt

-- 
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha

2009-04-30 Thread Kornel Lesiński

On 29-04-2009 at 19:07:27 Tjerk Meesters tjerk.meest...@gmail.com wrote:


Guess the __DIR__ constant came a bit too late then ;-)


I had PHP_DIR there previously, but that had a mysterious side-effect of 
slowing down includes in APC.

--
regards, Kornel



___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha

2009-04-29 Thread Kornel Lesiński

On 29-04-2009 at 00:53:41 romtek rom...@gmail.com wrote:


OK, I've given up on require() and changed it all to require_once().


Is there ever a reason to use require() to include code (not text)?


I hoped it would be faster than require_once, but it turned out that with 
relative paths the difference is insignificant.

--
regards, Kornel



___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha

2009-04-29 Thread Tjerk Meesters
Guess the __DIR__ constant came a bit too late then ;-)

On 4/29/09, Kornel Lesiński kor...@aardvarkmedia.co.uk wrote:
 On 29-04-2009 at 00:53:41 romtek rom...@gmail.com wrote:

 OK, I've given up on require() and changed it all to require_once().

 Is there ever a reason to use require() to include code (not text)?

 I hoped it would be faster than require_once, but it turned out that with
 relative paths the difference is insignificant.

 --
 regards, Kornel



 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal



-- 
--
Tjerk

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha

2009-04-28 Thread Christian Welzel
Am Dienstag 28 April 2009 schrieb Kornel Lesiński:

 OK, I've given up on require() and changed it all to require_once().

This solved the problem with the double definition of PHPTAL_Tales.
Nice!

 I've also accidentally found workaround for the other (string:$var) bug
 you've reported.

This is now working too.
My old templates seem to work as before. Thanks!


-- 
 MfG, Christian Welzel

  GPG-Key: http://www.camlann.de/key.asc
  Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha

2009-04-28 Thread romtek
2009/4/28 Kornel Lesiński kor...@aardvarkmedia.co.uk

 OK, I've given up on require() and changed it all to require_once().


Is there ever a reason to use require() to include code (not text)?
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] PHPTAL 1.2.0 alpha

2009-04-27 Thread Christian Welzel
Am Montag 23 März 2009 schrieb Kornel Lesinski:

 Some of those changes could break your templates, triggers, custom
 attributes, etc., so please test it, break it and report any bugs and
 incompatibilities!

Hi there,
today i upgraded my test system from 1.1.15 to 1.2-alpha-10 and now
im hitting this error:
Fatal error: Cannot redeclare class PHPTAL_Tales in 
/usr/share/php/PHPTAL/TalesRegistry.php on line 23

I'm using the zend framework with the zend autoloader, which worked
perfectly in 1.1.15. 

I have seen that you use require() in your code, what i think should be
require_once(). 

-- 
 MfG, Christian Welzel

  GPG-Key: http://www.camlann.de/key.asc
  Fingerprint: 4F50 19BF 3346 36A6 CFA9 DBDC C268 6D24 70A1 AD15

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal