IPB

Welcome Guest ( Log In | Register )

Movable Type

We're moving to movabletype.org!

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!

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Creating A 'sliding' Nav Menu
caribou sue
post 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!
  • Page in this folder 1
  • Page in this folder 2, which I am currently on
  • Page in this folder 3

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
Go to the top of the page
 
+Quote Post
danwolfgang
post 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.
Go to the top of the page
 
+Quote Post
caribou sue
post 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>&raquo;</a><li></MTSubfolders>
     </ul>
    </li>
  

  <!-- If this is parent of current page  -->
   <MTElse name="this" eq="$parent">
   <li><a href="<MTBlogURL><MTFolderPath>"><MTFolderDescription>&raquo;</a>
     <ul>
        <MTPages folder="$this"><li><a href="<MTPagePermalink>"><MTPageTitle></a></li></MTPages>
        <MTSubFolders>
      <li><a href="<MTBlogURL><MTFolderPath>"><MTFolderDescription>&raquo;</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>&raquo;</a></li>
   </MTIfFolder>
  

  </MTSubfolders>
</MTTopLevelFolder>
</ul>


This post has been edited by caribou sue: Aug 26 2008, 06:03 AM


--------------------
Go to the top of the page
 
+Quote Post
talaris
post 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
Go to the top of the page
 
+Quote Post
caribou sue
post 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


--------------------
Go to the top of the page
 
+Quote Post
samiton
post Oct 7 2008, 09:53 AM
Post #6





Group: Members
Posts: 17
Joined: 2-February 08
Member No.: 52,311



QUOTE (caribou sue @ Aug 26 2008, 05:19 AM) *
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?
Go to the top of the page
 
+Quote Post
OtherNiceMan
post 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
Go to the top of the page
 
+Quote Post
SamGeorge
post 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.
Go to the top of the page
 
+Quote Post
lex2000
post Nov 17 2008, 02:09 PM
Post #9





Group: Members
Posts: 7
Joined: 19-April 06
Member No.: 35,205



Do you have a working example somewhere?

QUOTE (caribou @ Mar 5 2008, 12:34 PM) *
Figured it out! It's ugly, but it works for up to 3 levels.

Go to the top of the page
 
+Quote Post
caribou sue
post Nov 18 2008, 06:05 AM
Post #10





Group: Members
Posts: 125
Joined: 15-August 07
From: Canada
Member No.: 43,938



QUOTE (lex2000 @ Nov 17 2008, 02:09 PM) *
Do you have a working example somewhere?

QUOTE (caribou @ Mar 5 2008, 12:34 PM) *
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/


--------------------
Go to the top of the page
 
+Quote Post
halabar
post 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
Go to the top of the page
 
+Quote Post
caribou sue
post 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.

QUOTE (halabar @ Dec 1 2008, 05:05 PM) *
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:



--------------------
Go to the top of the page
 
+Quote Post
halabar
post Dec 2 2008, 07:45 AM
Post #13





Group: Members
Posts: 6
Joined: 1-December 08
Member No.: 55,493



QUOTE (caribou sue @ Dec 1 2008, 06:29 PM) *
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).
Go to the top of the page
 
+Quote Post
caribou sue
post 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!


--------------------
Go to the top of the page
 
+Quote Post
halabar
post Dec 2 2008, 10:30 AM
Post #15





Group: Members
Posts: 6
Joined: 1-December 08
Member No.: 55,493



QUOTE (caribou sue @ Dec 2 2008, 07:53 AM) *
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...

Go to the top of the page
 
+Quote Post
caribou sue
post Dec 2 2008, 12:50 PM
Post #16





Group: Members
Posts: 125
Joined: 15-August 07
From: Canada
Member No.: 43,938



QUOTE (halabar @ Dec 2 2008, 11:30 AM) *
QUOTE (caribou sue @ Dec 2 2008, 07:53 AM) *
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>


--------------------
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 11.25.09 - 12:13 AM