Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Search found 9 matches
Smarty Forum Index
Author Message
  Topic: Assign Value Based on Condition
kenzor

Replies: 0
Views: 19459

PostForum: Tips and Tricks   Posted: Thu Feb 09, 2006 2:46 am   Subject: Assign Value Based on Condition
I was sick of doing:


{{if $myvar > 5}}
{{assign var=somevar value=someval}}
{{else}}
{{assign var=somevar value=someo ...
  Topic: Assign Value to Element of Array
kenzor

Replies: 2
Views: 39108

PostForum: Tips and Tricks   Posted: Thu Feb 09, 2006 2:37 am   Subject: Assign Value to Element of Array
I needed a way to create arrays from within the template, or assign a value to an array element so I created the assignel function.

Usage: {{assignel var=myarray key=1 value='myvalue'}}

If the s ...
  Topic: a variable inside a variable?
kenzor

Replies: 6
Views: 9569

PostForum: General   Posted: Mon Mar 01, 2004 4:02 am   Subject: a variable inside a variable?
On the contary, the reason why you are doing something gives the best indication on the methods that one should employ to effect the solution.

Thus, the reason I asked the question was to get more ...
  Topic: a variable inside a variable?
kenzor

Replies: 6
Views: 9569

PostForum: General   Posted: Wed Feb 18, 2004 11:45 pm   Subject: a variable inside a variable?
umm, why?
  Topic: Structure of site?
kenzor

Replies: 2
Views: 7393

PostForum: General   Posted: Wed Feb 18, 2004 11:42 pm   Subject: Structure of site?
The more you think about this an organise it to begin with, the easier it will be down the track. I generally would do it in a manner very similar to what you suggested.

Assume you root dir is /var ...
  Topic: IF using registered object - how?
kenzor

Replies: 2
Views: 5817

PostForum: General   Posted: Wed Feb 18, 2004 11:35 pm   Subject: IF using registered object - how?
worked like a charm, thanks!
  Topic: for actions as function?
kenzor

Replies: 5
Views: 9024

PostForum: General   Posted: Tue Feb 17, 2004 4:50 am   Subject: for actions as function?
You could always pass the action from PHP to the template...

PHP:

$smarty->assign('action', 'action.php?function=process');

and then in the template:

<form action="{ ...
  Topic: how to show all vars?
kenzor

Replies: 2
Views: 6301

PostForum: General   Posted: Tue Feb 17, 2004 1:27 am   Subject: how to show all vars?
Simply turn on debugging:

http://smarty.php.net/manual/en/chapter.debugging.console.php
  Topic: IF using registered object - how?
kenzor

Replies: 2
Views: 5817

PostForum: General   Posted: Tue Feb 17, 2004 1:13 am   Subject: IF using registered object - how?
Basically I want to do something like this:
(I know it's kinda fubar but it's difficult to express)

{{if cms->num_upcoming_galleries niche='candy' > 0}}
do something
&# ...
 
Page 1 of 1
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP