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

Smarty Cheat Sheet for you

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
hasinhayder
Smarty Rookie


Joined: 22 Jun 2005
Posts: 13

PostPosted: Thu Apr 27, 2006 3:19 am    Post subject: Smarty Cheat Sheet for you Reply with quote

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
View user's profile Send private message
t-rob
Smarty Rookie


Joined: 22 Feb 2006
Posts: 9
Location: Amsterdam, the Netherlands

PostPosted: Thu Apr 27, 2006 10:24 am    Post subject: Reply with quote

Nice one, thanks!
Back to top
View user's profile Send private message Visit poster's website
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Thu Apr 27, 2006 3:09 pm    Post subject: Reply with quote

Awesome! This is perfect for my template designers Smile Thanks alot!
_________________
Smarty site with one index.php controller file
Working with MySQL and Smarty
SmartyColumnSort
Custom Smarty Javascript Debug Template
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Apr 27, 2006 4:59 pm    Post subject: Reply with quote

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 Smile

I hope you accept these comments with the good intentions I mean for them Smile

Best regards!
Back to top
View user's profile Send private message
hasinhayder
Smarty Rookie


Joined: 22 Jun 2005
Posts: 13

PostPosted: Fri Apr 28, 2006 5:05 am    Post subject: Reply with quote

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
View user's profile Send private message
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Fri Apr 28, 2006 1:37 pm    Post subject: Reply with quote

Perhaps as a reference in the {php} block section, make note that it is deprecated and indicate to the template designer that they should have the PHP programmer create a custom plugin for them?
_________________
Smarty site with one index.php controller file
Working with MySQL and Smarty
SmartyColumnSort
Custom Smarty Javascript Debug Template
Back to top
View user's profile Send private message Visit poster's website
Hielke Hoeve
Smarty Elite


Joined: 06 Jan 2006
Posts: 406
Location: Netherlands

PostPosted: Fri Apr 28, 2006 3:52 pm    Post subject: Reply with quote

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. Rolling Eyes
_________________
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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Apr 28, 2006 8:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
devjam
Smarty Rookie


Joined: 19 Apr 2006
Posts: 11

PostPosted: Thu May 04, 2006 10:55 am    Post subject: Reply with quote

First of all thank you a lot for this Sheet!

could you please add ...

1. {sectionelse}
2. {foreachelse}
Back to top
View user's profile Send private message
hasinhayder
Smarty Rookie


Joined: 22 Jun 2005
Posts: 13

PostPosted: Thu May 11, 2006 3:48 am    Post subject: Reply with quote

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 Very Happy
Back to top
View user's profile Send private message
jackie_patil
Smarty n00b


Joined: 10 May 2006
Posts: 4

PostPosted: Thu May 11, 2006 6:00 am    Post subject: Reply with quote

I really like the theme
Back to top
View user's profile Send private message
TC!
Smarty n00b


Joined: 21 May 2006
Posts: 2

PostPosted: Sun May 21, 2006 1:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


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