Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts

    making a extended setup for smartly effectively ??

    suppose i have follwing file structure

    Code:
    wwwroot>libs>smarty>Smarty.class.php
    wwwroot>templates
    ---------->c_templates
    wwwroot>admin>templates
    ------------------->c_templates
    wwwroot>includes>smartySetup.php
    smartySetup.php

    PHP Code:
    <?php
    define
    ("SMARTY_DIR","path/to/smarty/");
    define("TEMPLATE_DIR","path/to/templates");
    define("C_TEMPLATE_DIR","path/to/c_templates");

    require_once (
    SMARTY_DIR."Smarty.class.php");
    $smarty = new Smarty;
    $smarty->compile_dir "C_TEMPLATE_DIR";
    $smarty->template_dir "C_TEMPLATE_DIR";
    ?>
    My problem:
    1>sometimes the templates and c_templates are in admin and sometimes in wwwroot and sometimes may be in other directory
    and the smarty setup file is in wwwroot>includes>smartySetup.php , which is included while displaying the .tpl file
    what i want:
    i want to make the path dynamic so that it works in all the cases , No matter where the smarty,templates,c_templates folder are .
    2>
    i wanna know:
    making different compile fodler is effective (for example i have made one for admin templates and for wwwroot folder)
    or making only one ?

    Hope for the Best.
    Thanks in advance to all of YOU !!

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    there's not really a need to have separate compile directories, better to keep that separate and individual as it needs to be writable, and other things don't and shouldn't be.

    As for templates, I normally use something like:
    Code:
    /
      templates/
        admin/
        main/
        shared/
    so, have subdirectories within a templates directory, rather than having 2 directories at the top level. There would be nothing to stop you having something like:
    PHP Code:
    if(is_admin_page()) {
      
    $smarty->template_dir='./admin_templates';
    }
    else {
      
    $smarty->template_dir='./templates';

    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com


  •  

    Posting Permissions

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