Child pages
  • Display additional categories
Skip to end of metadata
Go to start of metadata

Imported From: http://groups.google.com/group/in-portal-dev/browse_thread/thread/5093e4c20a9c1c71#

We have  this tag to display primary category:

<inp2:CategoryPath separator="&gt;" render_as="category_path_element"/> 

Can we display a 2nd category if any?

13 Comments

  1. Hi Phil,

    you can use the same tag as the one used in modify_link.tpl file, modified
    as follow :

    <inp2:m_DefineElement name="category">
      <inp2:m_Param name="full_path"/>
    </inp2:m_DefineElement>

    <inp2:l_PrintMoreCategories render_as="category" field="MoreCategories"/>

    p.

    2010/10/14 Phil -- wbtc.fr -- <p...@wbtc.fr>

  2. thanks for answering, it works well in link listing, but doesn't work when I
    change to "n" prefix and use it, at the same place, in news.

    Any idea?

    2010/10/14 Phil -- wbtc.fr -- <p...@wbtc.fr>

  3. Hi Phil,

    It should work just fine since tag is Category Item wide and this code loads
    up all Additional categories in MoreCategories field:

    // set item's additional categories to virtual field (used in editing)
    $item_categories =
    $this->getItemCategories($object->GetDBField('ResourceId'));
    $object->SetDBField('MoreCategories', $item_categories ? '|'.implode('|',
    $item_categories).'|' : '');

    in OnAfterItemLoad for all Category Items.

    What['s your exact code and where you are using the tag - list or item
    template (details page).

    DA

  4. Really tag <inp2:n_PrintMoreCategories render_as="category"
    field="MoreCategories"/> doesn't work, when used on article detail page?

  5. I use this tag in my_account/my_items of each module.

    I've copy/pasted the code, works with l, doesn't with n, in corresponding
    categories (and debug error message doesn't show any red error, I can't
    debug alone this time :)

    2010/10/14 Alexander Obuhovich <aik.b...@gmail.com>

  6. Phil,

    Please post your whole code from my_items here.

    DA

  7. When used from inside <inp2:m_DefineElement tag, used in list prefix should
    be omitted, like this:

    <inp2:PrintMoreCategories render_as="category" field="MoreCategories"/>

    *<inp2:n_* replaced with *<inp2:*

  8. I tried to remove the tag, because I knew it's not needed in a define
    element, but in this case it doesn't work (and in advanced theme it's coded
    with prefix, while it's in a define).

    Dmitry, here is the code:

    <inp2:m_DefineElement name="my_link_element">
    [...]
              <inp2:m_DefineElement name="category">
                          <inp2:m_Param name="full_path"/>
              </inp2:m_DefineElement>
                        <inp2:m_phrase name="lu_fld_PrimaryCategory"/>:
    <strong><inp2:l_PrintMoreCategories render_as="category"
    field="MoreCategories"/></strong><br />
    [...]
    </inp2:m_DefineElement>

    and it's called like this:

     <inp2:m_RenderElement design="content_box" data_exists="1"
    block_no_data="no_links">
    [...]
         <inp2:l_InitList list_name="my_links" types="my_items"
    parent_cat_id="0" recursive="1"/>
         <inp2:m_include template="in-link/elements/links.elm"/>
         <inp2:l_ListLinks list_name="my_links" render_as="my_link_element"
    direction="H"/>
    [...]
      </inp2:m_RenderElement>

    p

    2010/10/14 Alexander Obuhovich <aik.b...@gmail.com>

  9. I strongly recommend not to use prefix in DefineElement used for list
    element printing. Maybe that article of your don't have any additional
    categories and that's why they are not displayed?

  10. Phil,

    1. There is no <inp2:l_PrintMoreCategories render_as="category"
    field="MoreCategories"/> tag within <inp2:m_DefineElement
    name="my_link_element"> element - you added it.

    2. When you added it - you didn't pay attention that other tags do NOT have
    a Prefix specified since it's NOT needed because the whole List Object is
    setup by <inp2:l_ListLinks list_name="my_links" render_as="my_link_element"
    direction="H"/> which already has "l" Prefix which will be passed down the
    road.

    In other words, you haven't correctly using <inp2:l_PrintMoreCategories
    render_as="category" field="MoreCategories"/> tag for Links too :)

    DA.

  11. 1. yes I added it

    2. in in-link, it DOESN'T work if I remove the prefix (error in debug + page
    rendering stopped), but works perfectly using it :-)

    3. for in-news, the matter is not an empty result, but an error in debug.
    And it doesn't work also without prefix

    2010/10/14 Dmitry Andrejev <dandre...@gmail.com>

  12. Phil,

    What's the error?

    Any reason you are not putting all this info right away in your question so
    we have find it hard way? :)

    DA.

  13. Dmitry,

    may you'll find it funny, I was about to copy here the debug output, but
    <inp2:l_PrintMoreCategories render_as="category" field="MoreCategories"/>
     WORKS fine and display my additionnal categories, while it doesn't work
    (debug show up and page doesn't finish to load) if I remove the prefix "l_"

    Maybe I use it "not correctly", but I use it the way it works ;-)

    2010/10/14 Dmitry Andrejev <dandre...@gmail.com>