Warning: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ..../includes/class_bbcode.php on line 2083

Warning: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ..../includes/class_bbcode.php on line 2083
Installing Smarty in Windows
Results 1 to 3 of 3

Thread: Installing Smarty in Windows

  1. #1
    Administrator AP admin's Avatar
    Join Date
    Jul 2010
    Posts
    103
    ΑΡ Credit
    1030

    Installing Smarty in Windows

    Installing Smarty in Windows

    This document assumes that your webserver and php5 is running.

    Download Smarty - http://smarty.php.net

    Installation - Windows, IIS/Apache, PHP5
    Extract files, rename Smarty.x.x.x to smarty (suggest OUTSIDE of your www root!)
    Example: d:\smarty
    Run phpinfo.php to find out your php.ini location
    Edit php.ini's include_path and add the location of the libs folder.
    example: include_path = ".;d:\smarty\libs"
    Restart IIS/Apache
    Setup these two folders INSIDE your www root:
    (wwwroot)/smarty/templates (this is where your templates will go)
    (wwwroot)/smarty/configs

    Setup these two folders OUTSIDE of your www root:
    d:/smarty/templates_c
    d:/smarty/cache

    Setup security settings for the webserver to write to these four folders

    In (wwwroot) create index.php and in (wwwroot)/smarty/templates/index.tpl with the following code:

    index.php:
    PHP Code:
    <?php

    // load Smarty library
    require('Smarty.class.php');

    $smarty = new Smarty;

    $smarty->template_dir 'd:/inetpub/wwwroot/smarty/templates';
    $smarty->config_dir ' d:/inetpub/wwwroot/smarty/config';
    $smarty->cache_dir 'd:/smarty/smarty_cache';
    $smarty->compile_dir 'd:/smarty/smarty_templates_c';

    $smarty->assign('name','fish boy!');

    $smarty->display('index.tpl');
    ?>
    index.tpl
    HTML Code:
    <html>
    <body>
    Hello, {$name}!
    </body>
    </html>
    Now open index.php in your web browser (requested from your webserver)

    http://webserver/index.php

    You can work this out to a referenced script/class:
    smarty_connect.php:
    PHP Code:
    <?php

    // load Smarty library
    require('Smarty.class.php');

    class 
    smarty_connect extends Smarty 
    {
       function 
    smarty_connect()
       {
            
    // Class Constructor. 
            // These automatically get set with each new instance.

            
    $this->Smarty();

            
    $this->template_dir ' d:/inetpub/wwwroot/smarty/templates';
            
    $this->config_dir ' d:/inetpub/wwwroot/smarty/config';
            
    $this->compile_dir 'd:/smarty/templates_c';
            
    $this->cache_dir 'd:/smarty/cache';

            
    $this->assign('app_name''Intranet');
       }
    }
    ?>
    index.php:
    PHP Code:
    <?php

    require('smarty_connect.php');

    $smarty = new smarty_connect;

    $smarty->assign('name','Ned');

    $smarty->display('index.tpl');
    ?>
    index.tpl:
    HTML Code:
    <html>
    <body>
     Hello, {$name}!
    </body>
    </html>

    If you are getting an error that Smarty.class.php isn't found chances are that your include_path isn't correct or you didn't edit the one that the webserver is using, check your phpinfo.php!

  2. #2
    Junior Member
    Join Date
    Aug 2010
    Posts
    2
    ΑΡ Credit
    20
    Thanks for the step by step guide. It's very handy and useful.

  3. #3
    Junior Member
    Join Date
    Aug 2010
    Posts
    1
    ΑΡ Credit
    10
    hi,

    thanks for very through explanation of a Smarty installation, its very helpful to us. and i need to this information. thanks. once again.





    __________________________________________________ _____________

    Want to get-on Google's first page and loads of traffic to your website? Hire a SEO Specialist from Ocean Groups seo pecialist

Similar Threads

  1. Installing and Customizing Wordpress Blog
    By Lindsey in forum Wordpress
    Replies: 0
    Last Post: 03-24-2014, 11:19 AM
  2. Replies: 0
    Last Post: 11-06-2013, 02:55 PM
  3. Replies: 0
    Last Post: 10-17-2013, 03:30 PM
  4. Replies: 0
    Last Post: 07-30-2010, 08:56 PM
  5. Replies: 0
    Last Post: 07-30-2010, 08:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •