php includes in dynamic archive templates

I was having a heck of a time calling includes into dynamic archive pages (php files, no extensions). The syntax I used in my Main Index template was NOT working in my dynamic archives. What I found out was that I was using a php shortcut syntax which is not enabled on all servers (and perhaps in my case not in all cases? not sure about that yet - I'll look into an .htaccess solution although I have no reason to believe there is one - just a gut instinct to try)

These worked in the main index, but not in archives:

<? include "http://domain.com/tagline/rotator.php"; ?>

or
<? include "tagline/rotator.php"; ?>

This syntax works in both index AND archives:

<?php include ("http://domain.com/tagline/rotator.php"); ?>

or
<?php include ("links.inc"); ?>

Cool.

Update: having a big "duh!" moment. Forgot about MTInclude as well as plugin MTIncludePlus. The latter provided a solution (new tag MTIncludeURL) for calling includes into my comments.cgi page. (comment listing template,etc) Here's an example of what I used to call a rotating tagline into my banner in dynamic templates that run as cgi:

<MTIncludeURL timeout="15">http://domain.com/tagline/rotator.php</MTIncludeURL>

(obligatory reminder: code is all one line)

NOTE: MTInclude and MTIncludePlus tags slow down the rebuild process. (I only use these tags when a regular php include won't do.) To speed up these tags, consider the MTFastInclude plugin at MTExtensions.

About this Entry

This page contains a single entry by Kate published on March 14, 2005 10:51 PM.

input styles was the previous entry in this blog.

php includes in cgi templates is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.