SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast HitRaj 47's Avatar
    Join Date
    Nov 2005
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smarty Template engine help

    First of all, hi, I'm new here and signed up hoping I could get a solution to this problem and also contribute/learn more from these forums, as they look interesting!

    I have an error with Smarty. It can't read a .tpl file.

    I have posted the problem on the smarty forums: http://www.phpinsider.com/smarty-for...556&highlight=

    I get this error:

    Warning: Smarty error: unable to read resource: "admin.tpl" in C:\Program Files\Apache Group\Apache2\hosted\kshdesign\Smarty-2.6.10\libs\Smarty.class.php on line 1088

    i also have another template named 'content.tpl' and it loads that one fine...
    I'm still waiting for a reply on the smarty forums but they all seem to be dead =/

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi and welcome to SP!
    admin.tpl is probably in the wrong directory.

    If I presume that admin.php is placed within admin directory, then admin.tpl should be in templates/admin/ directory.
    Make sure it's on the right place.
    Or make sure that you gave right path to it in admin.php or whatever the php page is.
    PHP Code:
    $smarty->display("admin.tpl"); 
    or hypothetically
    PHP Code:
    $smarty->display("admin/admin.tpl"); 
    -- Jelena --

  3. #3
    SitePoint Guru ujjwal's Avatar
    Join Date
    Oct 2004
    Location
    kolkata
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    jelena is right and 1 more have u assign the path where the tpl files stored?
    -::Ujjwal::-
    Visit My Site

  4. #4
    SitePoint Enthusiast HitRaj 47's Avatar
    Join Date
    Nov 2005
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    :O

    THank you SO much, I read jelena's post carefully and then I realised that the file in question (admin/index.php) is in a subdirectory, so i had to re assign in index.php where the actual *.tpl files are located.

    In other words:

    $smarty->template_dir = "../templates";
    $smarty->compile_dir = "../templates_c";

    it works, thanks for the help!


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
  •