I have successfully created a JS index template, and I include it like this:
">
What I really want, however, is to have this template be under "System Overview", instead of under the blog I'm working on. The reason: this js file contains a library of functions, and I want to have all of my blogs include it. That way, instead of creating the same template over and over in each blog as an index template, I create it once under System Overview, and all blogs reference it.
When I tried this, it failed. I notice that under System Overview, there are no Index Template, so I created it as a Module Template. When I attempt to rebuild the site, I got an error message: Can't find template "MY_JS".
Putting in a value on this template for Template Options > Link to File did not seem to help at all.
Is there a way to get this work, or am I attempting to use the System Overview templates for a purpose they weren't intended for?
(BTW, I wish to do the same thing for css and php.)
Thank you.
Reported on Movable Type 4.3
Hi,littleboyazure
Have you created your own module template as "Global Templates", haven't you?
In MT4.x, as you said, you can set your own global templates along
Dash board -> System Overview -> Design Templates -> Template modules
Then, you can include your global template from your local blog template.
For example, in case the name of global template is "MY_JS",
<p$mt:include module="MY_JS"$>
then your local index will iinclude your global template "MY_JS" and source code will be modified.
If you haven't include your template in your each blog's local index templates, please examine it.
For more information:
AFA my memory was right, even if there would be the same name "MY_JS" module template in your each blog's local template sets, the same name's global template would be included preferentially. Be sure that.
METHOD # 1
I certainly created my template exactly as you suggested -- I I tried to make that clear in my post.
The problem is that I don't want to include like this:
<$mt:include module="MY_JS"$>
I want to include it like this:
<script type="text/javascript" src="<$mt:Link template="MY_JS"$>"></script>
In other words, I don't want the CONTENTS of the system module template to be included. Instead, I simply want the system module template to generate an output file, and I want to include a REFERENCE to that output file in my template.
(Why? For a million reasons, it is preferable to have the .js in an external .js file which you include.)
This is something that you can do with templates within the blog, but can it be done with templates created on the "system overview" level? That's my question.
My intuition is telling me that this is not possible, because the first include uses module="" while the second form uses template="", and so you can only uses template modules for the first kind, and only index templates (and maybe other kinds of templates) but NOT template modules for the second kind. And since Movable Type does not allow the creation of index templates on the System Overview level, it's starting to look like this just won't work.
METHOD # 2
But you know what? I'd even be satisfied if I could do the following:
<script type="text/javascript" src="<MTBlog>global.js"></script>
where global.js is the output file of the system template. But even though I specified a file under "link to file", it didn't seem to create any output file. So whatever the purpose of "link to file" is, it doesn't seem to be what I need.
METHOD # 3
For now, here's how I've solved the problem:
1. I created my .js content as a System Overview template module.
2. In my blog, I created an index template which does nothing except include that System Overview template module.
3. I then include my "local" index template.
Kind of clunky, but it works.