default userpic

MTIfFolder buggered up in 4.21

Vote 0 Votes

Hi,

I just upgraded from 4.12 to 4.21. A similar problem was reported here (http://www.movabletype.org/cgi-bin/mt/mt-query.cgi?IncludeBlogs=24&search=mtiffolder) but the solution offered is not working for me. I have not had a reply to my issue so far and perhaps the title there is not indicative enough of the problem.

Here is my code: [ the solution suggested by Gautam that worked for dimlau ]

So I have a title for the section, and when one is in that section the subnav shows up. It's also possible to do this with keywords, but that would mean one more thing my client has to remember once per year to include in new pages for the category.

It's giving me the out-of-context error that dimlau mentioned, regardless of whether it's in a page or an index template. I need to get this working again ASAP. Thanks in advance for your help!

Reported on Movable Type 4.2

7 Replies

| Add a Reply
  • Er... my code disappeared...

    < mt:Pages > < mt:IfFolder label="Schools List" > < $mt:include module="Left nav - schools subnav"$ > < mt:ElseIf tag="PageTitle" eq="Schools List" > < $mt:include module="Left nav - schools subnav"$ > < /mt:IfFolder > < /mt:Pages >

  • Hi,

    I'm shooting blind here, but I think this has to do with <mt:else> (or its equivalent <mt:elseif>) not working outside of the <mt:if> context. At least that's my reading of the documentation on <mt:else>.

    So let's try and use the <setvarblock> functions to get this to work:

    <MTPages>
    <MTIfNonEmpty tag="pagefolder">
    <!-- set variables -->
    <mt:setvar name="schoolfolder" value="Schools List">
    <mt:setvar name="schoolpagename" value="Schools List">
    <mt:setvarblock name="thisfoldername"><mt:folderlabel></mt:setvarblock>
    <mt:setvarblock name="pagename"><MT:PageTitle></mt:setvarblock>
    <mt:if name="thisfoldername" eq="$schoolfolder">
        <mt:include module="mymodule">
    <mt:else>
           <mt:if name="pagename" eq="$schoolpagename">
              <mt:include module="mymodule">
           </mt:if>
    </mt:else>
    </mt:if>
    </mt:ifnonempty>
    </mt:pages>
    

    I think that should work. Let me know.

  • Hi Gautam,

    Thanks for your reply. Your solution made the subnav items repeat several times, so I used it to tinker with what I had originally and finally got it to work like this:

            &lt;mt:If tag="PageTitle" eq="Schools List"&gt;
                &lt;$mt:include module="Left nav - schools subnav"$&gt;
            &lt;/mt:If&gt;
    
            &lt;mt:Else&gt;
            &lt;MTIfNonEmpty tag="pagefolder"&gt;
            &lt;mt:IfFolder label="Schools List"&gt;
                &lt;$mt:include module="Left nav - schools subnav"$&gt;
            &lt;/mt:IfFolder&gt;
            &lt;/mt:IfNonEmpty&gt;
            &lt;/mt:Else&gt;
    

    It didn't seem to matter whether I included the <MTPages> tag or not, but it occurred to me that I was starting out with an MTIfFolder without introducing an MTFolders tag first. That tag wasn't quite right, but the MTIfNonEmpty did the trick! Phew...

    I wish Six Apart would be more explicit and note that the MtIfFolder tag has to be inside something else... or maybe I missed something. Anyway, thanks again, we got it figured out! Thank goodness.

  • Argh, haha, how do you get the brackets to show up? In my email it showed < and > but now in my email it's showing ampersands. Sigh... Anyway, hope you can read that...

  • Your code should read:

        <mt:If tag="PageTitle" eq="Schools List">
            <$mt:include module="Left nav - schools subnav"$>
        </mt:If>
    
        <mt:Else>
        <MTIfNonEmpty tag="pagefolder">
        <mt:IfFolder label="Schools List">
            <$mt:include module="Left nav - schools subnav"$>
        </mt:IfFolder>
        </mt:IfNonEmpty>
        </mt:Else>
    

    :-) I don't about email, but you should just cut and paste it here with about 8 spaces in front of each line. Works just fine.

    I agree, your code is neater. Well done!

  • Your code should read:

        <mt:If tag="PageTitle" eq="Schools List">
            <$mt:include module="Left nav - schools subnav"$>
        </mt:If>
    
        <mt:Else>
        <MTIfNonEmpty tag="pagefolder">
        <mt:IfFolder label="Schools List">
            <$mt:include module="Left nav - schools subnav"$>
        </mt:IfFolder>
        </mt:IfNonEmpty>
        </mt:Else>
    

    :-) I don't know about email, but you should just cut and paste it here with about 8 spaces in front of each line. Works just fine.

    I agree, your code is neater. Well done!

Add a Reply

Forum Groups

151 405

Last Topic: MT Interface Missing by Sherri on Nov 10, 2008

36 144

Last Topic: Installation can't finish by Drazend on Nov 10, 2008

34 93

Last Topic: Creating your own Plug-in by jondauz on Nov 5, 2008

10 33

Last Topic: new licensing confusion by Neil Epstein on Aug 14, 2008

code.sixapart.com

62 226

Last Topic: Callback after blog publishing. by Tomato Interactive on Oct 27, 2008

34 98

Last Topic: Ajax Rating Plugin by kiran on Oct 17, 2008