PHP Manual
PEAR Manual
Smarty Manual
PostgreSQL
MySQL Manual
Perl Manual
Ciekawe adresy
- Fundusze strukturalne
- Organizacja Ślubów
- Lodowe rzezby
- Egipt Sharm El Sheikh Last Minute
- Agencja Reklamowa Poznań
- Księgowość Poznań
- Wypożyczalnia Narzędzi
- Vitalitys
Czytnik RSS
» CrossOver 9.1 - programy i gry z Windows na Mac OS XCode Weavers udostępniło nową wersję programu CrossOver, który umożliwia uruchamianie programów z systemu Windows na platformę Mac OS. W nowej wersji oznaczonej cyframi 9.1 poprawiono między innymi obsługę pakietu MS Office oraz kombajnu Windows Media Player 9.
» Telefony z Windows Phone 7 nie będą miały kopiuj-wklej
Microsoft zapowiedział, że w telefonach opartych o system Windows Phone 7 nie będzie funkcji kopiuj-wklej. Poinformowano również o trwających pracach nad wieloma usprawnieniami dla tego systemu. Żadnych konkretów jednak nie podano.
» III Internetowe Mistrzostwa Polski w Programowaniu
8 grudnia w poniedziałek rozpoczynają się "III Internetowe Mistrzostwa Polski w Programowaniu". Zawody będą podzielone na cztery tury; pierwsza kończy się za dwa dni. Aby wziąć udział w turnieju, "przede wszystkim należy znać któryś z języków programowania: Pascal, C lub C++ [...] Przydaje się znajomość algorytmów, struktur danych i umiejętności szacowania złożoności czasowej. Jednak głównie liczy się inteligencja i pomysłowość."
» Nvidia wychwala Fermi na konferencji GTC
Kiedy AMD dostarcza produkty wykonane w procesie 40nm i w pełni zgodne z DirectX 11, Nvidia wydaje się być raczej spokojna. Firma twierdzi, że DirectX 11 nie jest aż tak ważny.
chapter 1. what is smarty?
smarty is a template engine for php. more specifically, it facilitates a manageable way to separate application logic and content from its presentation. this is best described in a situation where the application programmer and the template designer play different roles, or in most cases are not the same person.
for example, let's say you are creating a web page that is displaying a newspaper article. the article headline, tagline, author and body are content elements, they contain no information about how they will be presented. they are passed into smarty by the application, then the template designer edits the templates and uses a combination of html tags and template tags to format the presentation of these elements (html tables, background colors, font sizes, style sheets, etc.) one day the programmer needs to change the way the article content is retrieved (a change in application logic.) this change does not affect the template designer, the content will still arrive in the template exactly the same. likewise, if the template designer wants to completely redesign the templates, this requires no changes to the application logic. therefore, the programmer can make changes to the application logic without the need to restructure templates, and the template designer can make changes to templates without breaking application logic.
one design goal of smarty is the separation of business logic and presentation logic. this means templates can certainly contain logic under the condition that it is for presentation only. things such as including other templates, altering table row colors, upper-casing a variable, looping over an array of data and displaying it, etc. are all examples of presentation logic. this does not mean that smarty forces a separation of business and presentation logic. smarty has no knowledge of which is which, so placing business logic in the template is your own doing. also, if you desire no logic in your templates you certainly can do so by boiling the content down to text and variables only.
one of the unique aspects about smarty is the template compiling. this means smarty reads the template files and creates php scripts from them. once they are created, they are executed from then on. therefore there is no costly template file parsing for each request, and each template can take full advantage of php compiler cache solutions such as zend accelerator (http://www.zend.com/) or php accelerator (http://www.php-accelerator.co.uk).
some of smarty's features:
it is extremely fast.
it is efficient since the php parser does the dirty work.
no template parsing overhead, only compiles once.
it is smart about recompiling only the template files that have changed.
you can make custom functions and custom variable modifiers, so the template language is extremely extensible.
configurable template delimiter tag syntax, so you can use {}, {{}}, <!--{}-->, etc.
the if/elseif/else/endif constructs are passed to the php parser, so the {if ...} expression syntax can be as simple or as complex as you like.
unlimited nesting of sections, ifs, etc. allowed.
it is possible to embed php code right in your template files, although this may not be needed (nor recommended) since the engine is so customizable.
built-in caching support
arbitrary template sources
custom cache handling functions
plugin architecture
Najskuteczniejsza reklama to pozycjonowanie - Pozycjonowanie stron <= zajrzyj tu i dowiedz się więcej o pozycjonowanie stron