SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    set_file() in phplib template

    Hi,
    I have the line:
    $t->set_file("LoginHandle", "/login.htm");

    the problem is login.htm is not in the current directory. It's in directory named valid. If I have a constant defined as
    define("VALID_DIR", "C:/Program Files/nusphere/nsdocs/valid");

    how do I include constant VALID_DIR in the set_file() above?

    I've tried:
    $t->set_file("LoginHandle", VALID_DIR . "/login.htm");

    but it's incorrect.
    It says I'm using "./C:/Program Files/nusphere/nsdocs/valid"
    I need to use the constant because I don't want to hard-code the path, and don't like to use "../" Is there another way?
    Thanks in advance,
    John
    Last edited by johnn; Aug 22, 2001 at 02:12.

  2. #2
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    Alkmaar, Netherlands
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $t = new Template("Your_template_directory_here");
    $t->=set_file('loginfiles/bla.tpl')

    loginfiles directory is under Your_template_directory_here
    logic here keeping your template files under same directory(with sub directories if you want)

  3. #3
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I've tried
    $t = new Template(VALID_DIR);
    $t->set_file("LoginHandle", "./login.htm");

    and it works! I hope there's no problem when moving the site online or use in other PHPLIB versions.


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
  •