SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: *smarty*

  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    leeds, uk
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    *smarty*

    Hi,

    I installed smarty yesterday on my localhost Apache, everything worked fine so I decided to upload it to my online server. This is when the problems started.

    http://www.digitalronan.co.uk/fdbetting/

    This is the out put.

    (Fatal error: Failed opening required '/usr/local/psa/home/vhosts/digitalronan.co.uk/httpdocs/fdbetting/Smarty.class.php' (include_path='.:/usr/local/psa/apache/lib/php') in /usr/local/psa/home/vhosts/digitalronan.co.uk/httpdocs/fdbetting/index.php on line 3)

    The Smarty.class.php and the index.php file re in the same dir and I have tryed using

    require('/usr/local/psa/home/vhosts/digitalronan.co.uk/httpdocs/fdbetting/Smarty.class.php');

    and

    define('SMARTY_DIR', '/usr/local/psa/home/vhosts/digitalronan.co.uk/httpdocs/fdbetting/');
    require(SMARTY_DIR.'Smarty.class.php');

    and

    require('Smarty.class.php');

    With out success. By the way my server is running in safe mode.

    Could someone please help me with this?

    RonnieB.

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the smarty directory needs to be within your include path

    http://www.php.net/manual/en/configu...directives.php
    http://www.php.net/manual/en/function.ini-set.php

    regards,
    M.T.

  3. #3
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    While it makes it much easier to include the Smarty Directory in your include path, you can't always do this if you are on a shared server. To get around this, Smarty allows you to specify the directories where its files are located.

    When I create a Smarty based project, I always include the following lines in my configuration script:

    PHP Code:
    define (SMARTY_DIRWEBPATH '/includes/smarty/');
    require(
    SMARTY_DIR.'Smarty.class.php');
    $smarty->compile_check true;
    $smarty->debugging false;
    $smarty = new Smarty;
    $smarty->template_dir WEBPATH '/includes/smarty/cms/templates/';
    $smarty->compile_dir WEBPATH '/includes/smarty/cms/templates_c/';
    $smarty->config_dir WEBPATH '/includes/smarty/cms/configs/';
    $smarty->cache_dir WEBPATH '/includes/smarty/cms/cache/'
    This gives me more control over the entire layout of my project and where Smarty needs to work at.

    You can also override Smarty's settings by using a class to extend it and set your variables within the constructor like the following:
    PHP Code:
    class pageDisplay extends Smarty {
      function 
    pageDisplay() {
        
    $this->Smarty();
        
    $this->template_dir WEBPATH '/includes/templates/templates/';
        
    $this->compile_dir WEBPATH '/includes/templates/templates_c/';
        
    $this->config_dir WEBPATH '/includes/templates/configs/';
        
    $this->cache_dir WEBPATH '/includes/templates/cache/';
        
    $this->caching false;
        
    $this->compile_check false;
        
    $this->debugging false;
        
    $this->assign('app_name','Metaquark CMS');    
      }

    All of this is discussed in the Smarty manual that comes with the actual download. I haven't messed with the version included with PEAR at all though because of all the bad things I have heard about PEAR overall.
    Wayne Luke
    ------------


  4. #4
    SitePoint Member
    Join Date
    Apr 2003
    Location
    leeds, uk
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by m.t.
    the smarty directory needs to be within your include path

    http://www.php.net/manual/en/configu...directives.php
    http://www.php.net/manual/en/function.ini-set.php

    regards,
    M.T.

    I have no tryed

    Code:
    ini_set("include_path","/usr/local/psa/home/vhosts/digitalronan.co.uk/httpdocs/fdbetting/");
    define('SMARTY_DIR','/usr/local/psa/home/vhosts/digitalronan.co.uk/httpdocs/fdbetting/');
    require(SMARTY_DIR.'Smarty.class.php');
    and

    Code:
    ini_set("include_path","/usr/local/psa/home/vhosts/digitalronan.co.uk/httpdocs/fdbetting/");
    require('Smarty.class.php');
    with out success. Please help me as this is *very* frustrating.

    RonnieB.

  5. #5
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you have the application script in the same directory you can try:

    include('./Smarty.class.php');

    That's what I am doing in my environment. Also check the ownership(s) and rwx modes of the directories and remember to change the safe_mode setting

    var use_sub_dirs = false;

    in the Smarty.class.php

    Markku

Bookmarks

Posting Permissions

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