itemid...

13 views
Skip to first unread message

Ian MacLennan

unread,
Jun 29, 2006, 11:48:27 AM6/29/06
to joomla-d...@googlegroups.com
Me again...

I'm back after a prolonged absence. I'm been working through documenting
the JApplication class. Things went fairly smoothly, with two minor
exceptions.

First, the getHead method is not working, but I filed a bug on the
tracker and I'm sure it will be addressed at the appropriate time.

EDIT: looking into the database and the JMenu code, I can see the
problem. Please read below though to confirm that I have understood
itemid correctly:

The second issue was with the dreaded getItemid method. I tried to work
through this on the old mosMainframe class, and so I have given it
another go in Joomla! 1.5. I've noticed that it has changed quite a bit,
and looked much more straightforward (in the JMenu class).

Here is the description I came up with:

Begin:
The concept of an item id in Joomla! is rather complex. It has come to
be used in a multiplicity of ways which makes its use difficult to
understand in some situations. The essence of the problem seems to be
that there are itemids associated with menu items, and there are also
itemids that are associated with content items. This method is intended
to resolve a general itemid into a menu itemid.

This is a legacy function. It will be noted that there are six
parameters documented here. In Joomla! 1.5, only the first is used.

This method returns the itemid of the specified item.

This method is deprecated in Joomla! 1.5 (JApplicationHelper→getItemid
<http://dev.joomla.org/index.php?option=com_jd-wiki&Itemid=31&id=references:joomla.framework:application:japplicationhelper-getitemid>
should be used instead).

End


Based on my inspection of the code, my guess was that I should be able
to pass to the getItemid method an id of a content item, and it should
return to me the itemid of the appropriate menu item. To test this, I
invoked the method as follows: $mainframe->getItemid( 6 ); In my default
Joomla! 1.5 install, Item 6 is the Example News Item 1. I accessed it
through Itemid 4, which is the blog link on the main menu. My assumption
was that this would return the value 4, referring to this menu item.
This was not the case, however. Instead, it returned 9999, indicating
that it had not located a menu item that pointed to this item.

Inspecting the code, I noticed three conditions that searched for
sections and categories. None of these found the item. In writing this,
and doing further inspection, I have found that this is a bug which I
will post in the tracker. (this bug is a result of the move to MVC)

Can somebody confirm that my understanding of how this function works is
correct? It would be appreciated.

Ian


Michelle Bisson

unread,
Jun 30, 2006, 1:37:11 AM6/30/06
to joomla-d...@googlegroups.com
Hi Ian,

Glad to hear that you are back! 

In case you did not know, in 1.5, Content Items will now be called Articles. This is to simplify the terminology for newbies.

Michelle

Ian MacLennan

unread,
Jun 30, 2006, 8:51:11 AM6/30/06
to joomla-d...@googlegroups.com
Right... I had read that discussion, but it didn't transfer... I will
update that when I get a chance.

Ian

Michelle Bisson wrote:
> Hi Ian,
>
> Glad to hear that you are back!
>
> In case you did not know, in 1.5, Content Items will now be called
> Articles. This is to simplify the terminology for newbies.
>
> Michelle
>

> On 6/29/06, *Ian MacLennan* <joo...@ianmaclennan.org

Michelle Bisson

unread,
Jun 30, 2006, 11:06:57 AM6/30/06
to joomla-d...@googlegroups.com
Thanks!

Michelle

Louis Landry

unread,
Jun 30, 2006, 11:22:59 AM6/30/06
to joomla-d...@googlegroups.com
Hi Ian,

Consider this a very brief, quick answer to your question with a more detailed answer to follow... have a couple of things to do today before I get back into it.

Itemid is/should be associated only with the menu.  An article (content item) has an id, but this is not an Itemid.  Itemid is a value specific to the #__menu database table.

The getItemid method that appears in JMenu really shouldn't be there.  I put it there a while ago when I first wrote that class and have since realized that it is the improper place.  It will get moved into its appropriate place today... this place is in the JContentHelper class within com_content.  Why you might ask?  Well, what the method does, is take an article id number... and search through the menu to find a menu item that this article falls under.  It checks to see if the article is linked directly to the menu, it then looks to see if the article is in a category that is linked to the menu, etc... With the changes to the menu system the method will have to be modified anyway.  And since it is relevant ONLY to articles managed by com_content and not any other content type... ie, weblink categories or contacts, etc... It belongs in the com_content code.  Not in the framework, which is meant to be extension-independent.

I hope that clears things up a little.

and welcome back :)

Louis

Ian MacLennan

unread,
Jun 30, 2006, 12:21:14 PM6/30/06
to joomla-d...@googlegroups.com
Thanks Louis. I think I had the just of it... but thanks for the
clarification of terminology (i.e. id vs. itemid), but I wasn't sure if
id or itemid was used for anything else besides articles (almost wrote
******* items again there!). Can you comment then on the effect that
this will have on the JApplicationHelper class? Is the intention then to
get rid of this method as well? As the code stands right now, there is a
method JApplication->getItemid (which has been deprecated), which calls
JApplicationHelper->getItemid, which in turn calls JMenu->getItemid.

So I'm assuming also that there is an amount of flux that is still
happening, and that getItemid (wherever it ends up) and
JApplicationHelper->getItemCount will get fixed at some point when this
has been settled a bit more?

Ian

> On 6/30/06, *Michelle Bisson* < 4jo...@gmail.com


> <mailto:4jo...@gmail.com>> wrote:
>
> Thanks!
>
> Michelle
>
>

> On 6/30/06, *Ian MacLennan* < joo...@ianmaclennan.org


> <mailto:joo...@ianmaclennan.org>> wrote:
>
>
> Right... I had read that discussion, but it didn't transfer...
> I will
> update that when I get a chance.
>
> Ian
>
>
>
> Michelle Bisson wrote:
> > Hi Ian,
> >
> > Glad to hear that you are back!
> >
> > In case you did not know, in 1.5, Content Items will now be
> called
> > Articles. This is to simplify the terminology for newbies.
> >
> > Michelle
> >
> > On 6/29/06, *Ian MacLennan* < joo...@ianmaclennan.org
> <mailto:joo...@ianmaclennan.org>

> > <mailto: joo...@ianmaclennan.org

Reply all
Reply to author
Forward
0 new messages