Lord help us all Iāve been put in charge of the website! lol
I am trying to get either SSI includes or PHP includes to work on my site. Iām starting small with the dateā¦
Hereās my problem. I know PHP is installed on the server because I have submit form on there that I made with Flash and use PHP to run.
On my index page I tried a PHP include:
<?php include('date.html'); ?>
and I tried an SSI
<!--#echo var="DATE_LOCAL" -->
I canāt get the PHP include to work at all and the SSI include works if I change the file name to index.shtml but when I do that I get a listing of all files on my site instead of the index page.
My website is www.soacorp.com if that helps at all.
Much thanks
JustSara
Your PHP includes should obviously be in a page that has the extension .php.
And the include tag should look something like thisā¦
<? include("yourFile.txt") ?>
And as for your SSI includesā¦ I donāt see why it would list all your files. To me that doesnāt seem like something an include could do. Could be something else in your file that is conflicting with the .shtml extention I guess.
If that link was supposed to be to the page where the error with the .shtml extension occurs, I donāt see any problem on there :-\
Heh, I had the actual code in my original message but it didnāt show it. Youāre absolutely right, to use the PHP file my page should have been index.php but when I changed it to that the include still wonāt show up. :āā-(
The SSI include isnāt what is showing all my files. When I changed index.htm to index.shtm the browser didnāt see it as the āindexā page at all and instead listed the entire directory.
With the PHPā¦ are you 100% positive that the files are linked directly.
I know if you are using programs such as Dreamweaver for Frontpage they have a habit of writing the full URL of the file on your hard drive instead of the URL it would be on in the server.
As for the SSIā¦ that is friggin weird. I know some servers allow you to use SSI while having the extention .html, but others force you to have the extention .shtml for the SSI to work. But if .shtml doesnāt work, your page will still load, it just wonāt show the includes.
Did you talk to the your host or the server tech support?
sigh Somedays I forget how to spell my own name and I think this is one of them. Iāve tried your suggetions but itās still not working. I have a test page up at www.soacorp.com/date.html The date and time should show but it doesnāt and Iām completely frustrated. Could you please take a look?
Sara
P.S. Iād rather use PHP then HTML butā¦ baby stepsā¦ =)
Iām trying to do 2 things. I really am trying to get the time to show on my pages but Iām mostly trying to figure out how to use Server Side Includes. I thought Iād start with something simple, like the time, but itās not working out very well. shrugs I might have to break down and buy a book.
redViperā¦ I changed the āvirtualā to āfileā and nothing showed up. I also changed the āhtmlā to āshtmlā and still nothing showed up. Iām getting ready to put the blame on my ISP. =)
*Originally posted by redViper *
**yea, for SSI you need a .txt file, and not php/html. and im 99% sure the file has to be .shtml - but im not 1% sureā¦ **
It depends on your server. Certain servers (such as linux) require the file to be .shtml extentions, but others allow you to use .html.
Also, I believe some servers also make you use .shtm because it can only read 4 letter extentions. Maybe try that JustSara.