Help - Search - Members - Calendar
Full Version: mt tags displyaed on php inlcude
Movable Type Community Forum > Additional Resources > Tips and Tricks
imbuez
Hello

I have a wee problem, i have cut my sidebar code from the main index and placed in a folder called includes/.

So all should be good yeh? No i doesnt seem to be... i meanits pulling out the include but i guess it know that the include isnt inthe root? and so it mt does n ot recognise these tags.

Can anyone hlp pls?

thnkas in advance
edgore
If I understand correctly what you are trying to do, you need to handle it a little differently (I think).

I have my site (www.edgore.com) set up so that the sidebar is a separate file, that get's included in all of the other pages.

The problem that you are running int can be solved by doing the following:

Cut the current sidebar section out of your main index template.

Replace it with the following:

include '/full path to your root/snippet.html';
?>

At the top of the template page, change the output file to index.php

Save your index template.

No create a new index template called "Snippet" with an output file of snippet.html. Set it to reuild with indexes (should be the default).

Paste the sidebar stuff that you cut out of your main index template into this.

Rebuild your site.

Delete the file index.html from the root - you don't need it anymore - now you have an index.php file.

Go to your site - if you did everything right, the sidebar should be automagically included.

You can also futz with your archives to get the sidebar to appear there if you want - just change the archive file extennsion to php and put the include statement in them as above.

If you ever want to chagne the sidebar, all you need to do is edit the snippet template and the changes are reflected everywhere it's used - I've found this very useful since I am using MT to manage all the content on my site, including the static pages.

If you want more help with this, let me know, I've got it working well on my site.
imbuez
Thanks very much edgore.
Your reply was very helpful. My problem seemed to be that i didnt create a new index template.
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.