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!
![]() ![]() |
Jan 28 2008, 09:12 AM
Post
#1
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
Hi all,
I'm trying to create a menu that looks like this: Toplevelfolder 1 Toplevelfolder 2 Toplevelfolder 3, the folder this page is in!
Toplevelfolder 4 Here's the code I have, which just returns toplevel folders. I removed the links for clarity's sake. any idea what I'm doing wrong? CODE <MTSetVarTemplate name="folder"><MTPageFolder><MTFolderLabel></MTPageFolder></MTSetVarTemplate>
<MTTopLevelFolders> <ul> <MTIfFolder label="$folder"> <li><MTFolderDescription></li> <MTPages folder="$folder"> <li><MTPageTitle></li> </MTPages> <MTElse> <li><MTFolderDescription></li> </MTElse> </MTIfFolder> </ul> </MTTopLevelFolders> This post has been edited by caribou: Jan 28 2008, 09:15 AM |
|
|
|
Jan 28 2008, 10:24 AM
Post
#2
|
|
|
Group: Members Posts: 416 Joined: 19-August 03 Member No.: 14,803 |
Without thinking too hard, you might compare what you want to the "Category listing (nested)" widget. Folders and Categories are quite similar and it may be easy to adapt that.
-------------------- 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. |
|
|
|
Mar 5 2008, 11:34 AM
Post
#3
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
Figured it out! It's ugly, but it works for up to 3 levels.
CODE <MTSetVarBlock name="parent"><MTPageFolder><MTParentFolder><MTFolderLabel></MTParentFolder></MTPageFolder></MTSetVarBlock>
<ul> <MTTopLevelFolder> <MTSetVarBlock name="sectionfolder"><MTFolderLabel></MTSetVarBlock> <!-- pages in this section --> <MTPages folder="$sectionfolder"> <li><a href="<MTPagePermalink>"><MTPageTitle></a></li> </MTPages> <!-- folders in this section --> <MTSubfolders> <MTSetVarBlock name="this"><MTFolderLabel></MTSetVarBlock> <!-- If this is current folder, show pages/subfolders --> <MTIfFolder label="$current"> <li><a href="<MTBlogURL><MTFolderPath>"><MTFolderDescription></a> <ul> <MTPages folder="$this"><li><a href="<MTPagePermalink>"><MTPageTitle></a></li></MTPages> <MTSubFolders><li><a href="<MTBlogURL><MTFolderPath>"><MTFolderDescription>»</a><li></MTSubfolders> </ul> </li> <!-- If this is parent of current page --> <MTElse name="this" eq="$parent"> <li><a href="<MTBlogURL><MTFolderPath>"><MTFolderDescription>»</a> <ul> <MTPages folder="$this"><li><a href="<MTPagePermalink>"><MTPageTitle></a></li></MTPages> <MTSubFolders> <li><a href="<MTBlogURL><MTFolderPath>"><MTFolderDescription>»</a> <ul> <MTPages> <li><a href="<MTPagePermalink>"><MTPageTitle></a></li> </MTPages> </ul> </li> </MTSubfolders> </ul> </li> <MTElse> <!-- Otherwise, just show folder--> <li><a href="<MTBlogURL><MTFolderPath>"><MTFolderDescription>»</a></li> </MTIfFolder> </MTSubfolders> </MTTopLevelFolder> </ul> This post has been edited by caribou sue: Aug 26 2008, 06:03 AM -------------------- |
|
|
|
Aug 19 2008, 05:14 AM
Post
#4
|
|
|
Group: Members Posts: 8 Joined: 17-November 05 Member No.: 33,697 |
Hello caribou sue,
I am trying out your code for the menu but I get an error. QUOTE Publish error in template 'Folder Navigation': Error in <mtSetVarBlock> tag: Error in <mtPageFolder> tag: You used an 'mtPageFolder' tag outside of the context of an page; perhaps you mistakenly placed it outside of an 'MTPages' container? Not sure why this is happening. I looked over your code carefully and don't see anything that would cause this. Is this: CODE <MTSetVarBlock name="parent"><MTPageFolder><MTParentFolder><MTFolderLabel></MTParentFolder></MTPageFolder></MTSetVarBlock> part of the header, or part of the widget code? Many Thanks, -tf |
|
|
|
Aug 26 2008, 05:19 AM
Post
#5
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
The above example doesn't work correctly in 4.2. There's been some change in one of the Folder tags, but darned if I can figure it out.
UPDATE: Figured it out, and updated the example. This will only work, BTW, on page archives. This post has been edited by caribou sue: Aug 26 2008, 06:03 AM -------------------- |
|
|
|
Oct 7 2008, 09:53 AM
Post
#6
|
|
|
Group: Members Posts: 17 Joined: 2-February 08 Member No.: 52,311 |
The above example doesn't work correctly in 4.2. There's been some change in one of the Folder tags, but darned if I can figure it out. UPDATE: Figured it out, and updated the example. This will only work, BTW, on page archives. I've tried this in Page Archive template, created a widget to making a navigation, but a lot of errors comes out. I am using MTPRO 4.21. Maybe not good for this version? |
|
|
|
Oct 7 2008, 10:25 AM
Post
#7
|
|
|
Group: Members Posts: 2,039 Joined: 4-January 04 From: UK Member No.: 19,351 |
Difficult to tell, what are the errors?
-------------------- Rob Kenny
The Composing Stick Movable Type Tricks & Tips Twitter|Flickr|Vox Sites I manage: Darren Kenny: Professional Cyclist O.B.E |
|
|
|
Oct 7 2008, 10:28 AM
Post
#8
|
|
|
Group: Members Posts: 20 Joined: 6-October 08 Member No.: 53,633 |
I'm not sure, but this might work for you. I have it on several sites, easy to configure.
http://www.twinhelix.com/dhtml/fsmenu/ Its free for a link back, or just a donation. The author is in New Zealand. I have used it in my main root area of a domain, and in sub-folders/sub-directories. If you can use Server side includes on you site, you can use an 'include' for each folder/directory level and have just one file to edit per level. -------------------- --
Drive-In movie theater nostalgia http://www.drivein-jim.net/newblog/ MT 4.21 http://dice.drivein-jim.net/ dice collection site, MT 4.21 Disclaimer: Standard. |
|
|
|
Nov 17 2008, 02:09 PM
Post
#9
|
|
|
Group: Members Posts: 7 Joined: 19-April 06 Member No.: 35,205 |
|
|
|
|
Nov 18 2008, 06:05 AM
Post
#10
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
Do you have a working example somewhere? Figured it out! It's ugly, but it works for up to 3 levels. Yep, check out the left hand menu on this page to see how it works. http://www.cpaws.org/programs/nahanni/ -------------------- |
|
|
|
Dec 1 2008, 05:05 PM
Post
#11
|
|
|
Group: Members Posts: 6 Joined: 1-December 08 Member No.: 55,493 |
Is there a way to modify the page listing widget to do the same thing?.. For my usage, it needs to work on any page template (I'm not going to be using the archive template as a general rule).
I'm building out a template using the Professional Template set, and have most everything working, except for the left nav, which of course displays ALL the pages now in the left nav... I'm looking at MT as an option for a CMS, and with the "pages" and "folders" it looks like it could work (better than Wordpress in any case), so this navigation is the last thing to be figured out. for reference the pagelisting widget is: CODE <mt:IfArchiveTypeEnabled archive_type="Page">
<div class="widget-pages widget"> <h3 class="widget-header">Pages</h3> <div class="widget-content"> <ul> <mt:Pages no_folder="1" sort_by="title" sort_order="ascend"> <li class="page page-<$mt:PageID$>"><a href="<$mt:PagePermalink$>"><$mt:PageTitle$></a></li> </mt:Pages> <mt:TopLevelFolders> <li class="folder folder-<$mt:FolderID$>"><strong><a href="<$mt:BlogURL$><$mt:FolderPath$>/"><$mt:FolderLabel$></a></strong> <mt:Pages sort_by="title" sort_order="ascend"> <mt:PagesHeader> <ul> </mt:PagesHeader> <li class="page page-<$mt:PageID$>"><a href="<$mt:PagePermalink$>"><$mt:PageTitle$></a></li> <mt:PagesFooter> </ul> </mt:PagesFooter> </mt:Pages> </li> <$mt:SubFolderRecurse$> </mt:TopLevelFolders> </ul> </div> </div> </mt:IfArchiveTypeEnabled> This post has been edited by halabar: Dec 1 2008, 05:11 PM |
|
|
|
Dec 1 2008, 06:29 PM
Post
#12
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
That widget seems to do something similar, but it looks like it would list everything. Try the code I posted earlier this thread (maybe in a new widget or template module), and see if that does what you're looking for? That would probably be easier than trying to modify the default widget.
Is there a way to modify the page listing widget to do the same thing?.. For my usage, it needs to work on any page template (I'm not going to be using the archive template as a general rule). I'm building out a template using the Professional Template set, and have most everything working, except for the left nav, which of course displays ALL the pages now in the left nav... I'm looking at MT as an option for a CMS, and with the "pages" and "folders" it looks like it could work (better than Wordpress in any case), so this navigation is the last thing to be figured out. for reference the pagelisting widget is: -------------------- |
|
|
|
Dec 2 2008, 07:45 AM
Post
#13
|
|
|
Group: Members Posts: 6 Joined: 1-December 08 Member No.: 55,493 |
That widget seems to do something similar, but it looks like it would list everything. Try the code I posted earlier this thread (maybe in a new widget or template module), and see if that does what you're looking for? That would probably be easier than trying to modify the default widget. I tried your sample, but, as you mentioned, it didn't work in the other template formats (blog, index, etc.) and I got a pile of errors when I tried to publish. Not sure where to take it next. I'll try inserting your code again, but it seems like I might need to insert some other code into the blog template which might blow that up. (I'm not actually planning on using the blog template, but I'm just getting the errors when publishing). |
|
|
|
Dec 2 2008, 07:53 AM
Post
#14
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
Hi,
Because this menu is location-aware (that is, it "slides" to reveal the section you're in), it needs to know where in the folder structure it is -- thus it can only work on pages. I'm not sure how you'd make it work on other templates, because they don't 'know' where they are in the folder hierarchy. Sorry I can't be more helpful! -------------------- |
|
|
|
Dec 2 2008, 10:30 AM
Post
#15
|
|
|
Group: Members Posts: 6 Joined: 1-December 08 Member No.: 55,493 |
Hi, Because this menu is location-aware (that is, it "slides" to reveal the section you're in), it needs to know where in the folder structure it is -- thus it can only work on pages. I'm not sure how you'd make it work on other templates, because they don't 'know' where they are in the folder hierarchy. Sorry I can't be more helpful! That makes sense. I guess what I need to do is restrict it so the left-nav only displays on "page" templates. Right now I guess it's applying globally, which is creating the problem when publishing... |
|
|
|
Dec 2 2008, 12:50 PM
Post
#16
|
|
|
Group: Members Posts: 125 Joined: 15-August 07 From: Canada Member No.: 43,938 |
Hi, Because this menu is location-aware (that is, it "slides" to reveal the section you're in), it needs to know where in the folder structure it is -- thus it can only work on pages. I'm not sure how you'd make it work on other templates, because they don't 'know' where they are in the folder hierarchy. Sorry I can't be more helpful! That makes sense. I guess what I need to do is restrict it so the left-nav only displays on "page" templates. Right now I guess it's applying globally, which is creating the problem when publishing... Yes, that's a good first step. You could either remove the module/widget from other templates, or surround it with CODE <MTIfArchive archive_type="page">
(sliding nav code) </MTIfArchive> -------------------- |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 11.25.09 - 12:13 AM |