View previous topic :: View next topic |
Author |
Message |
hasinhayder Smarty Rookie
Joined: 22 Jun 2005 Posts: 13
|
Posted: Thu Apr 27, 2006 3:19 am Post subject: Smarty Cheat Sheet for you |
|
|
Hi All,
I designed this smarty cheat sheet for template designers. I will add more programming details in "Smarty cheat sheet for template programmers". But this version is quite ok for template designers. You will find almost every necessary items for designing the templates in one page.
Visit here for Smarty Cheat Sheet
http://hasin.wordpress.com/2006/04/27/smarty-cheat-sheet-for-template-designers/
However, if you feel anything missing or want to add something, feel free to reply this thread. Thanks
Hasin Hayder |
|
Back to top |
|
t-rob Smarty Rookie
Joined: 22 Feb 2006 Posts: 9 Location: Amsterdam, the Netherlands
|
Posted: Thu Apr 27, 2006 10:24 am Post subject: |
|
|
Nice one, thanks! |
|
Back to top |
|
TGKnIght Smarty Junkie
Joined: 07 Sep 2005 Posts: 580 Location: Philadelphia, PA
|
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Apr 27, 2006 4:59 pm Post subject: |
|
|
Hi and thanks for this!
Nice work and a good start. I do like the design and format but there are several problems IMHO with the content, especially if being used by newbies which it seems to be geared for. If you don't mind a few constructive criticisms...
- Maybe have a separate sheet for programmers/designers?
- People tend to ask a lot about things like the $smarty.section.foo.iteration (etc) vars
- maybe highlight a few special features (like multiple columns using {html_table}
- show use of double quoting syntax (and when NOT to use quotes at all!)
- show use of PHP functions as modifiers and in if statements
- how to set security mode settings
- how to use multiple caches per page
- how to remove cached pages
- maybe mention {debug} etc
Things that are misleading or incorrect:
- your general example for modifiers: spaces are not permitted between parts of modifier expressions (I know -- they should be but aren't!)
- templates_c DOES NOT REQUIRE 0777 access. In fact, those permissions are not recommended!
- I would rather not see the section on including {php} blocks in-templates. It is a deprecated feature and the general recommendation is to avoid using.
I see other things that can be reworked or added/removed but maybe that is just me being too picky
I hope you accept these comments with the good intentions I mean for them
Best regards! |
|
Back to top |
|
hasinhayder Smarty Rookie
Joined: 22 Jun 2005 Posts: 13
|
Posted: Fri Apr 28, 2006 5:05 am Post subject: |
|
|
Hi Boots
Many thanks for the comments and ideas. Sure I am gonna add them. But I have a confusion, do you really want to remove {php}{/php} block? I have found so many questions here regarding executing php inside templates.
But I agree, that is a bad practise.
Thanks again.
Hasin Hayder |
|
Back to top |
|
TGKnIght Smarty Junkie
Joined: 07 Sep 2005 Posts: 580 Location: Philadelphia, PA
|
|
Back to top |
|
Hielke Hoeve Smarty Elite
Joined: 06 Jan 2006 Posts: 406 Location: Netherlands
|
Posted: Fri Apr 28, 2006 3:52 pm Post subject: |
|
|
Adding the {php}{/php} block imo means you don't like Smarty and might be better off without Smarty. Partly because you will still create dirty code and aren't keeping the 2 logics separated. _________________ Debug XHTML Compliance
SmartyPaginate
Smarty License Questions
---
(About Unix) The learning curve is full of aha! moments, such as that glorious day that the full beauty of grep and, later, find is revealed in all its majesty. --- Robert Uhl <ruhl@4dv.net> |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Apr 28, 2006 8:52 pm Post subject: |
|
|
hasinhayder wrote: | do you really want to remove {php}{/php} block? |
Hi Hasin.
Yes, I still think it is better not to show it on a cheat sheet. Personally I'd rather answer questions about it here and on the mailing list rather than have it shown as an exemplary usage (which I think cheat sheets sometimes imply). As Hielke pointed out, using {php} blocks undermines Smarty's purpose.
Best regards!
PS. My congratulations to you and your fellow authors regarding the publication of your new Smarty book! Good on you!! |
|
Back to top |
|
devjam Smarty Rookie
Joined: 19 Apr 2006 Posts: 11
|
Posted: Thu May 04, 2006 10:55 am Post subject: |
|
|
First of all thank you a lot for this Sheet!
could you please add ...
1. {sectionelse}
2. {foreachelse} |
|
Back to top |
|
hasinhayder Smarty Rookie
Joined: 22 Jun 2005 Posts: 13
|
Posted: Thu May 11, 2006 3:48 am Post subject: |
|
|
Hi Boots
Thanks for your comments. I am working on the new cheat sheet as suggested by all you guys and I am also making a cheat sheet for smarty programmers.
I will also add {foreachelse} and {sectionelse}
Regards
Hasin Hayder
http://packtpub.com/smarty/book |
|
Back to top |
|
jackie_patil Smarty n00b
Joined: 10 May 2006 Posts: 4
|
Posted: Thu May 11, 2006 6:00 am Post subject: |
|
|
I really like the theme |
|
Back to top |
|
TC! Smarty n00b
Joined: 21 May 2006 Posts: 2
|
Posted: Sun May 21, 2006 1:33 pm Post subject: |
|
|
I noticed a couple of small errors on the PDF version.
In the associative array section there are dollar signs missing from two of the student examples:
{student.name}
{student.roll}
{$student.age}
In the example for passing associated array, the array you define is $student but the name you use to assign it to smarty is $std:
$student=array(”name”=>”shumi”);
$smarty->assign(”student”,$std);
A big thanks for the part on objects, I didn't know you could do that!
Is your book released now in the UK? |
|
Back to top |
|
|