Hello forum
I am totally new to Smarty..
But i had read the tutorials and understood the basic concepts of smarty
What i want to know ?
How to use the smarty effectively?
Basic conderation that should be made ?
Basic setup files that should be made ?
etc. etc.
can anybody help me with the neccessary code ?
Thanks in advance to all of you !!
how to use smarty ??
Moderator: General Moderators
- evilmonkey
- Forum Regular
- Posts: 823
- Joined: Sun Oct 06, 2002 1:24 pm
- Location: Toronto, Canada
Basic considerations:
-Keep coding and design seperate. Try not to even use smarty functions such as conditions and loops (use them sparingly and only if you really have to)
-Try not to assign too many variables to smarty...arrays are better suited for the purpose. It keeps your code much cleaner. Related information should be in arrays anyway, for example, $age, $weight, $height = bad coding, $user['age'], $user['weight'], $user['height'] = good, then all you have to do is smarty->assign('user', $user) and to access it in your template, it's {user.age} or {user.weight} etc.
As for code, you'd have to give us context.
What have you tried? What's not working? What are you trying to achieve? Good luck!
-Keep coding and design seperate. Try not to even use smarty functions such as conditions and loops (use them sparingly and only if you really have to)
-Try not to assign too many variables to smarty...arrays are better suited for the purpose. It keeps your code much cleaner. Related information should be in arrays anyway, for example, $age, $weight, $height = bad coding, $user['age'], $user['weight'], $user['height'] = good, then all you have to do is smarty->assign('user', $user) and to access it in your template, it's {user.age} or {user.weight} etc.
As for code, you'd have to give us context.
Try not to even use smarty functions such as conditions and loops (use them sparingly and only if you really have to)
How come we can displays the values in arrays without using loops ?Try not to assign too many variables to smarty...arrays are better suited for the purpose.
Whats the problems to use smarty loops ? whats the solution to get the values in arrays without using smarty loops ?
Please Help !!
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England