SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with directory location.

    I have downloaded 'Smarty 3.1' and unzipped the libs file to the 'Wamp' document root c:/wamp/www/ and placed it into dir/folder 'Smarty'.

    In the document root I have also created another dir/folder named 'myapp'.

    'Smarty/' holds the unzipped 'Libs' file contents and 'myapp/' has 4 empty dir/folders in it plus 2 .php files:
    The folders are: templates/, templates_c/, cache/ and config/,
    the 2 .php files are myapp/smarty.php and myapp/index.php.

    myapp/smarty.php:
    <?php
    //Use the absolute path for Smarty.class.php
    $base_path = (dirname(__FILE__)); //Line 3 possible cause
    require ($base_path.'/Smarty/Smarty.class.php'); //Line 4 line noted in the error return
    $smarty = new Smarty();
    $smarty->template_dir = $base_path.'/myapp/smarty/templates';
    $smarty->compile_dir = $base_path.'/myapp/smarty/templates_c';
    $smarty->cache_dir = $base_path.'/myapp/smarty/cache';
    $smarty->config_dir = $base_path.'/myapp/smarty/config';
    ?>

    myapp/index.php:
    <?php
    require_once('smarty.php');
    $smarty->assign('test, 123');
    $smarty->display('index.tpl');
    ?>

    There is also a .tpl in the myapp/smarty/templates folder:

    on opening myapp via wampserver localhost the returning error is:

    Warning: require(C:\wamp\www\myapp/Smarty/Smarty.class.php) [function.require]: failed to open stream:
    No such file or directory in C:\wamp\www\myapp\smarty.php on line 4

    Line 4 is:
    require ($base_path.'/Smarty/Smarty.class.php');


    The 'Smarty' version used with the book was pre 3.1 which would mean a slightly different file structure.

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    Warning: require(C:\wamp\www\myapp/Smarty/Smarty.class.php)

    I see a little black red rain cloud.... ( / = linux. \ = windows... )
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


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
  •