Display additional categories

1 view
Skip to first unread message

Phil -- wbtc.fr --

unread,
Oct 14, 2010, 8:54:11 AM10/14/10
to in-por...@googlegroups.com
Hello,

we have   <inp2:CategoryPath separator="&gt;" render_as="category_path_element"/>    to display primary category. Can we display a 2nd category if any?

p

Phil -- wbtc.fr --

unread,
Oct 14, 2010, 10:01:44 AM10/14/10
to in-por...@googlegroups.com
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 -- <ph...@wbtc.fr>

Phil -- wbtc.fr --

unread,
Oct 14, 2010, 11:53:51 AM10/14/10
to in-por...@googlegroups.com
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?

Dmitry Andrejev

unread,
Oct 14, 2010, 12:12:04 PM10/14/10
to in-por...@googlegroups.com
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
--


Best regards,

Dmitry A.

Alexander Obuhovich

unread,
Oct 14, 2010, 12:12:33 PM10/14/10
to in-por...@googlegroups.com
Really tag <inp2:n_PrintMoreCategories render_as="category" field="MoreCategories"/> doesn't work, when used on article detail page?
--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com

Phil -- wbtc.fr --

unread,
Oct 14, 2010, 12:53:31 PM10/14/10
to in-por...@googlegroups.com
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....@gmail.com>

Dmitry Andrejev

unread,
Oct 14, 2010, 12:59:35 PM10/14/10
to in-por...@googlegroups.com
Phil,

Please post your whole code from my_items here.

DA

Alexander Obuhovich

unread,
Oct 14, 2010, 1:04:48 PM10/14/10
to in-por...@googlegroups.com
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:

Phil -- wbtc.fr --

unread,
Oct 14, 2010, 1:35:56 PM10/14/10
to in-por...@googlegroups.com
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....@gmail.com>

Alexander Obuhovich

unread,
Oct 14, 2010, 1:45:45 PM10/14/10
to in-por...@googlegroups.com
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?

Dmitry Andrejev

unread,
Oct 14, 2010, 1:51:48 PM10/14/10
to in-por...@googlegroups.com
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.

Phil -- wbtc.fr --

unread,
Oct 14, 2010, 2:14:20 PM10/14/10
to in-por...@googlegroups.com
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 <dand...@gmail.com>

Dmitry Andrejev

unread,
Oct 14, 2010, 2:21:13 PM10/14/10
to in-por...@googlegroups.com
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.

Phil -- wbtc.fr --

unread,
Oct 15, 2010, 6:14:18 PM10/15/10
to in-por...@googlegroups.com
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 ;-)
Reply all
Reply to author
Forward
0 new messages