The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

2 Pages V  1 2 >  
Reply to this topicStart new topic
> SSI includes - Apache, date formats
ShadowyBob
post Oct 26 2006, 05:20 PM
Post #1


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



I've sussed out how to add a line for including the date a document gets modified and how to format that output:
CODE
<!--#config timefmt="%A %d %B, %Y, %r" --><!--#flastmod file="aatest.htm" -->
I also know that there is an
CODE
echo var="DATE_GMT"
to get a date into GMT format. What I can't figure is how to combine the two, nor how to change GMT to BST. Help!


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 26 2006, 05:34 PM
Post #2


.
********

Group: WDG Moderators
Posts: 6,288
Joined: 10-August 06
Member No.: 7



Maybe you can find something about SSI here: http://bignosebird.com/sdocs/echo.shtml

Otherwise I suspect PHP is better suited for things beyond mere inclusions. ;-)


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ShadowyBob
post Oct 26 2006, 05:55 PM
Post #3


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



Thanks Christian J, I've now amended my
CODE
<!--#flastmod file="aatest.htm" -->
to
CODE
<!--#echo var="LAST_MODIFIED"-->
but even that link doesn't mention how to combine two variables.

From this and other postings, quite a few of you have now mentioned that I should be using php for my various 'includes'.

Now my very basic understanding of php says I can include htm docs in a php document but not the other way round. Can you please either explain or point me in the direction of a simple tutorial?

This post has been edited by ShadowyBob: Oct 26 2006, 05:56 PM


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 26 2006, 06:22 PM
Post #4


This is My Life
*******

Group: Members
Posts: 1,120
Joined: 24-August 06
From: t-dot
Member No.: 16



QUOTE(ShadowyBob @ Oct 26 2006, 06:55 PM) *

From this and other postings, quite a few of you have now mentioned that I should be using php for my various 'includes'.

Now my very basic understanding of php says I can include htm docs in a php document but not the other way round. Can you please either explain or point me in the direction of a simple tutorial?


You basically are gong to including php functions within an html document. You will use these functions to include other html or add your time and dates, etc.,
The only monkey wrench in this equation is whether you have to call your documents webpage.php or webpage.html and that depends on your server setup.

Here's the simple PHP starter tutorial that many people start with
http://ca3.php.net/tut.php

This post has been edited by jimlongo: Oct 26 2006, 06:24 PM


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ShadowyBob
post Oct 26 2006, 06:57 PM
Post #5


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



QUOTE(jimlongo @ Oct 27 2006, 12:22 AM) *
The only monkey wrench in this equation is whether you have to call your documents webpage.php or webpage.html and that depends on your server setup.

Here's the simple PHP starter tutorial that many people start with
http://ca3.php.net/tut.php


Thanks for this jimlongo.

Queries:
  1. Is there a simple test page I can use to determine if my server can process php from html files
  2. Thanks for the tutorial link. I can create basic php pages and cosmetically edit existing ones, but can find no examples anywhere of how to include php within an html document
Do you have any examples of how php can be used to include headers in numerous html pages and how to include a file modified date on all my pages?


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 26 2006, 07:24 PM
Post #6


This is My Life
*******

Group: Members
Posts: 1,120
Joined: 24-August 06
From: t-dot
Member No.: 16



here's how to include one html document inside another using php -> here's a header and a menu inside their own CSS DIV's
CODE

<body>
<!--HEADER-->
<div id="header">
<?php        
include( 'mypages_header.html' );
?>
</div>
<!--MENU-->
<div id="Menu">
<?php        
include( 'mypages_menu.html' );
?>
</div>




This post has been edited by jimlongo: Oct 26 2006, 08:00 PM


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 26 2006, 07:59 PM
Post #7


This is My Life
*******

Group: Members
Posts: 1,120
Joined: 24-August 06
From: t-dot
Member No.: 16



QUOTE(ShadowyBob @ Oct 26 2006, 07:57 PM) *


Is there a simple test page I can use to determine if my server can process php from html files


put this in a document and call it phpinfo.php
CODE
<HTML>
<?php phpinfo(); ?>
</HTML>

Then retrieve it with a browser, it should show you a long list of your php installations configuration


----
Then change the name of the document to php_info.html and see if it still works. If not then you need to change something on your server, which is easy if you have control panel access or can put an .htaccess file on an Apache server.


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ShadowyBob
post Oct 27 2006, 09:25 AM
Post #8


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



jimlongo, just what I needed! Thanks ever so much.

I've done as you said and created the phpinfo.php with the php instructions inside the <html> tags. This works fine just like an ordinary phpinfo.php file. I then changed the file extension to .html - no luck :-(

I already have an .htaccess.html file with Options + Includes in. What would I have to include to get the html/htm files to process php commands? (NB, I already have a sub-domain running a phpbb forum, so wouldn't want to affect that!)

Finally, I understand very clearly your instructions for a file inclusion, thanks. Any suggestions for how to include a file-modified date/time showing GMT/BST info. (my server's time is currently showing CEST, which is one hour more than BST)?

This post has been edited by ShadowyBob: Oct 27 2006, 09:29 AM


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 27 2006, 09:33 AM
Post #9


This is My Life
*******

Group: Members
Posts: 1,120
Joined: 24-August 06
From: t-dot
Member No.: 16



To be able to run php within an html document you need to add the following directive in your .htaccess file

CODE
AddType application/x-httpd-php .php .php4 .php3 .phps


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Peter1968
post Oct 27 2006, 10:30 AM
Post #10


Serious Coder
*****

Group: Members
Posts: 446
Joined: 23-September 06
Member No.: 213



QUOTE(jimlongo @ Oct 28 2006, 12:33 AM) *

To be able to run php within an html document you need to add the following directive in your .htaccess file

CODE
AddType application/x-httpd-php .php .php4 .php3 .phps



Which, if Shadowybob is running phpBB, he'd already have, or it'd be stated in httpd.conf. I suspect the latter.

To include the date within your page you'd add
CODE
<?php date(parameters); ?>
in the place you'd want to insert it, and the page will need the php extension for it to be parsed correctly.

The date() command has a multitude of options.
http://www.php.net/manual/en/function.date.php
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ShadowyBob
post Oct 27 2006, 10:32 AM
Post #11


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



jimlongo, thanks.

To re-cap, I now have a file phpinfo.html containing the following:
CODE
<html>
<?php phpinfo(); ?>
</html>

and an .htaccess.html file containing
CODE
Options + Includes
AddType application/x-httpd-php .php .php4 .php3 .phps


Sorry jimlongo, but when I browse to phpinfo.html all I get is a blank screen:-(

If I get this to work, I think I've now found out how to do a file-modified date:
CODE
<?php echo "Last modified: " . date( "F d Y. H:i:s a", getlastmod() ); ?>
All I need is a time-zone command that works.

This post has been edited by ShadowyBob: Oct 27 2006, 10:32 AM


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 27 2006, 12:00 PM
Post #12


.
********

Group: WDG Moderators
Posts: 6,288
Joined: 10-August 06
Member No.: 7



QUOTE(jimlongo @ Oct 27 2006, 04:33 PM) *

To be able to run php within an html document you need to add the following directive in your .htaccess file

CODE
AddType application/x-httpd-php .php .php4 .php3 .phps



The above makes the PHP engine look for PHP scripts in files ending with the specified extensions .php .php4 .php3 .phps. To make it work with .html extensions you must add that one too. You can probably delete the rest if you're not going to use them anyway, but maybe it's good to keep at least .php (like if you include a .php file in a .html file)?

CODE
AddType application/x-httpd-php .php .html


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ShadowyBob
post Oct 27 2006, 12:41 PM
Post #13


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



Christian J, makes perfect sense.

To avoid typos, I copied and pasted your code into my .htaccess.html, but still a blank screen when I browse to phpinfo.html :-( (my feeble attempt at tears)


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 27 2006, 03:23 PM
Post #14


.
********

Group: WDG Moderators
Posts: 6,288
Joined: 10-August 06
Member No.: 7



QUOTE
.htaccess.html


The file is just called ".htaccess", nothing more.


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ShadowyBob
post Oct 27 2006, 05:33 PM
Post #15


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



Thanks again Christian J. I thought I'd tried this some time ago, but just to check, I renamed it to .htaccess.

Then I saw why I'd abandoned that idea!

QUOTE
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, cfWEBADMIN and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

??

This post has been edited by ShadowyBob: Oct 27 2006, 05:34 PM


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 27 2006, 05:37 PM
Post #16


.
********

Group: WDG Moderators
Posts: 6,288
Joined: 10-August 06
Member No.: 7



Oops. Sounds like you should contact them. tongue.gif


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 27 2006, 05:41 PM
Post #17


This is My Life
*******

Group: Members
Posts: 1,120
Joined: 24-August 06
From: t-dot
Member No.: 16



Sounds like you're not allowed to place .htaccess files, many servers don't allow that.

Do you have a Control Panel? Very oftern you can set these options there.
That's how mine are set, as is evidenced by the incomplete apache directive i gave you.

This post has been edited by jimlongo: Oct 27 2006, 05:47 PM


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ShadowyBob
post Oct 27 2006, 07:41 PM
Post #18


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



Yes jimlongo, I have a Control Panel, but have looked in vain for anything that looks like I can ask for .htaccess or anything else.

However, I noticed that I can password-protect my directories, so I did just that. Guess what an .htaccess file was added to my web site!

I then ftp'd that to my PC, returned to the Control Panel and removed the password-protection. Interestingly it left an empty .htaccess file behind.

I removed everything from the downloaded .htaccess file, inserted
CODE
AddType application/x-httpd-php .php .html
and ftp'd it back to the server.

This time, when trying to open phpinfo.html, my browser downloaded it to my PC instead of viewing it! (the downloaded file is just a blank screen with a source code of
CODE
<html>
<?php phpinfo(); ?>
</html>


Does this never end?


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Oct 27 2006, 08:16 PM
Post #19


This is My Life
*******

Group: Members
Posts: 1,120
Joined: 24-August 06
From: t-dot
Member No.: 16



Nice try Shadowy Bob! Very resourceful of you smile.gif

Look in the cPanel Web Options or something like that, look for anything PHP.


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ShadowyBob
post Oct 27 2006, 08:36 PM
Post #20


Advanced Member
****

Group: Members
Posts: 101
Joined: 6-October 06
From: Peterborough, UK
Member No.: 354



Didn't I do enough? And if so, what did I do wrong?

The only thing in my Control Panel that looks anything like, is a thing called Directory Manager. Inside this are three options, all of which automatically produce a completed .htaccess file. They are: 'Password Protection', 'IP Filtering', and 'Lock Access'. I can't find any other reference to a .htaccess file. There is a 'Script Scheduler' within a PHP/MySQL section, but this does not seem to be anything I would know how to use, nor does it seem relevant.

This post has been edited by ShadowyBob: Oct 27 2006, 08:37 PM


--------------------
Default Browser: IE v7.0.5730.11; others: Mozilla Firefox v 1.5.0.7, Netscape 7.0, Opera 9.0;
OS: Windows XP Home SP2 (automatic updates);
Text editor: TextPad v 4.7.3.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

2 Pages V  1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th December 2014 - 10:24 AM