Kornel Lesiński | 13 Oct 10:34 2009
Picon

Re: Re: PHPTAL Digest, Vol 56, Issue 2

On 09-10-2009 at 02:17:45 Wallace McGee <wallace@...> wrote:
>
> After an exhaustive process I have discovered that this little mangled  
> attribute was causing the infinite loop:
>
> <tal:block tal:condition="auth/authenticated" on error="">
>
> It should be:
> <tal:block tal:condition="auth/authenticated"  tal:on-error="">
>
> But I have no diead why the on-error was placed there so Im just going  
> with:
> <tal:block tal:condition="auth/authenticated" >
>
> Now this resolves one infinite loop I have found.. but not another so  
> the hunt continues...

I've tested how PHPTAL behaves when external macro throws errors, and I  
couldn't reproduce the problem.

Do you have your own exception handler? (e.g. a page that would try to  
display error page using PHPTAL?)

> PS another change I had to change was C-style remarks within html
> remarks eg:
> <!--
> // this is a remark
> /* this is also a remark
>     with more here
> */
(Continue reading)

Kornel Lesiński | 13 Oct 10:35 2009
Picon

Re: globally disable auto escaping

On 12-10-2009 at 21:01:52 admirau <admirau@...> wrote:

> How to disable auto escaping for all variables?
> (I use third party software, which already escapes all the variables).

Are you trying to generate plaintext with PHPTAL?

http://www.mail-archive.com/phptal-CzyLcWPZiU5MT9OEwdum/5owlv4uC7bZ <at> public.gmane.org/msg01033.html

--

-- 
regards, Kornel
Wallace McGee | 14 Oct 01:33 2009
Picon

errors from macros and remarks in remarks


Kornel,

Re external macros and errors: I dont have anything fancy just a plain 
vanilla PHPTAL setup, mind you I inherited the code so there may be 
something lurking in the background Im not aware of.

Interestingly I cant reproduce it now all my pages are working nicely.. 
so there must have been something unique to my setup causing the problem.

Re the error with /* */ remarks in remarks.. was a long time ago now.. 
and I cant reproduce it either.

It was probably this "Ill-formed comment. XML comments are not allowed 
to contain '--' or start/end with '-'"

.. and I just mis-interpreted it and by cleaning up the remarks removed 
the '-'s without realising.

Thanks
GRolf | 14 Oct 18:49 2009

auto-select checkboxes

I have the feeling that this should be possible, and maybe trivial,
but I don't know how to solve it.

I have an object ($person), who lives in a state ($person->state).
I also have a list of states ($states). Both are assigned to phptal.

$phptal->person = $person;
$phptal->states = $states;

In my PHPTAl template I have

<select name="state">
<option tal:repeat="state states" value="${state}">${state}</option>
</select>

I'd like PHPtal to put the state of $person to selected. I know how to
achieve it when I loop through the states array in PHP first, add an
"active" flag to the one state that is active and use tal:attributes
then, but would it be possible to achieve it without looping through
all states in php?

something like ...

<option tal:repeat="state states" tal:attributes="selected person/state eq
state" value="${state}">${state}</option>
Kornel Lesiński | 14 Oct 18:59 2009
Picon

Re: auto-select checkboxes

On 14-10-2009 at 17:49:44 GRolf <gerolf@...> wrote:

> In my PHPTAl template I have
>
> <select name="state">
> <option tal:repeat="state states" value="${state}">${state}</option>
> </select>
>
> I'd like PHPtal to put the state of $person to selected. I know how to
> achieve it when I loop through the states array in PHP first, add an
> "active" flag to the one state that is active and use tal:attributes
> then, but would it be possible to achieve it without looping through
> all states in php?
>
> something like ...
>
> <option tal:repeat="state states" tal:attributes="selected person/state  
> eq state" value="${state}">${state}</option>

Unfortunately that's one case where pure TALES isn't enough and you have  
to use php: modifier.

tal:attributes="selected php:person['state'] == state"

(or person.state or person.state() depending whether that's array/object  
property/method)

--

-- 
regards, Kornel
(Continue reading)

Wallace McGee | 16 Oct 02:08 2009
Picon

Yet another trap when converting to phptal 1.2.0

Hi Guys,

Just letting you know that now you are not allowed to have blank template files.

I had used one on a page that generated some plain text output that did not need to process a phptal template so I used a blank.xhtml file so nothing was added to the output.

PHPTAL 1.2.0 does not like this:

<b>Fatal error</b>:  Uncaught From K:\xampplite\htdocs\apps\common\xhtml\BlankFile.xhtml around line 2
exception 'PHPTAL_ParserException' with message 'Document does not have any tags' in K:\xampplite\htdocs\apps\common\xhtml\BlankFile.xhtml:2
Stack trace:
#0 K:\xampplite\htdocs\apps\common\lib\PHPTAL\Dom\SaxXmlParser.php(338): PHPTAL_Dom_SaxXmlParser-&gt;raiseError('Document does n...')
#1 K:\xampplite\htdocs\apps\common\lib\PHPTAL.php(980): PHPTAL_Dom_SaxXmlParser-&gt;parseString(Object(PHPTAL_Dom_DocumentBuilder), ' ?', 'K:\xampplite\ht...')
#2 K:\xampplite\htdocs\apps\common\lib\PHPTAL.php(709): PHPTAL-&gt;parse()
#3 K:\xampplite\htdocs\apps\common\lib\PHPTAL.php(548): PHPTAL-&gt;prepare()
#4 K:\xampplite\htdocs\apps\common\lib\Application.class.php(175): PHPTAL-&gt;execute()
#5 K:\xampplite\htdocs\apps\licensing\index.php(11): Application-&gt;start()
#6 {main}
  thrown in <b>K:\xampplite\htdocs\apps\common\xhtml\BlankFile.xhtml</b> on line <b>2</b><br />


So now a I simply exit; once I have outputted the text data I want.


 



--
Wallace McGee | Web Applications Developer
Petrosys | www.petrosys.com.au
Level 4 North, 191 Pulteney Street, Adelaide SA 5000, AUSTRALIA
Switch: +61 8 8227 2799 | Direct: +61 8 8418 1924 | Mobile: +61 416 246 156
_______________________________________________
PHPTAL mailing list
PHPTAL@...
http://lists.motion-twin.com/mailman/listinfo/phptal
Ionut Matei | 16 Oct 07:17 2009
Picon

Re: Yet another trap when converting to phptal 1.2.0

I don't think it's only on 1.2.0.
To create an emty template, put an empty <tal:block/>.

On Oct 16, 2009 3:12 AM, "Wallace McGee" <wallace-V6/MWrwjBA00n/F98K4Iww@public.gmane.org> wrote:

Hi Guys,

Just letting you know that now you are not allowed to have blank template files.

I had used one on a page that generated some plain text output that did not need to process a phptal template so I used a blank.xhtml file so nothing was added to the output.

PHPTAL 1.2.0 does not like this:

<b>Fatal error</b>:  Uncaught From K:\xampplite\htdocs\apps\common\xhtml\BlankFile.xhtml around line 2
exception 'PHPTAL_ParserException' with message 'Document does not have any tags' in K:\xampplite\htdocs\apps\common\xhtml\BlankFile.xhtml:2
Stack trace:
#0 K:\xampplite\htdocs\apps\common\lib\PHPTAL\Dom\SaxXmlParser.php(338): PHPTAL_Dom_SaxXmlParser-&gt;raiseError('Document does n...')
#1 K:\xampplite\htdocs\apps\common\lib\PHPTAL.php(980): PHPTAL_Dom_SaxXmlParser-&gt;parseString(Object(PHPTAL_Dom_DocumentBuilder), ' ?', 'K:\xampplite\ht...')
#2 K:\xampplite\htdocs\apps\common\lib\PHPTAL.php(709): PHPTAL-&gt;parse()
#3 K:\xampplite\htdocs\apps\common\lib\PHPTAL.php(548): PHPTAL-&gt;prepare()
#4 K:\xampplite\htdocs\apps\common\lib\Application.class.php(175): PHPTAL-&gt;execute()
#5 K:\xampplite\htdocs\apps\licensing\index.php(11): Application-&gt;start()
#6 {main}
  thrown in <b>K:\xampplite\htdocs\apps\common\xhtml\BlankFile.xhtml</b> on line <b>2</b><br />


So now a I simply exit; once I have outputted the text data I want.


 



--
Wallace McGee | Web Applications Developer
Petrosys | www.petrosys.com.au
Level 4 North, 191 Pulteney Street, Adelaide SA 5000, AUSTRALIA
Switch: +61 8 8227 2799 | Direct: +61 8 8418 1924 | Mobile: +61 416 246 156

_______________________________________________
PHPTAL mailing list
PHPTAL-CzyLcWPZiU5MT9OEwdum/5sJf8rGwyy7@public.gmane.orgm
http://lists.motion-twin.com/mailman/listinfo/phptal

_______________________________________________
PHPTAL mailing list
PHPTAL@...
http://lists.motion-twin.com/mailman/listinfo/phptal
Kornel Lesiński | 16 Oct 10:51 2009
Picon

Re: Yet another trap when converting to phptal 1.2.0

On 16-10-2009 at 01:08:21 Wallace McGee <wallace@...> wrote:

> Just letting you know that now you are not allowed to have blank
> template files.
>
> I had used one on a page that generated some plain text output that did
> not need to process a phptal template so I used a blank.xhtml file so
> nothing was added to the output.
>
> PHPTAL 1.2.0 does not like this:

Indeed. XML forbids files without root (any) element.

> So now a I simply exit; once I have outputted the text data I want.

Perhaps don't execute template then at all?

if (!$data_outputted_already)
{
    echo $phptal->execute();
}

--

-- 
regards, Kornel
Michał | 22 Oct 13:07 2009
Picon

Conditions inside php:


I want to set condition that consists of two parts like:( conected with &&  
)
	tal:attributes="selected php: id_country_val == option && id_country_val  
!= false "
	OR something like this:
	tal:attributes="selected exists: id_country_val php: id_country_val ==  
option"
but it doesn't work.
I don't want to use isSelected because it doesn't fit to my purposes.
Any suggestions?

Greetings

--

-- 
Używam klienta poczty Opera Mail: http://www.opera.com/mail/
Kornel Lesiński | 22 Oct 13:16 2009
Picon

Re: Conditions inside php:

On 22-10-2009 at 12:07:27 Michał <hosemaria@...> wrote:

>
> I want to set condition that consists of two parts like:( conected with  
> && )
> 	tal:attributes="selected php: id_country_val == option &&  
> id_country_val != false "
> 	OR something like this:
> 	tal:attributes="selected exists: id_country_val php: id_country_val ==  
> option"
> but it doesn't work.
> I don't want to use isSelected because it doesn't fit to my purposes.
> Any suggestions?

php:isset(id_country_val) AND id_country_val == option

--

-- 
regards, Kornel

Gmane