This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

SHTML include files
#1

Thanks for what seems to be an awesome program.  I'm intending to purchase a license once i confirm that it will work for me.  Hoping i can ask a question in the meantime.

I am trying to install this on existing SHTML pages.

I've added the following to my .htaccess file so that the php code will execute:


Code:
AddHandler application/x-httpd-php .shtml
AddType application/x-httpd-php .shtml

This is working in terms of the PHP code executing.  The problem is that this seems to block the server side include calls from working.  A typical include for my site looks like this:


Code:
<!--#INCLUDE Virtual="/chronocomic/ccsidenav.shtml"-->

Is there a way to get PHP working on a SHTML page while still allowing the includes?

(If this isn't an appropriate question for this forum, please let me know.   I thought about asking on Stack Overflow first, but i thought that people here would better understand why i was doing this and also may have run into it before.)
Reply
#2

Hi fnord12,

As far as I know, the file is now no longer a .shtml file meaning any server side includes would need to be converted to their PHP equivalent, i.e. <?php include('ccsidenav.shtml'); ?>

However you might want to ask on Stack Overflow anyway just in case there's a way.

Have you completed the interview?
Reply
#3

Thanks Steven.  I think you are right.  And replacing all of the SSIs on my site would be a huge nightmare, but luckily i i've found a way to work around this.  I'll post it here in case anyone else comes along needing something similar.

As background, i'm looking at Commentics as a way to replace the antiquated comments system that came with Movable Type (which stopped being available as an open source product some time ago, but i'm stuck on it).

Since my Movable Type implementation publishes shtml files, I couldn't run Commentics' php code.  And since it uses SSIs, I couldn't just use htaccess as noted above.

What I could do was call a separate php file as an include.  But the problem with that was i couldn't specify the unique ID and reference fields that Commentics needs in the include.

But what i've figured out is that i can pass those variables as part of the include call via the URL.

So in the template that generates my web pages, i now have the following (the <$MT> tags generate the unique values):

Code:
<!--#INCLUDE Virtual=/commentsMT.php?id=<$MTEntryID pad="1"$>&title=<$MTEntryTitle remove_html="1"$>"-->


And this is the entirety of the php include file:
Code:
<?php session_start(); ?>

<?php
$cmtx_identifier = htmlspecialchars($_GET["id"]);
$cmtx_reference  = htmlspecialchars($_GET["title"]);
$cmtx_folder     = '/commentics/';
require($_SERVER['DOCUMENT_ROOT'] . $cmtx_folder . 'frontend/index.php');
?>

I don't know if this is good practice, but it works!
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by johan
02-Oct-2013, 07:34 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)