Jump to content

Recommended Posts

Posted

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)

Posted

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.

Posted

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.

Posted (edited)

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
Posted
If you succeed in changing .shtml to .php so that the page is processed as PHP, will the SHTML work?
Good point - hadn't thought of that - but I don't know one way or the other.
Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...