SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 46

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    I have a question regarding Include files in PHP.
    I have a website with includes of header and footer. I use the command as follow:

    If the page is in the same path as the include file:
    Code:
    <?php include ("./includefile.inc")?>
    If the page is in an upper directory than the include file:
    Code:
    <?php include ("../../includefile.inc")?>
    and so on...

    I was wandering if there was a way of making includes virtual. I explain, instead of having to change the include line for every folder of the site, make a standard include like
    Code:
    <?php include ("/includefile.inc")?>
    that looks for the file on the root folder of the site. This is similar as the
    Code:
    <!--#include virtual="/includefile.inc"-->
    in ASP.

    Please let me know if this is possible in PHP and how.

    Thanks
    Guillermo

  2. #2
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm...are all your includes in one directory?

    If so then you could edit your php.ini file (or use .htaccess) to make php serch for the includes in a certain directory.

    I have my includes in a directory that isn't visible on the so nobody can see my passwsord, etc...

    that looks for the file on the root folder of the site. This is similar as the
    code:--------------------------------------------------------------------------------<!--#include virtual="/includefile.inc"-->--------------------------------------------------------------------------------
    in ASP.
    That is SSI not ASP...

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use .htaccess to set the php include_path to wherever you want like or set it in the php.ini file, howevere this will set it for the whole server as where .htaccess will set for s pecific folder and its subfiolders.

    php_value include_path "/home/www/html/catalog"
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So those are the only way I can do it?
    I don't have all the includes in the same directory.
    And also if I move all the includes to the same directory, if I use the .htaccess to specify a includes folder, it will work on the online site, but it will not work on the PWS I haver on my local computer for site testing.


    What other option do I have?

    Thanks
    Guillermo

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Install Apache on your computer for testing, it is way better than PWS.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok...
    Does apache works on Windows 2000?
    I building my new machine next week and I'll install Windows 2000 on it.
    What's the best web server for Win2000 for running PHP and ASP (yes, I also use ASP for some of my clients, but it's not my personal choice)?

    So there's no way of making what I asked for the includes?
    Guillermo

  7. #7
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it just fine that is how my setup is but I am not too sure about ASP with apache, I am sure it can be done I just don't know how. You may need to run IIS when you are testing your ASP pages. win 2k comes with IIS, just put them both on your machine then run Apache for php dev and IIS for asp dev
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  8. #8
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok.. thanks

    So all I need for testing my PHP sites is install Apache for Win2K?

    And for the ASP sites, install IIS....

    ---------

    nothing else about the includes?
    Guillermo

  9. #9
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can i ask what apache is?

    Does it affect your system?

  10. #10
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freddydoesphp
    Yes it just fine that is how my setup is[...]
    Sorry to ask.. How do you have your web server configuration?... It may help me to get some ideas on how to configure mine.
    Guillermo

  11. #11
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have apache set at

    c:\apache\

    PHP4 at

    c:\apache\modules\mod_php4\

    And my webroot at

    c:\wwwroot



    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  12. #12
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pete apache is a webserver. mainly used on unix systems, but also used on windows mainly for development purposes only. What web server are you using?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  13. #13
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok...
    And what features does Apache have that makes it better than PWS?
    Guillermo

  14. #14
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where do I start....

    Virtual hosts.
    PHP as a module.
    Server Alias.
    and more,

    Plus it is a hell of a lot more stable.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  15. #15
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My Host is Hostrocket, if anyone know what they are usingm i dunno.....

  16. #16
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freddydoesphp
    Where do I start....

    Virtual hosts.
    PHP as a module.
    Server Alias.
    and more,

    Plus it is a hell of a lot more stable.
    cool... and is easy to set-up? I mean, that if I don't have to be a guru to understand it well.
    Guillermo

  17. #17
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First time I set it up, yeah it was not the easiest thing to do, but I managed to get it going. Really all it is running the .exe file and then starting the web server.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  18. #18
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,
    Do you know of a good tutorial of Apache for windows?
    I look for something, but I didn't found anything.
    Guillermo

  19. #19
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would suggest just downloading the win binary from http://www.apache.org then try and install it and when you run into problems ask here also check here for help getting php installed with it.

    http://shanx.com/php/install_win32.txt
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  20. #20
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,
    I'll do that
    Guillermo

  21. #21
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should I use PHP4 or stay with PHP3?
    Guillermo

  22. #22
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By all means upgrade to PHP4 there are a ton of new features as well as built-in session support. All the great array function like in_array() and many others are only in PHP4. IFHO there should be no reason people still have php3 on their servers except pure laziness.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  23. #23
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just atttempted installing apache and PHP on my machine and nearly died when i clicked, Start Apache...

    nearly died

  24. #24
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Obviously you have made some sort of boo-boo are you one win98 or win2k?

    Did yo ufollow these instructions?
    http://shanx.com/php/install_win32.txt
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  25. #25
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm on Win 98 and followed the instruction.

    What is suppoesed to happen when you click: Start Apache?

    I think i missed something, what a web root?

    Peter
    <Edited by petesmc on 01-22-2001 at 06:16 PM>


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
  •