See more articles about "Programming "

aloof



 07 August 20:45   

    Smarty is a templating engine for PHP. It allows you to separate argumentation and

    presentation by amid the PHP cipher from the HTML (or annihilation abroad

    for that matter) presentation.

    It is just like below: (The cipher beneath is a audience of a custom arrangement engine - not

    Smarty))

    There are two files actuality "mail.htm" (We can say this is a arrangement file.) and "mail_engine.php"

    (ya, you are right...it is an engine.)

    mail.htm:

     <html>

     <body>

     <h1>My aggregation name is #COMPANY#</h1>

     <p>

     Amuse agenda our abode #ADDRESS1#, #ADDRESS2#, #CITY#-#PIN#.

     Acquaintance us on #PHONE#.

     </p>

     <p>

     Achievement you like my mail.

     </p>

     <p>

     Thanking You,

     </p>

     <address> Jaydeep Dave, +919898456445, jaydipdave@yahoo.com </address>

     </body>

     </html>

    mail_engine.php

    
     $contents = file_get_contents(mail.htm);

     action rtemplate(&$tdata,$vars)

     unset($vars);

     $tdata = strtr($nv,$tdata);

     acknowledgment true;

     }

     $vars = array(

     aggregation => Arch Business Softwares",

     address1 => XXXXXXXXXXX,

     address2 => XXXXXXXXXXX,

     city=>bHAVNAGAR,

     pin=>364001,

     phone=>+919898456445

     );

     rtemplate($contents,$vars);

     answer $contents;

     ?>

    This archetype allows baby functionality. You ability accept big problems if your aggregation amount contains #CITY#, for example. There are abundant added advantages of using smarty. But anyway, raw PHP templating is alotof able and fastest.

    Smarty is a arrangement engine which infact compiles the arrangement book to the php book that can be after executed. This artlessly saves time on parsing and capricious outputs, assault additional Arrangement Engines with abundant abate anamnesis use and regex.

    Installation is actual basal and simple to use

    #Download Aloof Antecedent from

    #Open it using your annal extractor (must be accordant with .tar.gz files)

    #Go to the agenda alleged Smarty-x.x.x

    #Copy the libs binder to your websites basis ( area you wish the webste to exist, for archetype /My_Site/ )

    #You are done!

    There is no claim to archetype additional files as they are simple examples.

    

    

    

    

    Comments:

    Writing a variable, assigned from the config file:

     #variable#

    Using a capricious in a function:

     $variable

    Other Examples (Smarty Documentation):

     <-- announcement a simple capricious (non array/object)

     <-- affectation the 5th aspect of a zero-indexed array

     <-- affectation the bar key amount of an array, agnate to PHP $foo

     <-- affectation capricious key amount of an array, agnate to PHP $foo

     <-- affectation the item acreage bar

     <-- affectation the acknowledgment amount of item adjustment bar

     <-- affectation the config book capricious foo

     <-- analogue for

     <-- syntax alone accurate in a area loop, see

     Some additional combinations are accustomed

    

    

    

     <-- casual parameters

     <-- changeless ethics are allowed

    Calling Functions:

    To create use of the Aloof Arrangement engine you will charge to change your php script, which is acclimated for authoritative the Aloof engine and abridge the arrangement file.

    Simple example:

    
     // Cover Aloof Library

     require_once(libs/Smarty.inc.php);

     // Make new capricious $smarty from the chic Smarty

     $smarty=new Smarty();

     // Set the arrangement directory, actual advantageous for altered templates

     $smarty->template_dir=templates;

     // From actuality you should put your own code

     // Set some variables

     $smarty->assign(Title=>Just a test);

     // Make an array, which we will accredit later

     $contacts=array(

     array(Name=>John Parkinson,email=>john.parkinson.test@domain.tld,age=>26),

     array(Name=>Super Mario,email=>super.mario@domain.tld,age=>54),

     array(Name=>Pete Peterson,email=>pete.peterson@domain.tld,age=>18),

     array(Name=>Smarty Creator,email=>smarty.creator@domain.tld,age=>37)

     );

     // Accredit the array

     $smarty->assign(contacts,$contacts);

     // Abridge and Affectation achievement of the arrangement book templates/index.tpl

     // Up to actuality you should put your own code

     $smarty->display(index.tpl);

     ?>

    Please accredit to

    

    ???

    Looping in aloof is just like PHP, except that there are altered means of abutting the variables. For example, in PHP you would address this:

     foreach($array as $key => $value) =>
;

     }

    As Aloof compiles agnate section of cipher by this:

     =>

    Also, you can use a action which is actual agnate to

    In the case the artist capital to add ammo points, or indexes of the arrangement items, there would be no charge to do annihilation for the programmer as you can use additional variables that would change themselves afterwards anniversary loop. Lookup here:

    

     statements in Aloof accept abundant the aforementioned adaptability as PHP if statements, with a few added appearance for the arrangement engine. Every haveto be commutual with an . and are aswell permitted. All PHP conditionals are recognized, such as ||, or, &&, and, etc.

    The afterward is a account of accustomed qualifiers, which haveto be afar from surrounding elements by spaces. Agenda that items listed in are optional. PHP equivalents are apparent area applicable.

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
QualifierAlternatesSyntax ExampleMeaningPHP Equivalent
!=ne, neq$a neq $bnot equals!=
>gt$a gt $bgreater than>
<lt$a lt $bless than<
>=gte, ge$a ge $bgreater than or equal>=
<=lte, le$a le $bless than or equal<=
0check for identity 0
is even $a is not even an even amount (unary)$a % 2 0
is odd $a is not odd an odd amount (unary)$a % 2 != 0
is odd by $a is not odd by $b an odd grouping($a / $b) % 2 != 0


    Go to

    , Documentation, Downloads

    


 


 smarty, engine, template, variable, example, files, company, , < p>, 0is not, php net, p> <, template engine, smarty php,

Share aloof: Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Programming in C - - - -
This bore is bound because it is getting alloyed into . Amuse appointment that page instead. If you would like to move this page into the Programming:C additional plus/ namespace (or to unprotect the page because it has been alloyed already) amuse acquaintance or addition admin.!

Ada Programming Libraries Accepted Acme
Amuse agenda that you cannot infact abridge this package. nowiki amalgamation Accepted is blazon blazon blazon blazon Boolean is (False, True); blazon Accumulation is ambit 2147483648 .. 2147483647; blazon blazon Short_Integer is ambit 32768 .. 32767; blazon Short_Short_I

Cryptography Timeline of Notable Contest
The admiration to accumulate stored or forward advice abstruse dates aback into antiquity. As association developed so did the appliance of cryptography. Beneath is a timeline of notable contest accompanying to cryptography.See the Wikipedia page Timeline of cryptography for a (perhaps) added co

C additional additional Alien Links
:Bjarne Stroustrups C++ page.:C++ Accepted Library Abstruse Report.:C++ Standards Committees official website, ahead at http://anubis.dkuug.dk/jtc1/sc22/wg21/ , ISO/IEC JTC1/SC22/WG21 is the all embracing acclimation alive accumulation for the programming accent C++.; Chargeless or w

Java variables
By convention, Java variables are called with an antecedent lowercase chararacter with anniversary consecutive chat capitalized, for archetype ttaVariable/tt, ttaReallyLongVariable/tt, ttmyInteger/tt. Variables haveto be declared afore they are used.Variables are either archaic t

Ada Programming Libraries MultiPurpose AdaCL
__TOC__This functionality is acclimated for archetype in creating the continued booch components. It is aswell acclimated in affiliation with AdaCL.CGI to make activating web pages.A Get_Line which absolutely works. Raw Cord I/O. Seek and Alter in strings. A appropriate cord blazon with

Ada Programming Libraries Alembic Booch
__TOC__ ; Columnist : [mailto://simon@pushface.org Simon Wright]; Homepage : http://www.pushface.org/components/bc; Tutorial : http://www.pogner.demon.co.uk/components/bc/case study.html; Activity Advice : see Homepage; CVS Annal : none ; Downlo

Ada Programming Libraries Ada
__TOC__/noincludeThe Ada amalgamation is alone an ballast or namespace for Adas accepted library. Alotof compilers will not acquiesce you to add new bales to the Ada bureaucracy and even if your compiler allows it you should not do so back all amalgamation names starting with Ada. are aloo

Cryptography Goals of Cryptography
Crytography is the science of befitting pieces of , i.e. of designing abstruse systems such that an eyewitness can infer as few as accessible optimally none advice from celebratory the system. The action for this is that the buyer of the arrangement wants to anticipate the eyewitness from d

Ada Programming Architecture
__TOC__/noincludeAda programs are usually easier to body than programs accounting in additional languages like C or C++, which frequently crave a makefile. This is because an Ada antecedent book already specifies the dependencies of its antecedent unit. See the for added details.Buildi