Jump to content

.shtml file includes


catweasel

Recommended Posts

Hi,

 

I am using a Content Management System that generates .shtml pages. I would like to display an RSS Newsfeed on a page that requires me to insert a php include like the following :

 

require_once "/path/to/carp.php";

CarpCacheShow("http://domain_name.com/path/to/rss/feed/file");

?>

 

However, the generated .shtml page displays this error message :

[an error occurred while processing this directive]

 

I would like to know whether I can display a 'php include' within a .shtml file. I have read on message boards/Google that the error may be down to my Server configuration.

 

I have tried options such as adding : AddType application/x-httpd-php .shtml

to my .htaccess file, but this does not work (adding this just downloads my index.shtml file to my desktop!).

 

Any help/ideas much appreciated.

 

Thanks,

Ray

 

Server: Unix; Ubuntu Linux (php 4 and 5)

Link to comment
Share on other sites

Try:

 

AddHandler x-httpd-php .shtml

 

If that doesn't work, check your hosts help files - I discovered when I worked on the above that hosts may have different requirements for their htaccess files - the above works on Godaddy.

Link to comment
Share on other sites

Hi,

 

Thanks for your replies.

 

AddHandler x-httpd-php .shtml

 

I tried adding the above to the .htaccess file, but this still gave the same error message. I have put another Support question into my Hosting company, asking if there any specific requirements for the .htaccess file. (Unfortunately I never get the same Support person, so we end up going around in circles :mad:)

 

Thanks for your help.

Link to comment
Share on other sites

If you succeed in changing .shtml to .php so that the page is processed as PHP, will the SHTML work? Some codes are different in SHTML. Unless AddHandler means that it processes both, which I think is unlikely.

 

Does your hosting service support PHP?

 

Why not use a SHTML "include" for a complete .php file set up with PHP? The included PHP file with doctype, html tag, head section and body should be processed as PHP first, then included by the SHTML "include". This would not involve any edits to .htaccess.

Edited by Wickham
Link to comment
Share on other sites

If you are using godaddy, you might need to use this in your .htaccess file instead of AddHandler x-httpd-php .shtml

 

 

AddHandler php .shtml

 

If you succeed in changing .shtml to .php so that the page is processed as PHP, will the SHTML work?

 

Maybe you can save your code in a separate file, like rss-feed.php, and then include using .shtml includes.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...