Help - Search - Members - Calendar
Full Version: Using MT Modules on non MT pages?
Movable Type Community Forum > Additional Resources > Tips and Tricks
witchy
I'm thinking that Kadyellebee would be the best person to ask, since she's the "module" expert biggrin.gif (well ok, since I know she uses them smile.gif )

I know it's been discussed before on the forum, but I can not seem to find the thread.

I was wanting to use the MT Modules header, footer, sidebar on my PHP pages, that are not generated by MT.

sad.gif and since I don't know PHP, and I only "squeek" by with MT, I'm hoping that one of you brilliant ladies, can help me out here.

(*G* pretty please, with a chocolate cookie?)

ok, this is what I used...

QUOTE
*?php include('/home/dwitchy/public_html/journal/<$MTInclude module="header.txt"$>'); ?*


I've also tried it, where it says module="header"
and module="header.php"

if you want to see the page itself it's here

cavet: of course, the page, it's still in it's "infancy" /cavet

Thanks to any one who can help smile.gif

(whoops, code didn't work in the quotes, I changed the < brackets to * )
girlie
Since a module by itself does not generate an output file, you will need to put your header, footer, and sidebar in new Index Templates instead. Then include the output file via PHP.

Example, an Index Template called "sidebar", with output file "sidebar.html". Then include with:

CODE
<?php include('/home/dwitchy/public_html/journal/sidebar.html'); ?>


(When posting code, use the CODE buttons instead of the QUOTE buttons and then you won't have to substitute characters.)
witchy
biggrin.gif Thanks Girlie!! biggrin.gif LOL You just wanted another cookie smile.gif
YUM

Thanks again for the info!
witchy
pooh, I just did it, and I get an error...

QUOTE
An error occurred:


Saving object failed: Duplicate entry '2-header' for key 2
 


sad.gif is this because I already have a header module? (I have not deleted that yet. *G* I'm nervous to delete it, till I had the header.html index template saved)

Also, something I just thought of, I would have to change the
CODE
<$MTInclude module="header"$>
(thanks for the tip girlie, on using the code button) wouldn't I? would I change that to ="header.html"$

thanks again for the help!
bmk
Yeah, I think error is because you have two named the same thing.  So just change the name of the second one so it's not exactly the same as the first.  :)

You can use the php include code that girlie posted (because isn't that where you're heading anyway?) instead of the MTInclude code you've posted.  Or, you would use MTInclude file="header.html"  

It's not a module anymore so MTInclude module isn't going to work.
witchy
EXCELLENT! Thanks Brenna! biggrin.gif (*G* You can have a cookie too biggrin.gif )
witchy
ok, seems I'm not finished picking your brains after all smile.gif

I'm getting this error:
QUOTE
Build error in template 'Main Index': Error in tag: Can't find included file 'sidebar.html'
 


*Smile* what's confusing, is that I can see the sidebar.html Index template there. I even deleted it and re-added it.

and I have it coded in, just like the header and footer includes.

(also, would it be smarter to make them a PHP extension, instead of html?)

and should I link them to a template? (or would I only do that, when I finally figure out how to do the skinning? /yes Brenna, I'm using yours and Kristine's tuts for that/ biggrin.gif

I tried putting the sidebar.html code in the footer.html part, but I still come up with the same error.
bmk
If you're going to do skinning, set up your pages with .php extensions.  I'd also skip trying to do it with MTInclude file altogether, and use the php include code girlie wrote above.  That's what you will need to use with the skins.
witchy
YES! biggrin.gif
Thank YOU for being so patient smile.gif

ok, I set the header, etc up as php.
for some reason I kept getting an error (parse error). *G* But than, (finally), I copied and pasted exact, and I had left out the parenthesis (*G* had to look that word up, I mean, How Often do you spell parenthesis?)

Anyway, it's working Great now! and Thank you, because I was in the middle of learning how to skin, when all the server problems started, and I'd like to start everything off right, to continue that process smile.gif

Thanks!
nammer
Witchy, just in case you haven't seen this, or anyone else comes by this thread wanting to know more about skinning, here's a direct link to Krisitne's skinning tutorial; she shows cut-and-paste code that makes skinning easier to understand when thinking in terms of MT (at least it did for me  :p).
witchy
hey nammer, Thanks smile.gif and yes, I've got it book marked smile.gif

Thanks for leaving the link biggrin.gif
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.