Re: [PHPTAL] tal:condition question

2011-09-23 Thread Kornel Lesiński

On Fri, 23 Sep 2011 19:16:11 +0100, Teis Lindemark  wrote:

I have a list in my application where the first column should be one  
icon if the id of the offer is in an array or another icon otherwise.  
The array that have some icons looks something like this: $tmp[id] = 1  
or 0.


If id is 1, I should have one icon and another if 0. I added the array  
to template like this: $template->tmp = $tmp; and then I tried to do  
this:
 Where offers/idoffer  
is the list that is repeated in the table, so each row have one idoffer.


If tmp has items for all IDs, then it should work fine (I presume  
"idiffer" misspelling is only in the e-mail).


Otherwise you can test for existence with:

tal:condition="exists:tmp/${offers/idoffer}"


If you want to toggle between two icons:





--
regards, Kornel Lesiński

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


Re: Re: [PHPTAL] Tal:condition question

2011-07-13 Thread sean
Thank you for contacting Canterris.  I???m currently out of the office until 
July 25.  Please feel free to contact Will Freemen (w...@canterris.com) or 
Canterris Technical Support (supp...@canterris.com) for any support requests.

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


Re: [PHPTAL] Tal:condition question

2011-07-13 Thread Marco Pivetta
Supposing that you've set variable "l" in your template, you can just write


Logout
Login


That will do :)

Marco Pivetta
http://twitter.com/Ocramius
http://marco-pivetta.com



On 13 July 2011 09:21, Teis Lindemark  wrote:

> Hi,
>
> ** **
>
> I am sitting with a page where I have a menu where the design is defined as
> a macro. In this menu, I want to have one of the elements that is “Login” or
> “Logout” depends on the user is logged in or logged out.
>
> ** **
>
> So I was thinking that tal:condition could do this for me. I have a
> function that I can check if is true or false (true if you are logged in),
> but don’t get it right when I should use it with the tal:condition.
>
> ** **
>
> Login
>
> ** **
>
> My function that I usually check is $l->IsLoggedIn() that is accesable from
> all the webpage.
>
> ** **
>
> Do someone have an idea how I can do this as best as possible?
>
> ** **
>
> Hope for an answer.
>
> ** **
>
> Teis
>
> ___
> 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] Tal:condition question

2011-07-13 Thread sean
Thank you for contacting Canterris.  I???m currently out of the office until 
July 25.  Please feel free to contact Will Freemen (w...@canterris.com) or 
Canterris Technical Support (supp...@canterris.com) for any support requests.

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