At long last, we're moving to forums powered by, well, Movable Type itself. You'll want to bookmark http://forums.movabletype.org/ for future reference, and in the meantime you can view these old forums as a read-only archive of past posts. Thanks for being part of the community!
![]() ![]() |
Oct 25 2007, 05:18 AM
Post
#1
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
I've been using MT as a CMS for a few years, and MT4 has made it far easier. Here are some tips and tricks I've put together on using MT4 to power an entire site. Please add your own!
1. Pages, entries, folders and categories: understanding the pieces of MT For anyone serious about using MT as a CMS, I'd advise looking at the default templates provided, then ditching them and starting fresh. (Don't worry, you can always find them again here.) You'll learn more about how it all works, and you can build in as much flexibility as you need. * Pages are the most important part of the CMS. They form the relatively static meat-and-potatoes of your site. Examples: About Us, Contact, Staff, Financial info... you get the idea. Pages differ from entries in that they simply present information, and may not be updated often. * Folders are key for structing your site. All pages about your organization may go in one folder, pages about your work and mission in another, and pages about your publications in a third. Depending on how big your site is, you may even have subfolders. Remember that the key page in each folder should have the basename index. * Entries are for constantly updating information. You can use entries for a news feed or a blog, for example. * Categories, like folders, are a way of organizing your entries. They're not necessary, though -- you might prefer tags instead. * Index templates can be full of MT template tags. These are great for Home pages, where you can bring together a bunch of updating content. They're also handy for CSS and RSS files. Your finished site might look like this: Home (index template) About (folder) * About us (page) * Our mission (page) o Financials (subfolder) + Financials (page) + Annual reports (page) Blog (folder) *Blog (index template bringing entries together, or a page with template tags (use processtags plugin) This post has been edited by caribou: Oct 25 2007, 05:23 AM -------------------- |
|
|
|
Oct 25 2007, 05:19 AM
Post
#2
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
2. Navigation
Now you have a structure for your site, so how do visitors navigate around it? You can create top-level navigation by outputting a list of all the top-level folders: CODE <ul> <MTToplevelFolders> <li><a href="<MTBlogURL><MTFolderPath>"><MTFolderLabel></a></li> </MTToplevelFolders> </ul> On each page, you can show the other pages and subfolders within the current folder: CODE <mt:setvarblock name="currentfolder"><MTPageFolder><MTFolderLabel></MTPageFolder></mt:setvarblock> <ul> <MTPageFolder> <MTPages folder="$currentfolder"> <li><a href="./<MTPageBasename>.php" id="<MTPageBasename>"><MTPageTitle></a></li> </MTPages> <MTSubFolders> <li><a href="<MTBlogURL><MTFolderPath>/index.php"><MTFolderLabel> »</a> <ul> <MTPages><li><a href="<MTPagePermalink>"><MTPageTitle></a></li></MTPages> <MTSubFolderRecurse> </ul> </li> </MTSubFolders> </MTPageFolder> </ul> And a trail of breadcrumbs on each page will help visitors understand where they are in your site: CODE <a href="<MTBlogURL>">Home</a> » <MTParentFolders> <a href="<MTBlogURL><MTFolderPath>"><MTFolderLabel></a> » </MTParentFolders> <strong><MTPageTitle></strong> If you want to see your whole navigational structure in one place, as in a sitemap, try: CODE <ul>
<MTTopLevelFolders> <li><a href="<MTFolderPath>"><MTFolderLabel></a></li> <ul> <MTPages> <li><a href="<MTPagePermalink>"><MTPageTitle></a></li> </MTPages> </ul> <ul><MTSubFolderRecurse></ul> </MTTopLevelFolders> </ul> This post has been edited by caribou: Mar 13 2008, 05:52 AM -------------------- |
|
|
|
Oct 25 2007, 06:00 AM
Post
#3
|
|
|
Group: Members Posts: 416 Joined: 19-August 03 Member No.: 14,803 |
You might consider adding your code tidbits to the Cookbook. Thanks for the tips, BTW.
-------------------- Dan
uiNNOVATIONS: Web development with a focus on ui and Movable Type. Eat Drink Sleep Movable Type: featuring the Poll Position, Better File Uploader, and Hot Date plugins, amongst others. |
|
|
|
Dec 15 2007, 10:12 PM
Post
#4
|
|
|
Group: Members Posts: 7 Joined: 19-June 03 Member No.: 12,440 |
Added to the cookbook template tag recipes, with full credit to caribou. Brilliant work, caribou!
Have also added this: a listing of all pages, sub-folders and pages in sub-folders except the current page. This is conceivably useful in a sidebar listing. CODE <ul> <mt:setvarblock name="curpage"><mt:pageid></mt:setvarblock> <MTPageFolder> <MTPages sort_by="title" sort_order="ascend"> <mt:setvarblock name="listpage"><mt:pageid /></mt:setvarblock> <mt:unless name="listpage" eq="$curpage"> <li><a href="./<MTPageBasename>.php" id="<MTPageBasename>"><MTPageTitle></a></li> </mt:unless> </MTPages> <MTSubFolders> <li><a href="<MTBlogURL><MTFolderPath>/index.php"><MTFolderLabel> »</a> <ul> <MTPages><li><a href="<MTPagePermalink>"><MTPageTitle></a></li></MTPages> <MTSubFolderRecurse> </ul> </li> </MTSubFolders> </MTPageFolder> </ul> Incidentally, note the horrible error in the MT Template Tag Reference Documentation on the <SubFolderRecurse> tags. That code reads: CODE <MTTopLevelFolders> <MTSubFolderIsFirst><ul></MTSubFolderIsFirst> <MTIfNonZero tag="MTFolderCount"> <li><a href="<$MTFolderArchiveLink$>" title="<$MTFolderDescription$>"><MTFolderLabel></a> <MTElse> <li><MTFolderLabel> </MTElse> </MTIfNonZero> <mt:SubFolderRecurse> </li> <MTSubFolderIsLast></ul></MTSubFolderIsLast> </MTTopLevelFolders> This is totally wrong. There's no such thing as <MTSubFolderIsFirst>, <MTSubFolderIsLast> or <MTFolderArchiveLink> (what the heck is that, even conceptually?) tags. |
|
|
|
Dec 16 2007, 03:40 AM
Post
#5
|
|
|
Group: Members Posts: 1,665 Joined: 15-June 06 Member No.: 35,860 |
There's no such thing as <MTSubFolderIsFirst>, <MTSubFolderIsLast> or <MTFolderArchiveLink> (what the heck is that, even conceptually?) tags. You reported these via the feedback form, right? You apparently didn't leave a comment on that page, either, which also would be helpful. The tags should exist, and were apparently left out of the release. They were presumably intended(at some point at least), or how would they have ended up in the docs? FolderArchiveLink would be a link to a page corresponding to that folder. Folders are, by and large, functionally equivalent to categories for entries. What's your conceptual problem with that? I'm not sure there's a proper archive type for it right now, though, unless they get bunched in with cat archives(which wouldn't seem right to me, but hey). |
|
|
|
Dec 17 2007, 06:59 AM
Post
#6
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
Thanks guys, I'm glad you find it helpful.
-------------------- |
|
|
|
Feb 14 2008, 11:21 AM
Post
#7
|
|
|
Group: Members Posts: 17 Joined: 2-February 08 Member No.: 52,311 |
Thank you caribou for you great info!! Very helpful!!
|
|
|
|
Mar 13 2008, 04:44 AM
Post
#8
|
|
|
Group: Members Posts: 30 Joined: 10-June 05 From: sydney, australia Member No.: 31,649 |
This looks great, and appears to be exactly what I need, but for the life of me, implementing it doesn't give me the promised results!! I'd love some input from someone as to where I'm going wrong!
I want to use this code to spit out a sub menu of pages relevant to the folder they're in - but using this code 'as is' returns a list of page names, some of which aren't actually in the folder. Of course the code is applying the site name and folder name to the url so the list doesn't necessarily create relevant links either... ( I have removed subfolder relevant information as I'm not using subfolders) CODE <ul> <mt:setvarblock name="curpage"><mt:pageid></mt:setvarblock> <MTPageFolder> <MTPages sort_by="title" sort_order="ascend"> <mt:setvarblock name="listpage"><mt:pageid /></mt:setvarblock> <mt:unless name="listpage" eq="$curpage"> <li><a href="./<MTPageBasename>.php" id="<MTPageBasename>"><MTPageTitle></a></li> </mt:unless> </MTPages> </MTPageFolder> </ul> I can get something approximating what I want if I use the following. CODE <div id="pagesidebar"><img src="<MTBlogURL>images/sidebar1top.gif" /> <MTPageFolder><h3><MTFolderDescription></h3> <div id="navcontainer"><ul> <mt:setvarblock name="curpage"><mt:pageid></mt:setvarblock> <MTPages folder="1-about" sort_by="title" sort_order="ascend"> <mt:setvarblock name="listpage"><mt:pageid /></mt:setvarblock> <mt:unless name="listpage" eq="$curpage"> <li><a href="./<MTPageBasename>.html" id="<MTPageBasename>"><MTPageTitle></a></li> </mt:unless> </MTPages> </MTPageFolder> </ul></div><!--end div navcontainer--> <img src="<MTBlogURL>images/sidebar1bottom.gif" /></div> <div id="mainContent"> You can see that the only difference is that I've put a folder attribute in the MTPages tag. This brings up the correct list BUT, clearly brings up the SAME list on all of the pages so it isn't specific to the folders... I've tried replacing the folder attribute with various folder template tags line MTFolderDescription or MTFolderLabel but then the list disappears altogether. I'm making really good strides figuring this kind of thing out on my own but I've come up stumped and I'm running out of time... so I'm hoping I can draw out an answer here! Can anyone offer any insight into where I'm going wrong? if it helps the folder structure looks like this 6 folders all labelled using the following syntax 1-[Label] 2-[Label] etc (so they're in the order I want) One word descriptions applied to each folder which are being used as the navigation titles. 21 pages in total. all stored in the correct folder, none of which have tags, and all of which are published. Not even sure if I'm giving you TMI but I figure every bit helps... Thanks in advance! Deeleea -------------------- Those who can do; those who can't end up here...
|
|
|
|
Mar 13 2008, 05:47 AM
Post
#9
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
Hi Deeleea,
I think I see what's happening. When you use MTPageFolder tags, MT only applies that context to folders. If you ask for a list of pages within MTPageFolder, it will look for all pages in all folders. Kind of unintuitive! The easy workaround is to set the current folder as a variable at the top of your page template: CODE <mt:setvarblock name="curfolder"><MTPageFolder><MTFolderLabel></MTPageFolder></mt:setvarblock> And then list your pages with: CODE <MTPages folder="$curfolder"> <mt:setvarblock name="listpage"><mt:pageid /></mt:setvarblock> <mt:unless name="listpage" eq="$curpage"> <li><a href="./<MTPageBasename>.php" id="<MTPageBasename>"><MTPageTitle></a></li> </mt:unless> </MTPages> This post has been edited by caribou: Mar 13 2008, 05:48 AM -------------------- |
|
|
|
Mar 13 2008, 12:43 PM
Post
#10
|
|
|
Group: Members Posts: 30 Joined: 10-June 05 From: sydney, australia Member No.: 31,649 |
Caribou, that was perfect, thanks - I've used MT3 in its barest form on my blog for years, but between tweaking MT4 on a mate's site and this post of yours I'm finally using it (MT4 now) as a CMS for a client... I got all enthusiastic at how coool the new version is it is and how easy you made it sound!!! I am LOVING it and it's totally working for both of us.
As for this problem? I'd got close - figured a variable was the answer but I wasn't setting it in the right place. Nice work, thanks for your help. -------------------- Those who can do; those who can't end up here...
|
|
|
|
Apr 9 2008, 12:31 PM
Post
#11
|
|
|
Group: Members Posts: 6 Joined: 3-July 06 Member No.: 36,069 |
I am attempting to use MT4 as a CMS for users who are not very knowledgeable. I am trying to figure out a way to enable them to edit/add links to their navigation through the MT WYSIWYG to eliminate any need for any other kind of software (Frontpage, etc)
Currently the menu is a server side include. Anyway to make it a widget that can be edited with a WYSIWYG and not see any code/tags? Or somehow edit it like a page or entry? |
|
|
|
Apr 10 2008, 05:04 AM
Post
#12
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
I am attempting to use MT4 as a CMS for users who are not very knowledgeable. I am trying to figure out a way to enable them to edit/add links to their navigation through the MT WYSIWYG to eliminate any need for any other kind of software (Frontpage, etc) Currently the menu is a server side include. Anyway to make it a widget that can be edited with a WYSIWYG and not see any code/tags? Or somehow edit it like a page or entry? You can generate a menu on each page template using the folder structure. That means teaching users how folder structures work, but it results in less chaotic sites overall. For includes, I'm not sure -- the bits of MT that make good includes (index templates and template modules) aren't WYSIWYG editable. I guess you could have a page that publishes to your includes folder, and bookmark it so they can just edit that. -------------------- |
|
|
|
Apr 10 2008, 05:32 AM
Post
#13
|
|
|
Group: Members Posts: 6 Joined: 3-July 06 Member No.: 36,069 |
normally the "use a page that publishes to the includes folder" would work i think, but I already have a page template. i would need another that contains no header, footer, etc but when you generate a page you can't dictate which template to use (right?).
What i mean is if this "include page" gets rebuilt or saved the system will pick the default page template. anyway around this? |
|
|
|
Apr 11 2008, 05:04 AM
Post
#14
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
normally the "use a page that publishes to the includes folder" would work i think, but I already have a page template. i would need another that contains no header, footer, etc but when you generate a page you can't dictate which template to use (right?). What i mean is if this "include page" gets rebuilt or saved the system will pick the default page template. anyway around this? Right, good point. :-) Hmm. Another possibility is an index page that's linked to a file, then let your users update the file with an external WYSIWYG editor? Teach them the magic of a href so they can be all empowered about editing the HTML themselves? MT is still kind of tricky to teach to non-web-savvy folks. -------------------- |
|
|
|
Apr 17 2008, 03:11 AM
Post
#15
|
|
|
Group: Members Posts: 30 Joined: 10-June 05 From: sydney, australia Member No.: 31,649 |
Hey Caribou, hope you don't mind answering another question... but I'm keen to insert code so that the current page is shown up in a different colour/style in the menu than the other menu items. How do I incorporate class specific tags like adding a "selected" or "on" class to the current menu item so the output code looks like this?
CODE <div id="vdividermenu"> <ul> [abridged code] <li><a href="[siteurl]/site/resources/index.html">resources</a></li> <li><a class="selected" href="[siteurl]/site/contact/index.html">contact</a></li> </ul> The MT code looks like this... CODE <div id="vdividermenu"> <ul> <li><a href="<MTBlogURL>index.html">HOME</a></li> <MTToplevelFolders sort_by="desc" sort_order="ascend"> <li><a href="<MTBlogURL><MTFolderBasename>/index.html"><MTFolderDescription></a></li> </MTToplevelFolders> </ul> <!-- end the menuh div --> </div> Thanks in advance... -------------------- Those who can do; those who can't end up here...
|
|
|
|
Apr 17 2008, 05:49 AM
Post
#16
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
Hi deeleea,
You can do this using MTIf to give the current page a different CSS class. Here's how I did something similar on a site: First, I set some variables on the page archive template. CODE <MTSetVarBlock name="thispage"><MTPageTitle></MTSetVarBlock> <MTSetVarBlock name="thisfolder"><MTPageFolder><MTFolderLabel></MTPageFolder></MTSetVarBlock> In the subnavigation for each page, the page we're currently on is given the class "current". CODE <ul> <MTPages folder="$thisfolder"> <MTSetVarBlock name="listpage"><MTPageTitle></MTSetVarBlock> <MTIf name="thispage" eq="$listpage"> <li class="current"><MTPageTitle></li> <MTElse> <li><MTPageTitle></li> </MTElse> </MTIf> </MTPages> </ul> Since you're listing top level folders instead of pages, you would just need to tweak your variables accordingly. Hope that helps! This post has been edited by caribou: Apr 17 2008, 05:50 AM -------------------- |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 11.24.09 - 11:35 PM |