News: Sensation!!! Xanax dose Phentermine no credit card cod Generic viagra pill Dilaudid Viagra advertisement Phentermine side effects dangers Phentermine faqs Phentermine sales online Generic viagra overnight delivery Compare viagra price Exelon Buy generic online phentermine Cordarone Minocin Thiabendazole Tramadol information Norflex Xanax suicide Prednisone Buy viagra pill online Where to buy viagra on line Eulexin Mivial valve prolapse viagra Chlorprothixene Ditropan Generic purchase viagra Phentermine Chlorthalidone Kevin harvick viagra Fluvastatin Natural phentermine Drug screen xanax Permethrin Recreational viagra Tramadol hydrochloride tablet Order cialis uk Colestipol Lescol Cheap phentermine prescription Lipitor 5mg tablet Buy Hydrocodone Buy phentermine online without prescription Phentermine uk suppliers Phentermine no credit card required Milrinone No prescription cialis Trimetrexate Cardura Viagra online Brompheniramine Buy consultation free hydrocodone online tramadol Calan Cheap phentermine diet pills Guanfacine Donepezil Oxymorphone Dopamine Low cost phentermine Amlodipine Ambien sleeping pill Free pack sample viagra Mark martin viagra photo Ionamin Cozaar Phentermine message boards Piperacillin Metformin Tramadol ingredients Lamictal Comparison viagra cialis levivia Phentermine ups shipped Ambien Phenylpropanolamine Hydrocodone pharmacy Diflucan Cialis Viagra prescriptions Purchase hydrocodone Woman use viagra Effects of viagra on woman Lyrica Phentermine Try viagra for free Phentermine pharmacies Topamax Compare viagra cialis levivia Alendronate How long does xanax stay in your body Phentermine weight loss pills Phentermine prescribed online How to discontinue the use of phentermine Arava Metaraminol Actonel Buy cheap phentermine free fedex Will xanax help me sleep while on adderall Viagra women Non perscription viagra Buy Wellbutrin Ativan Oxyphenbutazone Avapro Cheap phentermine canada Methoxamine Buy cheap phentermine online Hydrocodone side effects vicodin Free phentermine Adapalene Women using viagra Epivir Viagra cialis generic Azithromycin Phentermine 90 day Alternative herbal review viagra Phentermine xenical Novobiocin Ranitidine Buy cialis generic Xanax online prescription Actos Buy Meridia Nicorette Filing income tax phentermine Phentermine wholesale Pentobarbital Pink oval pill 17 xanax identification Amide pharmaceutical phentermine Buy and purchase viagra online Vicodin health Arimidex Viagra canada prescription Cheap generic viagra substitutes Bactrim phentermine Fioricet info Gentamicin Accolate 5 mg no prescription Tramadol hcl 50 mg Soma side effects Labetalol Ambien 10mg Buy xanax cod Spironolactone Diet phentermine Dextromethorphan Tramadol cash on delivery Nitroglycerin and viagra Buying viagra in the uk Viagra patent expiration Xenical hgh phentermine quit smoking detox Dilantin Flomax Cialis prices Omnicef Maxzide Pediacare Methaqualone Tramadol hcl Cefaclor Cefoxitin Quinidine Where to buy viagra online Cialis dosages Miconazole Hydrocodone medication Vasopressin Elidel Viagra for women Paroxetine Laetrile Cialis sales uk Zantac Viagra canada No perscription generic viagra Cialis tablets 5 mg diet pills Buy domain onlinebigsitecitycom phentermine Toprol Enalapril Cialis dose Compare phentermine prices Locoid 5 mg free shipping Xanax canada Reliable same or next day phentermine purchase online Hydrocodone information Cod online tramadol Overnight shipping viagra Famvir Oxycontin xanax bars percasettes and lor tabs Keflex Phentermine forums Cialis comparison levitra viagra Liver problems from xanax Tramadol without perscription health risks Cialis Viagrafix corporation Cheap viagra Phentermine prescriptions online physiphen online Viagra pharmacy Chlortetracycline What does xanax look like Hydrocodone withdrawal Mesoridazine Cordarone Mirena Physican's desk reference phentermine Female viagra alternative Phentermine free delivery Xanax pics Haloperidol Buying viagra Chinese viagra dragon power Dexfenfluramine Ultracet Cialis generic Dangers of taking xanax and neurontin Buy cialis in canada Phentermine versus meridia Flucytosine Terbutaline Cheap discount phentermine Is phentermine addictive Indapamide Viagra cialis levivia comparison Viagra Phentermine on line without prescription Online doctors perscriptions xanax steroids Cyber pharmacy phentermine Vicodin cod Restoril Woman using viagra Mastercard phentermine Plendil Metyrosine Soma muscle Chlordiazepoxide Azithromycin Hydrocodone query Adderall skin allegra skin xanax skin Cheap phentermine online Picture of soma Non perscription generic cialis Ketamine Drug interaction xanax and holy basil M357 vicodin Hydrocodone bitartrate acetaminophen Benazepril Order viagra buying viagra uk 100 mg tramadol Buy tramadol cod Generica viagra Buy phentermine with no prescription Viagra by mail Iodipamide Effects of long term xanax use Phentermine side effects Cardizem Herbal alternative to viagra Alteplase Xanax withdrawel symptoms Viagra generic drug Phentermine in stock Ganciclovir Natural viagra type alternatives Clomiphene Ambien Metformin Best price on phentermine Ssri phentermine heart Natural over counter just like viagra stores Phentermine pill town Xanax without a prescription Phentermine picture Buy viagra internet Climara Buy online order viagra Pain medication tramadol Cheapest xanax online Carisoprodol Venlafaxine Cheapest free shipping phentermine Avelox Female viagra uk Drug testing and tramadol Viagra energy drink Overnight xanax Side effects of phentermine _cialis et levitra Buy tramadol cheap Viagra prescription uk Herbal viagra for women Xanax drug tests Viagra sales uk Online pharmacy phentermine xenical meridia Ambien eminem Low price phentermine 5 pdr Minocycline Nifedipine Dicumarol Menadione Amaryl Vicodin effects Phentermine pictures Viagra cialis levitra comparison How do i stop taking phentermine Viagra buy in uk online Danazol Phentermine forum Hydrocodone withdrawal symptom Viagra online cheap Buy generic phentermine Xanax shipped cod Diet online phentermine pill Benicar Bromodiphenhydramine Loss phentermine story success weight Xanax addiction Xanax lethal dose Eprosartan Buy Effexor Monopril Nonoxynol Neurontin Noroxin Hytrin Cod delivered phentermine Phenindione Ribavirin Phentermine online cod Online pharmacy tramadol Cialis price Effects phentermine side strong Iodamide Tretinoin Viagra use in women Pheniramine Misoprostol Cymbalta Viagra info Hydrocodone apap 5 500 Anileridine Phentermine with no prescription Generic cialis prices Cialis prescriptions Xanax without a perscription Viagra cialis levivia comparison dosages Tramadol online 5 online Generic meridia Buy ambien Guanadrel Phentermine not working Online tramadol Generic tramadol Buy cialis without prescription Ipratropium Generic vicodin Cheapest phentermine free shipping Mifepristone Mexiletine Tramadol avinza drug interaction Viagra testimony Phentermine Cialis erectile dysfunction Cialis overnight shipping Buy online tramadol Xanax 2mg Linkdomain buy online viagra info domain buy onlin Isocarboxazid Differin Generic viagra india Acitretin Fentanyl Cheapest price phentermine online pharmacy Meridia coupon Dulcolax Viagra interaction Flexeril Aciphex Piperacetazine Cialis forums Fluoxetine Does viagra work Moricizine Kaolin Methylphenidate Celebrex Cefprozil Cheap xanax Fioricet line Hydrocodone bitartate Diamox Moxifloxacin Viagra suppliers Tramadol overnight Opipramol Ambien cr effects side Meridia side effects Lodine Mercaptopurine Phentermine diet Buy viagra Accutane Phentermine mexico Cialis online discount Famotidine Low cost phentermine health insurance lead Order phentermine by for saturday delivery Order phentermine online and cod shipping Buy phentermine online without a prescription Viagra overdose Celiprolol Somatostatin Phentermine np Zuclopenthixol Difference between valium and xanax Phentermine with free shipping Atracurium Online pharmacy phentermine Chlortrimeton Vitamin b12 1000 mcg phentermine and panic attacks Sulfasalazine Viagra alternative uk Cheap tramadol Aminophylline Depakote Combivent Buy viagra uk Phentermine side affects Methotrexate Effexor Female use viagra Ambien dosage Cheap prescription viagra Propantheline Xanax weight gain Buy cheap domain online atspace com xanax Cheapest place buy viagra online Lowest cost phentermine Ketoprofen Anafranil Generic viagra in canada Oxyphencyclimine Cialis sample Soma san diego Ceftin Foscarnet Propranolol Alesse Phentermine online purchase Buy phentermine online no prescription Pharmacy phentermine sister Xanax no prescription needed Hydrocodone for ibs Bayer Ingredient phentermine Allopurinol Phentermine yellow Cyber pharmacy viagra Buy cheap no phentermine prescription Cialis immunity Trimethoprim Meridia diet pill Accupril Lowest phentermine prices Cefotetan Minocycline Invia nasal viagra Alka seltzer Phentermine without rx Generic viagra canada Estrace Ansaid Prozac interact xanax Terazosin Calcitriol Viagra premature Tramadol used for Nitroprusside Phentermine on line Thioridazine Prescription viagra Nasacort aciphex phentermine actos imitrex Viagra cost Canadian pharmacy viagra Cheap 37 5 phentermine Zoloft and xanax Natural supplement equivalent to xanax Viagra testimonial Buclizine Digitoxin Viagra and ischemic optic neuropathy Locoid Seroquel Cheap xanax no prescription Eldepryl Dolasetron Amaryl Prempro Pravachol Xanax addiction treatment L arginine natural viagra Xanax master card Buy Ambien American express phentermine Tramadol hcl acetaminotran par Kaopectate About xanax Diphemanil No perscription xanax Meridia better than phentermine Liqued viagra Viagra cialis levitra dose comparison Flovent Disulfiram Ambien cr dosage Viagra alternative and woman Discount vicodin Viagra alternatives Micronase Chlorpheniramine Letrozole Viagra lawsuits Biperiden Buy phentermine cod Herbal viagra Viagra free pill Buy phentermine without a prescription Meclizine Phentermine no fees Buy cheapest viagra Orlistat Albendazole Generic cialis online Xanax anxiety relief pills order here Herbal phentermine does it work Avandamet Foradil Compare cialis levitra viagra Cheap pharmacy viagra Cialis compare levitra viagra Viagra conviaindications Fioricet with codeine Voltaren Hydrocodone m367 Pargyline Cheap tramadol without prescription Discount priced viagra Xanax in urine Cheapest online pharmacy phentermine Cheapest phentermine online Norethynodrel Canadian viagra Generic prescription viagra without Erythromycin Cleocin Dexamethasone Cheap diet online phentermine pill Dibenzepin Butalbital Loxapine Viagra pill cutter Ritonavir Butaperazine Buy phentermine saturday delivery ohio Ecotrin Diet phentermine pill Cheap cialis generic Pharmacy phentermine affiliate Buy prescription tramadol without Discount viagra perscription drug Fioricet Xanax interaction with paxil Lexapro and xanax Phentermine and pregnancy Diazoxide Mirapex Order cialis online On line vicodin Diethylpropion Naltrexone Mevacor Oxazepam Bactrim Viagra from canada Alternative herbal viagra Tramadol effects Cash on delivery shipping of phentermine Amphetamine Methdilazine Viagra online sales Side effect of viagra Cheap soma Xanax tablets 5 mg sale Buy online prescription viagra Generic cialis overnight Tetracycline Xanax doses Buy phentermine epharmacist Cyclacillin Cialis in the uk How does viagra work Viagra sample Generic soft tab cialis Buy Zoloft Prevacid Viagra sales online Phentermine gynecomastia Alternative to viagra Digitalis Cialis generic canada Clomid Xanax no prescription overnight delivery Relafen 1 loss phentermine pill weight Phentermine free online consultation Side effects phentermine gynecomastia Coumadin Natural alternative viagra Clomipramine Trovafloxacin Tramadol hydrochloride capsules Phentermine pharmacy Mometasone Cycrimine Herbal phentermine forum Cheap phentermine with online consultation Lorazepam Meridia Phentermine us Fluconazole Best buy phentermine Avapro No prior perscription tramadol Nimodipine Lethal dose xanax Prevacid University rochester viagra pfizer Sulfonamides Cheap meridia Phentermine sites that ship cash on delivery Buy cheap cialis Nicardipine Diet information phentermine pill Luvox and xanax Flupenthixol Valium vicodin Online viagra Phentermine no prescription Blindness cialis Acetylcholine Tramadol prescription Alcohol hydrocodone Dicloxacillin Lotrimin Strattera Buy cod pay phentermine Xanax side effect Hydrocodone bitartrate Purchase tramadol online Lotrel Viagra results Free xanax Phentermine adipex diet pill prescription Cheap viagra in the uk Celexa phentermine Ergocalciferol Allowed cialis tag viagra xhtml Addiction recovery xanax Free sample viagra Pepcid Order xanax overnight Cheap cialis tablets Flutamide Amsterdam holland viagra Tramadol Uk online pharmacy phentermine Phentermine from the uk Cheep tramadol paris france Free prescription sample viagra Viagra sex Exelon Avandamet Where can i buy phentermine Cyclosporine Phentermine work Xanax sale Viagra users Viagra vs levivia Idoxuridine Drug phentermine testing Buy cheap domain onlineatspacecom xanax Phentermine weight loss medication Bromides 90 $89 mastercard Loracarbef Prednisone Phentermine testimonials Cycloserine Fill viagra prescription Tomorrow Phentermine caffeine Trimethobenzamide Xanax online without a prescription Xanax fedex overnight Phentermine diet pill Buy viagra now online Diflunisal Phentolamine Xanax overnight delivery Viagra pills Phentermine from a mexican pharmacy Buy discount cialis Does phentermine speed up metabolism Xanax effect Viagra 50 mg Phentermine tablets Ciclopirox Disopyramide Cheep phentermine Generic soma Bactrim Buy phentermine pay cod Ofloxacin Free generic viagra Maximum dosage of phentermine Coreg Adipexdrug addiction order phentermine online Buy generic xanax Viagra pictures Hydroxyurea Cialis generic viagra Atropine Primaquine Order phentermine diet pill Xanax effects Levivia and viagra Lexapro and phentermine Metronidazole Ciprofloxacin Augmentin Phentermine mexican pharmacies online Viagra online canada Phentermine snorting Ambien overnight Oxycontin xanax bars perclesept and lortab wha Glycerin Between difference levivia viagra Soma fm Herbal viagra reviews Mestranol No prescripton phentermine What does phentermine look like Generic phentermine Albuterol Feldene Buy Adderall Keflex Metrizamide Viagra online pharmacy Phentermine Weight loss oral hcg and phentermine Viagra herbal Generic money order viagra Perscription cialis Generic xanax xr 5 mg diet pill Viagra without a prescription Buy cialis viagra Lansoprazole Can woman take cialis Tapering off xanax Heparin Cialis doseage Tramadol 377 Indinavir Chantix Viagra erection Buy cialis Phentermine cheap Tramadol use in dogs
News Sensation! Cialis online ya.by furniture Phentermine online Evening dress Building materials Fashions Cigarette Green Card Information Medicine news Balans auto-moto Underwear Hydrocodone online Sportswear Vicodin online Tramadol online Ambien online Top auto-moto Medical tests Soma online Get ringtones online Best Ringtones Rington Credits Pills, Compare pills, Reviews pills Necklace FDA Approved Pharmacy Cheap pharmacy shop Autos Fioricet online Xanax online Cheap drugs online shop Chronometer Free Ringtones Ornaments Boats Trousers Cigarettes Åables Cars Credit Loan Online Rolex Replica Replica Rolex mp3 music for mobile Bracelets Online notebook shop Blog Search the Web Chairs Sale Auto Top casino Ear rings Tunings Adipex online Valium online Yachts

Archive for the 'Smarty' Category

March 11th, 2007 by morning

I already wrote short tutorial for beginners which covers installation and some common usage of smarty tags.

Modifiers are basically php functions (custom or predefined) which work with variables, custom functions and strings. That means, you can actually call php functions as modifiers. Applying a modifier is very easy, all you need to specify the value followed by pipe and the modifier name. Some of the modifiers can be called with additional parameters. For example:

PHP:
{"<span>This is just a string</span>"|strip_tags}
<!-- Or -->
{$description|truncate:40:"…"}

Even though Smarty covers lots of very useful modifiers, sometimes, you will have a need for new one.

Let’s write a simple modifier which will be applied to strings and will replace smilies shortcuts with actual images.

Create a file named: modifier.grins.php and place it within your Smarty dir in /libs/plugins/

If you open any existing modifier, you will see a phpdocumentor compatible comment which describes modifier. It is recommendable that you use the same when writing your own ones.

For replacing smilie shortcuts with actual images, I will use simple str_replace php function, so the result would be:

PHP:
<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * Smarty plugin
 *
 * Type:     modifier<br>
 * Name:     grins<br>
 * Date:     March 6, 2007
 * Purpose:  converts smilies to img tags
 * Input:<br>
 *         - string: input string to replace
 * Example:  {$text|grins}
 * @version  1.0
 * @author   Jelena Pavlovic <jelena@arraystudio.com>
 * @param string
 * @return string
 */

function smarty_modifier_grins($string)
{
   
    $url = "images/";

   
    $signs = array(':-)', ':-(', ';-)', ':-|', ':-S' ,':-P' ,':-$',':-O', ':-*', ':-D');
    $replace = array(
    '<img src="'.$url.'smiley_1.gif" alt=":-)" />',
    '<img src="'.$url.'smiley_2.gif" alt=":-(" />',
    '<img src="'.$url.'smiley_3.gif" alt=";-)" />',
    '<img src="'.$url.'smiley_4.gif" alt=":-|" />',
    '<img src="'.$url.'smiley_5.gif" alt=":-S" />',
    '<img src="'.$url.'smiley_6.gif" alt=":-P" />',
    '<img src="'.$url.'smiley_7.gif" alt=":-$" />',
    '<img src="'.$url.'smiley_8.gif" alt=":-O" />',
    '<img src="'.$url.'smiley_9.gif" alt=":-*" />',
    '<img src="'.$url.'smiley_10.gif" alt=":-D" />'
    );
    $string = str_replace($signs, $replace, $string);
    return $string;
}
?>

What you have probably noticed is function name, which has to follow the pattern of smarty(underscore)modifier(underscore)chosenName, where chosenName will be used to call your modifier.

To apply this modifier we can create example-smilies.php page with:

PHP:
<?php

    include "includes/config.php";

    $description = "This is one funny sentence. :-) <br />This is one sad sentence :-( ";

    $smarty->assign("description", $description);
    $smarty->display("example-smilies.tpl.htm");

?>

and example-smilies.tpl.htm page and place it in templates dir:

PHP:
{include file="header.tpl.htm"}

<h2>Description without grins modifier applied</h2>
<div>{$description}</div>

<h2>Description with grins modifier applied</h2>
<div>{$description|grins}</div>

{include file="footer.tpl.htm"}

Html code result will be:

HTML:
<html>
<head>
    <title></title>
</head>
<body>
<h2>Description without grins modifier applied</h2>
<div>This is one funny sentence. :-) <br />This is one sad sentence :-( </div>

<h2>Description with grins modifier applied</h2>
<div>This is one funny sentence. <img src="images/smiley_1.gif" alt=":-)" /> <br />This is one sad sentence <img src="images/smiley_2.gif" alt=":-(" /> </div>

</body>
</html>

Very simple.
I have updated .zip file which contains example from previous tutorial with those described here, so feel free to download it.


January 21st, 2007 by morning


Note: I started to write this article a year and a half ago. I finally decided to finish it and create series of posts which will cover some Smarty tips and tricks and writing plugins and modifiers.

THE PROBLEM: PHP and HTML-embedded PHP

As PHP is HTML-embedded scripting language you can easily nest php code inside html and get dynamically generated page. Great, isn’t it? Yes, as long as you know what you are doing. The trouble comes when programmers and designers start to work together on the same project. In that case programmers should try to ‘hide’ their code as much as possible from designer’s eyes, not only because designers doesn’t like to see bunch of weird signs between their HTML, but because they can easily remove a single semicolon and cause parse error in PHP. This result in arguments and blaming who erased what (for solving this you should also consider using code versioning: CVS or Subversion). Let’s see few examples. Continue reading Smarty templates for beginners


News News: Insulin Butalbital Liothyronine Catapres Metformin Atarax Bupropion Taking phentermine Amikacin Metrizoate Ambien addiction No perscription tramadol Xanax and pregnancy Phentermine no doctor Crohns phentermine Shipping phentermine to florida Pepcid Viagra alternative herbal supplement Phentermine Lincomycin Discount generic cialis Cialis and pomegranate interaction Dalteparin Phentermine meridia xenical review Mestranol Between difference levivia viagra Canada xanax Antipyrine Adenosine Viagra herbal Butorphanol Viagra drug Succinylcholine Cialis levitra viagra vs vs Inexpensive viagra Pancuronium Methazolamide Glycerin Womans viagra Ambien side effects Herbal phentermine Cod phentermine shipped Get phentermine Nisoldipine Orphenadrine 50mg viagra Diazepam Xanax bars Niaspan On line phentermine Tramadol ingredients Lansoprazole Cordarone Mevacor Nalbuphine Haloperidol Cefaclor Bepridil Seroquel Viagra sales Non perscription generic cialis Zoloft and xanax Mometasone Loxapine Elidel Mylan xanax Accolate Pentasa Cialis compared to viagra Viagra jokes Diflucan Cialis vs viagra Cialis soft tabs Phentermine result Donepezil Phentermine success stories Bretylium Discount drug phentermine Vicodin overdose Xanax on line Isosorbide Xanax with same day delivery Cheep paris france phentermine Tramadol overdose Xanax dose Cialis levitra better Alfentanil Soma sale Viagra for woman information Itraconazole Methadone xanax interaction Provera Dienestrol Viagra experiences How long does phentermine stay in your body Lasix Edrophonium Ionamin Glatiramer Cheep phentermine Generic viagra no perscription needed Enebrel Perscription phentermine Cytotec Cialis generic india Xanax half life Phentermine from canada Toprol Noroxin Phentermine pharmacy Protriptyline Colestipol Tramadol pharmacy Fiorinal Spironolactone How long does xanax stay in the system Fosinopril Viagra cialis levivia comparison dosages Phenazopyridine Best phentermine pharmacies compare links Fioricet description Effexor Phentermine accepts cod Dutasteride Triamterene Alendronate Discount soma Cefixime Rifampin Heparin Tetracycline Flexeril Mesalamine Dichlorphenamide How does xanax work Lowest phentermine 00 phentermine Isosorbide Drug phentermine testing Iodine Butalbital fioricet Indomethacin Keyword tramadol Viagra cialis generic Generic xanax photo Lotrimin Fioricet Caverta veega generic viagra Calcifediol Lisinopril Trichlormethiazide Tramadol overnight Nicardipine Phentermine uk suppliers Xanax long term effects Tramadol medication Apomorphine Fioricet information James thompson viagra lawsuit Darvocet Flexeril Zithromax Xenical hgh phentermine quit smoking Vicodin and pregnancy Avandia Differin Cash on delivery for phentermine Fioricet line Citalopram Meto