Help - Search - Members - Calendar
Full Version: Use php and ssi in same page
Movable Type Community Forum > Additional Resources > Tips and Tricks
Sproet
Hi,

since I use ssi to include stuff for my boyfriend's weblog, I had some trouble figuring out how to use the php needed to exclude a particular category from the blogentrycount.

My indexpage has an .shtml instead of .php extension, so therefor I can't use .php directly on the indexpage.

But! I found out how!

First you need to make a new index template, I called it blogcount.php, and put this code in it:

CODE
<?
$all="<$MTBlogEntryCount$>";
$not="<MTCategories><MTFilterCategories include="category you want to exclude">
<$MTCategoryCount$>
</MTFilterCategories></MTCategories>";
echo $all-$not;
?>


Replace "category you want to exclude with the name for that category.

Then, put the following code on the page where you wish to use the .php code:

CODE
<!--#include virtual="/dirofindexpages/blogcount.php"-->


and replace /dirofindexpages/ with the name of the directory where all your indexpages such as index.shtml are located. Easier said: the name of the directory where the Main Index page of your weblog is located. It is very important you get that right, otherwise it just does not work!

Well, rebuild the indexpages and you should be all set!
gary shah
This is interesting.

I am in the process of PHPfying my MTsite. However, my pages at this time are .shml --- as i have few SSI calls to certain "perl" scripts.

It appears that there is no clean way to run SSI to cgi scripts within PHP (unless you are on Apache and I am on IIS) ===> so, taking your hint -- could I have "index.shtml" which parses PHP page generated by MT and handles SSI call to perl ?

On first quick attempt, .shtml do not seem to parse PHP code and just skips over it.

Any hints?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.