Ken Edwards

Build a Category Link with a CategoryID?

Vote 0 Votes

Hi,

Using LinkedCategory in FieldDay, you are given the CategoryID for the category the user selects from the drop down menu.

How do I construct the category link with this ID. I was amusing I just needed to use variable interpolation, but there is no attribute I can find for mt:Entries. It does take category="#163" for example, but category="#$category_number" does not work, because of the # probably.

This has got to be an easy solution. If you can build an Entry link with an EntryID, why can't I build a Category link in the same way? The following code does not work, as there seems to be no id attribute for the Categories tag.

<mt:UserIfFieldGroup group="user_featured_group">
<strong>Featured Column(s)</strong>
        <ul style="margin-top:0;">
<mt:UserLinkedCategories field="user_featured_category" sort_by="instance">
			<$mt:UserFieldValue field="user_featured_category" setvar="category_number"$>
			<mt:Categories id="$category_number">
			<li><a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a></li>
			</mt:Categories>
</mt:UserLinkedCategories>
        </ul>
</mt:UserIfFieldGroup>

Reported on Movable Type 4.3

3 Replies

| Add a Reply
  • Actually I forgot the loop. But even that does not seem to be working.

    <mt:UserIfFieldGroup group="user_featured_group">
    <strong>Featured Column(s)</strong>
            <ul style="margin-top:0;">
    <mt:UserLinkedCategories field="user_featured_category">
    			<$mt:UserFieldValue field="user_featured_category" setvar="category_number"$>
    			<mt:Categories id="$category_number">
    			<li><a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a></li>
    			</mt:Categories>
    </mt:UserLinkedCategories>
            </ul>
    </mt:UserIfFieldGroup>
    
    

  • You know it might help if I pasted the right thing.

    <mt:UserIfFieldGroup group="user_featured_group">
    <strong>Featured Column(s)</strong>
            <ul style="margin-top:0;">
    <mt:UserFieldGroup group="user_featured_group">
    <mt:UserLinkedCategories field="user_featured_category">
    			<$mt:UserFieldValue field="user_featured_category" setvar="category_number"$>
    			<mt:Categories id="$category_number">
    			<li><a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a></li>
    			</mt:Categories>
    </mt:UserLinkedCategories>
    </mt:UserFieldGroup>
            </ul>
    </mt:UserIfFieldGroup>
    
    

  • And we got it figured out. Thanks goes to Charlie Gorichanaz.

    <mt:UserIfFieldGroup group="user_featured_group">
    <strong>Featured Column(s)</strong>
            <ul style="margin-top:0;">
    <mt:UserFieldGroup group="user_featured_group">
    <mt:UserLinkedCategories field="user_featured_category">
    			<$mt:UserFieldValue field="user_featured_category" setvar="category_number"$>
    			<mt:Categories>
    			<mt:If tag="CategoryID" eq="$category_number">
    			<li><a href="<$mt:ArchiveLink type="Category"$>"><$mt:CategoryLabel$></a></li>
    			</mt:If>
    			</mt:Categories>
    </mt:UserLinkedCategories>
    </mt:UserFieldGroup>
            </ul>
    </mt:UserIfFieldGroup>
    
    

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1774 6167

Last Topic: Template modules by Zielun on Feb 16, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1434 5088

Last Topic: Maintenance announcement by Nick on Feb 17, 2012

695 2912

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

174 740

Last Topic: Captcha images rendering slowly by ScottM on Feb 12, 2012

190 568

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012