SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Member MLWJ's Avatar
    Join Date
    Jan 2001
    Location
    Naples, FL
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Before I start, if this is in the wrong forum or if this is a repeated question, I'm sorry... I'm new

    Okay, I want to use PHP and SSI on my main page, but I was wondering if this is possible. And if it is, which extension do I use: .php or .shtml? If it is not possible, can I make it work through .htaccess? I have a couple PHP scripts that I would like to try out to replace current perl scripts that use SSI, but I also use SSI to incorporate my navbar, footer, etc. and would still like to use SSI in that way. If anyone knows if it's possible to use both SSI and PHP on one page, please help

    Thanks in advance.

    Mike

    P.S. if there is any way to incorporate my navbar and other things using PHP instead of SSI, that could be good too. But I would prefer that I could call it from a text file just like I do with SSI. I'm a total newbie when it comes to PHP (and most other languages too) so I have no clue what exactly PHP can and can't do

  2. #2
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Replace all SSI tags with this PHP function:

    <?php
    include("path/to/file.txt");
    ?>

    SSI and PHP can be used on one page, but then the server must be so configured that it looks in .php files for both PHP and SSI tags.
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  3. #3
    cd /pub; more beer diacono's Avatar
    Join Date
    Dec 2000
    Location
    Horsham, West Sussex, UK
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well i actually asked the same no so long ago.

    what you could do is make apache parse excutables instead of *.shtml. but it only works if your running a *nix server and i can get complicated.

    stick to php includes!
    DIEGO MOORE

  4. #4
    SitePoint Member
    Join Date
    Jan 2001
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is kind of off the subject, but it has been bothering me for a while. Allright, I can include() a file in the same directory. I can also do it in the main directory of the file using the file path (from where the PHP is installed I'm assuming) such as "include("/home/webpage/www/file.php");" where "www" is the MAIN directory. However, between those two, I can't get to any files using include(). For example, if I have a folder in the main folder entitled "html," and I use the following "include("/home/webpage/www/html/file.php");" I get an inclusion error. Anyone know of a solution? I hope I was clear enough.

    -Colin

  5. #5
    SitePoint Addict WebMasterAJ's Avatar
    Join Date
    Aug 2000
    Location
    Miami
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I get the same error when I tried it. Can anyone help us?
    Andrew Tatum
    FinHeaven & Co - Get Drenched With Finformation
    The FinHeaven & Co Forums

  6. #6
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:

    include("/html/file.php");
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  7. #7
    SitePoint Member MLWJ's Avatar
    Join Date
    Jan 2001
    Location
    Naples, FL
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help!

    But after the post by htmletc, I saw that I get the same problem too when I try to require two files that my poll script needs. It only works when the two files are in the same directory. For example, the poll files are in the /poll directory of the main directory. In my page, I have these two items:

    <?php require ("/poll/poll_header.php"); ?>

    That is at the VERY top of the webpage (before the <html> tag)

    <?php require ("/poll/poll.php"); ?>

    This tag is where I want the poll to appear.

    This is the error I get when I try to run my website:

    Fatal error: Failed opening required '/poll/poll_header.php' (include_path='.:/usr/local/lib/php') in /home/MLWJ/public_html/main.php on line 1

    BUT, I tried putting main.php in the same directory as the poll files (/home/MLWJ/public_html/poll) and change the paths to the files from /poll/poll_header.php to just php_header.php and from /poll/poll.php to just poll.php and it worked! But I don't want to run my main page from the poll directory or I don't want the poll files to run from my main directory. Is there any way I can get this to work properly? What am I doing wrong? Any help would be appreciated. I'm a total newbie to PHP, so please reply with some details because otherwise I won't know how to do it... hehe

    Thanks in advance,

    Mike

  8. #8
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure, but check your permissions on those files.

  9. #9
    SitePoint Member MLWJ's Avatar
    Join Date
    Jan 2001
    Location
    Naples, FL
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Permissions are set to 755, but that can't be the problem because the poll script works when it is in the same directory as the poll files and they prob. wouldn't work if permissions weren't set correctly. Can the main page that calls the php be CHMOD to 644 or does that have to be 755 or something? I think it can stay at 644 because it runs and the php works when it is in the same directory as the files. I would really like to know what's wrong. I am totally baffled! Any other suggestions? Thanks in advance.

    Mike

  10. #10
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It really depends on what you are using the PHP for...

    If you go here:

    http://www.beartoothbullets.com/tips/index.htm

    That index.htm file has been up for ages, but my client needed me to convert it to a database format. So, people had the index.htm page bookmarked, as well as http://www.beartoothbullets.com/tips/

    And it's a huge website, which was done all in static HTML (which is being fixed!) so to save time I configures my .htaccess for SSI to parse .htm pages. I then called in my SSI tag the PHP script, which makes my dynamic *.htm pages!

    Give it a shot.... I promise it works!
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  11. #11
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Herndon, VA
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think php can do everything ssi can do, so just make everything in php
    --
    Coolrandomfree- Download stupid movies and do stupid stuff!
    Coolrandomfree Message Boards


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
  •