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
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
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