DISCUSSION: Incorrect Itemid-list of possible solutions

Discuss the FAQ's here, and get in touch with the FAQ Team.
User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1193
Joined: Sat Aug 20, 2005 12:32 pm
Location: Jersey, Channel Islands
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by PhilTaylor-Prazgod » Wed Sep 07, 2005 6:39 pm

Make sure you keep your trash empty - Joomla will look at trash (incorrectly - bug) when trying to calculate the Itemid.












MODE NOTE: DISCUSSION THREAD FROM THE FAW ARTICLE POSTED HERE: http://forum.joomla.org/index.php/topic,4259.0.html
Last edited by guilliam on Thu Mar 02, 2006 4:07 pm, edited 1 time in total.
Phil Taylor - Full Time Joomla/PHP Security Expert
Blue Flame Digital Solutions Limited.
-- https://myJoomla.com/ Multi Award Winning Joomla Security & Auditing Service
-- https://www.phil-taylor.com/

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kenmcd » Wed Sep 07, 2005 11:50 pm

rsphaeroides wrote: A number of people are struggling with issues relating to the assigment of incorrect Itemid.  It seems that it's a fundamental problem with the core code (see http://forum.opensourcematters.org/inde ... 509.0.html)  but I can't find an FAQ on the topic.  I can't really start a new FAQ since that thread requests that you also provide an answer to the question and I have no clue what that answer is other than waiting for dev to fix the issue in a new joomla release.

I have however found several posts from the last few days that deal with the issue of incorrect Itemid and they include some suggestions for workarounds, hacks or patches (see list below).  You may have to look at several suggestions since the specific workarounds, hack or patch seems to depend on whether you're having the issue in the main body or one of the modules and if it's a module it depends on which module.

. . .
Definitely a need for an FAQ, or two or three.

The link Rey provides above to the old forum does have an explanation, and a work around.
There is also another post by Rey in the old forum on the same issue.
The ItemID=0 or ItemID=1 issue.

I am not familiar enough with this to determine if all of these are the same issue.

At a minimum, we should have an FAQ with Rey's ItemID workaround.

Regarding the rest of your links, we will need to determine which are related or different.
"Calling all Reys, calling all Reys" and anyone else who has a confirmed explanation and solution.
██ LibreTraining

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kenmcd » Wed Sep 07, 2005 11:55 pm

From: http://forum.mamboserver.com/showthread ... ght=itemid


The question:
Module problem - driving me nuts

--------------------------------------------------------------------------------

I've successfully moved 8 sites to Mambo over the last year and I just noticed a problem in my last site (while working on my current test site) But all my other sites are fine.

For some reason the Modules for certain things (latest news, most popular) which are designated to be home only, transfer themselves (if you click on a link in them) to the articles page actually all modules which are designated to homepage only appear there. There is no rhyme or reason for this.

I tend to copy the database and files from my last successful site and do setup but even on a fresh install of Mambo (4.5.2) it happens.

Example of site is http://www.sp-mag.com, if you click on a popular item link the modules will appear with the article, but if you click on a upcoming events link it works as it's supposed to. I have even seen it work properly and not properly form two links in the same module! Both links were the same other than the id number being different.

I've tried many different things, none have worked. I think it has to do with some 3rd party module or mambot (though I don't know why) that I'm loading as It was working properly (seemed to) until I loaded a few up. Even though I deleted them it still acts wonky so I have to go back to a fresh install and use the process of elimination.

If anyone has a clue to why it's doing this I would greatly appreciate some help, thanks.

Rey's reply:
The problem is caused by the rather arcane complex and totally excruiating problems caused by the itemid system in mambo.

Its one of the oldest parts of the code, going back into the mists of time and is being used far beyond its principle objective when it was created.
Unfrotunately because it affects so many things, its somethign we can only fix with a major overhaul (e.g. 5.0)


Anyway that doesnt help you.
What you need to do is create a hidden menu (e.g. a menu whose mod_mainmenu module you do not publish).
Now wht you need to do is to create a `Table - Content Section` for all your sections.

The problem is that because you have no menu item that is linked with the sections that hold your news items, the system cannot assign the contents that reside within the section an itemid, so the default setting is to use the Itemid of your 'homepage' which in this case is 1.
So when you click on any new item, the system still thinks your on the frontpage as it sees an Itemid of 1.


Put another way.

If you have two sections

News

Events

And let say in all you Menus you have a Section for Events as a menu item, which gives it an Itemid of 16.
Now all news items in the Events section will inherit an itemid of 16

But let say you News section has no link in any of your menus.
So the default behavious takes over and its is assigned an itemid of 1
██ LibreTraining

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kenmcd » Thu Sep 08, 2005 1:06 am

More background from Rey.
http://forum.mamboserver.com/showthread ... post227037
The matter is due to the Itemid system of Mambo.

When you create a Link - URL mambo does not assign it a uniquie Itemid.
And a uniquie Itemid is needed to power everything from template assigment, to module assigment, access control the pathway etc.

Mambo does not assign it an Itemid because it does not know in what cases it should.
For example if you are using Mambo for an external link, you obviously dont want it assigned an Itemid.
Example:
http://www.mamboserver.com
cant be
http://www.mamboserver.com&Itemid=24

Lets say you linking to an internal Mambo link which already has an itemid
Example:
index.php?option=com_content&task=view&id=5&Itemid=6
cant be
index.php?option=com_content&task=view&id=5&Itemid=6&Itemid=24

So the problem is to find an easy way to tell mambo that this particular Link - Url should be assigned an Itemid. At the moment the most likelyworkable solution is via a param for the menu item
██ LibreTraining

User avatar
toubkal
Joomla! Hero
Joomla! Hero
Posts: 2860
Joined: Thu Aug 18, 2005 4:35 pm
Location: Cheshire, England
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by toubkal » Fri Sep 09, 2005 2:38 pm

I have just answered a question relating to itemids, so I thought it may be useful to post it here:

Problem:
Read more links in your archive page have the incorrect itemid. You want them to have the same itemid as the archive page.

i.e. when you click on a read more link, you want the same modules and template assignments on the archived items as the main archive page.

A solution:

This is a hack of a core file.

This section of code from the /components/com_content/content.html.php line 406, determines the read more link.

Code: Select all

		// determines the link and link text of the readmore button
		if ( $params->get( 'intro_only' ) ) {
			// checks if the item is a public or registered/special item
			if ( $row->access <= $gid ) {
				if ($task != "view") {
					$_Itemid = $mainframe->getItemid( $row->id, 0, 0, $ItemidCount['bs'], $ItemidCount['bc'], $ItemidCount['gbs'] );
				}
				$link_on = sefRelToAbs("index.php?option=com_content&task=view&id=".$row->id."&Itemid=".$_Itemid);
				if ( strlen( trim( $row->fulltext ) )) {
					$link_text = _READ_MORE;
				}
			} else {
It seems that in some places within content generation the itemid uses the variable $Itemid and sometimes (possibly to reduce the queries) it uses the line

Code: Select all

$_Itemid = $mainframe->getItemid( $row->id, 0, 0, $ItemidCount['bs'], $ItemidCount['bc'], $ItemidCount['gbs'] );
In the case of the read more link, it uses the second method which is not working how you want -  but the first method would.

We can just replace the $_Itemid in the readmore link code with $Itemid and it works, but as I am not sure how this will affect read more links in other parts of the site, I thought it best to ammend it only for your view of the archives.

So I have added an extra IF statement

Code: Select all

if ($task =="archivecategory") {
                    $_Itemid = $Itemid;
                }
which says - if the page viewed is an archive page, make the $_itemid = $itemid

Here it is within the code:

Code: Select all

		// determines the link and link text of the readmore button
		if ( $params->get( 'intro_only' ) ) {
			// checks if the item is a public or registered/special item
			if ( $row->access <= $gid ) {
				if ($task != "view") {
					$_Itemid = $mainframe->getItemid( $row->id, 0, 0, $ItemidCount['bs'], $ItemidCount['bc'], $ItemidCount['gbs'] );
				}
                if ($task =="archivecategory") {
                    $_Itemid = $Itemid;
                }
				$link_on = sefRelToAbs("index.php?option=com_content&task=view&id=".$row->id."&Itemid=".$_Itemid);
				if ( strlen( trim( $row->fulltext ) )) {
					$link_text = _READ_MORE;
				}
			} else {
Last edited by toubkal on Sat Sep 10, 2005 9:37 pm, edited 1 time in total.
Do you want the answer to be as vague as your question?

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kenmcd » Tue Sep 20, 2005 8:24 pm

http://forum.mamboserver.com/showthread ... post189990

This is a common problem in Mambo and not only related to SEF advance.

Little history
Itemid is inheritance from old Mambo days (version 3.0.7) where it was used to determine the correct position in the Pathway.
As time went we used it more and more in Mambo: first for dynamic modules, then menu highlighting and submenus, dynamic templates and most recently by parameters. Soon it became obvious that this method of passing the Itemid as GET variable is outdated and can't handle those multiple tasks that well.
To fix this we introduced a method to find out the correct Itemid instead of passing it (this method comes directly from SEF advance btw). Now this method has its own rules which determines which Itemid will be returned.

How does SEF advance handle Itemid?
As URLs in SEF advance don't pass Itemid (typical URL looks like domain.com/animals/pets/cats/) it has a function that must return Itemid by looking at the menu database. Which Itemid is returned depends on how you structured your menu. Some menu items, namely, have priority over others.
This priority is as follows:
1) Content Item Link
2) Typed Content Link
3) Content Section List
4) Content Category List
5) Content Section Blog (specific)
6) Content Category Blog (specific)
7) Content Section Blog (global)
8 ) Content Category Blog (global)

What does this mean?
For example: if you have linked your section both as Section List and Section Blog the Itemid of Section List Link will be returned. That means that when you click on a content item of the section it will not highlight the blog link as long as section list link is present in the menu.
Other example: if you linked a Content Item to menu viewing it will not highlight it's section or blog, but the linked item link instead as it has top priority.

Other things to think about
If you upgraded from previous versions of Mambo or used some 3rd party component that messes with menu table, chances are that your menu table has junk in it. Use phpMyAdmin to clear the items from mos_menu table that are not present in Menu admin.

How to debug?
Turn on SEF advance debug function and see which Itemid it returns. Then go to Menu admin and see which id it corresponds to. If that's not the Item you think should be highlighted you should try trashing it.
If that id is not in the Menu admin at all (remember to check all menus, not only mainmenu) then use phpMyAdmin to delete such entries.

This was a small tutorial on Itemid handling in Mambo/SEF advance.
██ LibreTraining

User avatar
rsphaeroides
Joomla! Ace
Joomla! Ace
Posts: 1369
Joined: Sun Aug 21, 2005 2:57 pm
Location: Colorado, USA
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by rsphaeroides » Tue Sep 20, 2005 9:10 pm

kenmcd wrote: http://forum.mamboserver.com/showthread ... post189990

This priority is as follows:
1) Content Item Link
2) Typed Content Link
3) Content Section List
4) Content Category List
5) Content Section Blog (specific)
6) Content Category Blog (specific)
7) Content Section Blog (global)
8 ) Content Category Blog (global)
kenmcd,
Thanks for the history.  It's all slowly becoming clearer to me. However, I still can't figure out the behaviour that set me off on this Itemid crusade in the first place. 

When I make a menu item "Table-Content Category" (I assume this is equivalent to #4 above the "Content Category List") the page that the menu item creates has a list of linked titles of Content items.  All of the content items are linked to menus as "Link-Content Item" but every link retuns the Itemid of the "Table-Content Category" menu item instead.

According to the above heirarchy doesn't that mean that the Itemid should be the one of the content item?  Since the Content item link has the highest priority shouldn't any content item that has a menu link as a content item always have the correct Itemid?

Even after the history lesson I'm still missing something very basic. 
¡Pura Vida!
Ray,
joomla in testing at Costa Rica Travel: http://costaricamap.net
http://costa-rica-guide.com

User avatar
rsphaeroides
Joomla! Ace
Joomla! Ace
Posts: 1369
Joined: Sun Aug 21, 2005 2:57 pm
Location: Colorado, USA
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by rsphaeroides » Tue Sep 20, 2005 9:33 pm

Any insight into how this heirarchy works when the same content item is linked in the same way from two different menus?

e.g.

menu round things
-apple
-donut
-zero

menu red things
-apple
-fire truck
-Santa's cheeks

what happens to apple?

----------------------------------------------------------------edit-----------------------------------------------------------
According to reply number 10 below, linking to the same item from multiple menus could be very problematic.  This is kind of a bummer since I was hoping to use the menus to create cross references since I can't take advantage of the sorting and filtering available on the Table-Category Content pages
Last edited by rsphaeroides on Fri Sep 23, 2005 3:35 am, edited 1 time in total.
¡Pura Vida!
Ray,
joomla in testing at Costa Rica Travel: http://costaricamap.net
http://costa-rica-guide.com

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kenmcd » Wed Sep 21, 2005 2:21 am

Farfignugen if I know.  ;D
Really this is all so confusing to the average user (me) that I don't know.
We can keep collecting background and perhaps figure it out.

Real answer . . .
Based on the order of evaluation above, I would assume your "apple" would get evaluated based on the number assigned to it.
Since they would both be at the same level, I assume they would get "ordered" by the number.

The problems of the system seems to cause multiple problems.
- duplicate URLs
- the ItemID=1 problem
- others?

First we need to define what the problems are.
Rey's workaround seems to solve only the ItemID=1 problem.

Would a URL rewriting component be useful to workaround the other problems? ? ?
Surprise, surprise - SEF Advance seems to help here (see More background posted above, Reply #6).
Gee, I wonder if someone familiar with the problem has already figured this out.
Could an advanced SEF or URL rewriting component be used to work-around these core limitations?  ???
Dunno, for some reason it does not seem to be documented anywhere.  :o
Maybe some core member familiar with SEF and this issue can shed some light on the problem.
I'll be holding my breath.  :laugh:


Back to the problem(s) - the current structure seems to cause multiple problems.
All software, and CMSs, have problems - how you handle them is the difference.

Joomla users run into these very confusing, very time consuming problems every day.
The problem is not going to go away for many, many months.
Documenting the problems, and the work-arounds, will help a lot of Joomla users.
Let's document these and figure out how to deal with them NOW.

Let's see if we can understand and segregate each problem and then document a workaround. OK?
We are going to need the knowledge, experience, and abilities of the core members and elite 3PD programmers.
Rey is the only core member I see addressing these issues.
You guys (core) know these issues intimately.
I am sure these issues have been worked-around on consulting customers' sites.
Please take the time to provide enough information for us to further document and "spread the word."

@rsphaeroides
With or without help, we can keep plugging away to collect the available info and help ourselves and other Joomla users.
You have collected some great info.
I have added a few items.

Anyone else - how did you work-around these issues?


Regards,

KM
██ LibreTraining

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kenmcd » Fri Sep 23, 2005 2:10 am

This applies to all advanced SEF components.
------------------------------------------------------------------

http://forum.mamboserver.com/showthread ... 5#post=599

Question

Quote:
Originally Posted by steve0
well after installing sef advance, i noticed that over half my content was not viewable unless you logged in. the strange thing is, everything is set to public so its not necessary to log in to view..... i then uninstalled sef advance and everything was ok again. is this a bug or am i missing something?

steve0

Answer - Saka

- This indicates that SEF advance is pulling wrong Itemid from database or no Itemid at all. Make sure that you add all sections (listings or blogs) to main menu. If you don't want them to show you can unpublish them but they must be there.

- Also make sure that you don't have duplicate items in the menu. It can happen that you have same links in different menus (e.g. mainmenu and topmenu). In this case delete duplicates and use ordinary relative URLs instead.

- Make sure that you empty the trash too as some duplicates may be in trash as well.

***** Manual signatures are NOT allowed *****______


This apparently did not solve all of the user's problems.
I requested clarification of the solution (which was apparently sent via email or PM) here:
http://forum.mamboserver.com/showthread ... 1#post=603

-----
██ LibreTraining

User avatar
norman
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 107
Joined: Thu Aug 18, 2005 2:25 pm
Location: us
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by norman » Fri Sep 23, 2005 12:54 pm

A couple of added notes to this. I have seen another problem in frontpage when you have linkable section turned on in the parameters it will nreak the display entirely, won't even yield the "you are not ...."

The other is when a user uses ' (posession) in a title using sef advanced. I know it is not recommended to use apostrophe's in titles, but try telling that to a 52 year old editor and see what the response you get will be :-[

Thanks for this thread by the way, this is the most comprehensive I have seen on this topic.
"The journey is the destination"

User avatar
rsphaeroides
Joomla! Ace
Joomla! Ace
Posts: 1369
Joined: Sun Aug 21, 2005 2:57 pm
Location: Colorado, USA
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by rsphaeroides » Fri Sep 23, 2005 2:39 pm

----------------------------------------------------edit--------------------------------------------------------------


I deleted the content of my post about the security issue and feel like something of a [redacted] for posting it in the first place.  Nothing like providing instructions to circumvent existing permissions. 

If core/dev/modertators didn't see it please contact me so I can fill you in on what the issue is without broadcasting it.


----------------------------------------------------edit--------------------------------------------------------------
Last edited by rsphaeroides on Fri Sep 23, 2005 5:57 pm, edited 1 time in total.
¡Pura Vida!
Ray,
joomla in testing at Costa Rica Travel: http://costaricamap.net
http://costa-rica-guide.com

User avatar
toubkal
Joomla! Hero
Joomla! Hero
Posts: 2860
Joined: Thu Aug 18, 2005 4:35 pm
Location: Cheshire, England
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by toubkal » Fri Sep 23, 2005 3:31 pm

WOW that is serious. I just replicated it on one of my sites. It did not work in some situations but in others, I got access to content set to registered.
Do you want the answer to be as vague as your question?

User avatar
kper
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 26, 2005 11:09 am

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Sat Sep 24, 2005 2:36 am

You can choose not to use the Frontpage component and use Static Content, or another component or whatever you like as your site's home page instead. This makes the front page manager redundant, unless you want to use the Frontpage component to make another page somewhere else within your site (it doesn't have to be used just for the home page).

The Frontpage component is just a Blog-type page whose content you get to precisely determine by ticking the "Show on Front Page" box in content items which you wish to appear there (rather than having it indiscriminately display all  the items from a particular section or category like those respective Blog listings do).

You might not want a news-style front page with article extracts (teasers) on it. Often, a Static Content page is better suited to the needs of small businesses, for example.

If the home page is Static Content, staff can easily find it when they want to make changes and they aren't confused by the two input boxes (for intro and main text). If you are using a WYSIWYG editor, often merely clicking in the empty main text box of an ordinary content item will generate a random, invisible, tag, which then leads to an unwanted, unnecessary, "Read More..." link at the end of the home page blurb.

This is all relevant to ItemID - keep reading!

All this is very easy to accomplish; although, for such a common requirement, it is not very obvious. Simply make a menu link to the relevant Static Content Item, then move the link so that it is the very first item in the Main Menu. Done. Easy as that. It is now your home page. Feel free to delete the existing "Home" menu item (Frontpage component). You can always recreate it. It is just a component link. You can't uninstall the Frontpage component itself, because it is integrated into the core.

The problem is that replacing the home page messes up your pathway (breadcrumb trail)!

Now, when you click on your "Home" menu link, the pathway will show:

Home > Home

instead of just Home once.

It shows Home just once if you come straight into your site by typing the URL http://www.yoursite.com
but not after you click on the Home menu item.

The problem is easy to solve. It is caused because the pathway script is hard-coded to expect the ItemID of the home page to have the value 1. Which is what it did have, until you displaced the old frontpage link with your new one. All new menu items are given a new ItemID.

You need to use a utility called phpMyAdmin to change the ItemID of your new home page menu item to a value of 1 directly in the MySQL database.

If the old frontpage link is still floating around your menu (ie. if you didn't delete it, but just moved it down and renamed it), make sure you swap the two ItemIDs over, rather than just changing one of them. Duplicates will cause a really big mess. If you did delete it make sure you empty the trash before changing anything.

So, the table you need to look for is prefix_menu
The prefix will be jos or mos or whatever you set it to at installation.
And the field to change is id (obviously).

It will be quite clear which menu item is which (and therefore which to change), but you can always check the current item id in the Joomla admin interface beforehand if you are the nervous type. Might be a good idea to back up the database first too.

That's it. Problem solved.

User avatar
bluesaze
Joomla! Guru
Joomla! Guru
Posts: 750
Joined: Mon Sep 05, 2005 6:18 am
Location: India
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by bluesaze » Sat Sep 24, 2005 2:54 am

toubkal wrote: WOW that is serious. I just replicated it on one of my sites. It did not work in some situations but in others, I got access to content set to registered.
Agreed then shouldnt this be reported as a security flaw......... to the joomla team
A. N. Jacob-New
The Tech & Design Blog http://www.Clazh.com

User avatar
rsphaeroides
Joomla! Ace
Joomla! Ace
Posts: 1369
Joined: Sun Aug 21, 2005 2:57 pm
Location: Colorado, USA
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by rsphaeroides » Sat Sep 24, 2005 4:52 am

bluesaze wrote: Agreed then shouldnt this be reported as a security flaw......... to the joomla team
Do you know of a mechanism for reporting security issues without describing them in the forum?  I haven't found a link.
¡Pura Vida!
Ray,
joomla in testing at Costa Rica Travel: http://costaricamap.net
http://costa-rica-guide.com

User avatar
bluesaze
Joomla! Guru
Joomla! Guru
Posts: 750
Joined: Mon Sep 05, 2005 6:18 am
Location: India
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by bluesaze » Sat Sep 24, 2005 4:59 am

rsphaeroides wrote: Do you know of a mechanism for reporting security issues without describing them in the forum?  I haven't found a link.
I think the best thing is to PM the The JOOMla Security Forum moderators or try PMing Brad...... he'll respond
A. N. Jacob-New
The Tech & Design Blog http://www.Clazh.com

User avatar
brad
Joomla! Master
Joomla! Master
Posts: 13419
Joined: Fri Aug 12, 2005 12:38 am
Location: Sydney - Australia
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by brad » Sat Sep 24, 2005 5:25 am

rsphaeroides wrote:
bluesaze wrote: Agreed then shouldnt this be reported as a security flaw......... to the joomla team
Do you know of a mechanism for reporting security issues without describing them in the forum?  I haven't found a link.
Please use the Joomla bug tracker on the developer.joomla.org site :)

Thanks.
Brad Baker
https://xyzulu.hosting
https://www.joomlatutorials.com <-- Joomla Help & Tutorials

User avatar
bluesaze
Joomla! Guru
Joomla! Guru
Posts: 750
Joined: Mon Sep 05, 2005 6:18 am
Location: India
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by bluesaze » Sat Sep 24, 2005 5:38 am

I think what he meant is that he doesnt want other people to know about the Security Flaw since someone might exploit it.
rsphaeroides wrote: I deleted the content of my post about the security issue and feel like something of a [redacted] for posting it in the first place.  Nothing like providing instructions to circumvent existing permissions.  
If core/dev/modertators didn't see it please contact me so I can fill you in on what the issue is without broadcasting it.
brad wrote: Please use the Joomla bug tracker on the developer.joomla.org site :)
A. N. Jacob-New
The Tech & Design Blog http://www.Clazh.com

User avatar
brad
Joomla! Master
Joomla! Master
Posts: 13419
Joined: Fri Aug 12, 2005 12:38 am
Location: Sydney - Australia
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by brad » Sat Sep 24, 2005 5:49 am

If you really ar certain it is serious and don't want to use the bugtracker, send an email to: security@joomla.org please.
Brad Baker
https://xyzulu.hosting
https://www.joomlatutorials.com <-- Joomla Help & Tutorials

User avatar
kai920
Joomla! Guru
Joomla! Guru
Posts: 542
Joined: Sun Sep 04, 2005 3:59 pm
Location: Hong Kong

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kai920 » Thu Oct 20, 2005 10:02 am

What you need to do is create a hidden menu (e.g. a menu whose mod_mainmenu module you do not publish).
Now wht you need to do is to create a `Table - Content Section` for all your sections.
So will the above fix solve my problem of my items getting assigned itemid=1?

kper - surprised no one has commented on your post yet! must admit i was thrown off at first by the length  ;), but I finally did read your entire post - very good info and explanations. thanks. can the frontpage component be used for other webpages as well, to control what is displayed?

User avatar
kper
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 26, 2005 11:09 am

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Mon Oct 24, 2005 8:41 pm

kai920 wrote: So will the above fix solve my problem of my items getting assigned itemid=1?
Might!  ;) It does for me, but pay close attention to the priority order of the various section/category listing styles (table, blog etc.)
kper - surprised no one has commented on your post yet! must admit i was thrown off at first by the length  ;), but I finally did read your entire post - very good info and explanations. thanks. can the frontpage component be used for other webpages as well, to control what is displayed?
Glad you found it helpful. I think no-one else has commented because it got lost in a mysterious security issue; plus it could probably be more clearly signposted. Bit too stream-of-consciousness. But it is a solution to a common requirement and hopefully a search will turn it up when someone needs it. Though the thread title may throw them off the scent. Perhaps it should be re-written and moved to a more general FAQ, or a "How to Change your Frontpage" thread?

Anyway, you can use the Frontpage component to make a different page within your site in order to control which items are displayed there, yes. But only one page, I think. You can't re-use it multiple times. And watch the ItemIDs.

You might also like to look at this (Editor's Choice from MAMBOPOWER):
http://www.mambopower.net/content/view/29/27/

It is a module rather than a component, but there is nothing to say you must have a component loaded in your template, and if you feel lost without one you can always create a custom component which simply loads a module position for Editor's Choice to sit in, as per Stingray's instructions here:
http://forum.mamboserver.com/showthread ... #post58679

emeyer
Joomla! Explorer
Joomla! Explorer
Posts: 352
Joined: Thu Sep 29, 2005 2:37 am

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by emeyer » Thu Oct 27, 2005 12:55 am

Deeper problem? - With the current paradigm, the menu item has additional properties associated with it. For example, a menu item has the property "open in a new window" associated with it, and it inherits properties from its module assigning its visibility, position, etc.

So I try this:
* Create a menu item as a link to content, and the menu item has "open in new window" defined. I publish it in the usual way. 

* I click the menu item. The content item appears in a new window.

* I make a second content item, paste the URL as a link into a second content item, and check it in. 

* I navigate to the second content item and click the link. The first item open but not in a new window!

But there are times when one wants this control. For example, suppose one wants to link to a content item, but the page should *only* open in the same window if the link is in the same section.

By the current *design* paradigm this should mean defining two menus, one of which is hidden; when accessing the hidden menu the items open in a new window, but when accessing the visible window the items open in the same window.

So should the Itemid be associated with the menu properites too, rather than the content item url? In fact, is there way to link to the menu, rather than the content item, for example by not incluing the id at all, in the following form?

Index.php?option=com_content&task=view&Itemid=345

---which would do whatever menu item with Itemid 345 does, instead of displaying "you are not authorized to vewi this resource". Does that make sense?

User avatar
kper
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 26, 2005 11:09 am

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Thu Oct 27, 2005 12:55 pm

emeyer wrote: Does that make sense?
It may well do, but I don't think I follow it myself...

Whether or not a link opens in a new window is controlled by the TARGET of the anchor. It isn't related to ItemID. The actual URL (including ItemID) is the same in both cases.

eg.

Code: Select all

<a href="URL" target="_blank">Link Text</a>
So just add that target bit to the link you paste into your new content item.

If you want to link to the content item in a new window with no modules or any of the rest of your site furniture, use the link for the printable version (turn on the print icon in the menu properties to get that), though you will also lose any pagination etc.

User avatar
kai920
Joomla! Guru
Joomla! Guru
Posts: 542
Joined: Sun Sep 04, 2005 3:59 pm
Location: Hong Kong

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kai920 » Sat Oct 29, 2005 9:40 am

Hi, not sure if this belows in this thread... but I'm getting some weird behaviro in my CID.

A bunch of my menu links, I've noticed, has someone gotten a CID of 0.  I can't find any info on the forums.  Is this related to the ItemID problem ???

emeyer
Joomla! Explorer
Joomla! Explorer
Posts: 352
Joined: Thu Sep 29, 2005 2:37 am

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by emeyer » Sat Oct 29, 2005 6:40 pm

kper, thanks for the answer :)

What if I want each section to own its own window: would I alter the core so that a BASE is defined for each section?

I think it would be kind of neat if the list for menu items insted of just saying "? open in parent window : open in new window" allowed one to select a particular window. For example:

* section1 opens in window section1
* section2 opens in window section2
* Menus and content links in section1 to other items in section1 open in the same window
* Menus and content links in section1 to items in section2 open in another window.
* If both section1 and section2 windows are open, then a link in the section2 window to a section1 item opens in the section1 window that is already open.

But I'm not quite sure whereis the best place such code should be inserted. 

User avatar
kper
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 26, 2005 11:09 am

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Sat Oct 29, 2005 8:15 pm

The easy way to do this (though it could get quite cumbersome to manage) is to create multiple menus which mirror each other but have their links configured differently (to open in new windows or not) and then assign the appropriate menu to the appropriate section as you would any other module. I haven't thought that through fully but I can already see plenty of pitfalls and circumstances under which it would fall down... but you could give it a try. This really calls for some nifty javascript if you have the skills and decide it is worth the effort. Might be quite annoying and confusing for visitors.

However, could I suggest you start another thread about that, because we are already way off the ItemID trail and this one is going to get very messy otherwise?

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kenmcd » Sat Oct 29, 2005 11:26 pm

I can split the related posts off into a new thread.

Just keep talking and I will go through and pick out all the related posts and split them all at once so you will have a complete thread.

Later today or tomorrow . . .
██ LibreTraining

User avatar
kper
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 26, 2005 11:09 am

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Sun Oct 30, 2005 6:38 pm

OK, thanks Ken. In the meantime, here is another exciting ItemID solution. Quite long again, I'm afraid, but hopefully reasonably clear. Please point out any errors. Took me a while to solve this problem (in Mambo 4.5.1, but same in Joomla from what I can tell), so heartily sick of it now and I may have missed some important ramifications.

This one relates to that useful feature of blog listings where you can show each content item's category name and make that name linkable.

Unfortunately, if you don't fix things, it turns out to be a totally useless feature and gets you into a complete mess with different URLs all over the place to the same content items. That's BAD.

The problem is that the automatically generated link goes to a Table - Content Category type listing rather than a  Blog - Content Category listing.

The effect of that is that the links to content items in the category listing take their ItemID from the Table - Content Category . The links to the very same content items in the Blog - Content Section listing take their ItemID from that blog listing. So they are different.

Not only will that screw up your Google ranking, but also make modules which you thought were going to show up with your content items suddenly disappear from view. If you don't happen to have a Table - Content Category link already in your menu for that category, you won't even be able to assign any modules to the content items reached via that route!

The accepted way of sorting this kind of thing out is to make a Table - Content Section (or "List - Content Section" in older terminology) link in your menu for the relevant Section. It doesn't have to be visible, but it must be published: you can hide it under another, unpublished, menu item; or you can create a separate menu for all such links which you then assign to a non-existent module position.

This works (usually) because the Table - Content Section ItemID is supposed to take precedence over everything else, so all content items from that section always have that ItemID - CONSISTENCY! Yippee!  :o

You can then also assign modules to that Table - Content Section menu item and they will appear on your content items.

If the Table - Content Section link is not itself required and can be hidden (ie. you are only using blog listings), it can actually be quite useful, in fact, to have a blog listing with one set of modules assigned and then different modules assigned to the content items themselves when they are read (eg. mod_related_items).

Note that there are disadvantages too: it completely screws up your pathway for a start. It will also ruin any plans you may have had to highlight the active section or category within your menu structure.

The other disadvantage is that, in this particular case, it doesn't work!

Or rather, it does work for the Blog - Content Section listing part of the equation (ItemIDs there now come from the new Table - Content Section menu item), but once you follow the link to the Table - Content Category listing, ItemIDs continue to be assigned from that and are not read from the menu link you have just so smugly created. It is tempting to conclude at this point that it would be quicker and less hassle to sod it and hand-code the entire site. Especially since you have read above, in this thread, that Section lists take precedence over Category lists.

Don't fight it. Don't delete your new magic menu item. Don't despair. If you make appropriate parameter choices, there isn't much visual difference between a table and a blog listing anyway - so just make the automatic link point to a "Blog - Content Category" listing instead! Blog listings of any kind are powerless in the face of your new magic menu item. This is how you do it:

Find the file components/com_content/content.php

Find the following line:  (under the comment    // loads the link for Category name )

Code: Select all

$link = sefRelToAbs( 'index.php?option=com_content&task=category&sectionid='. $row->sectionid .'&id='. $row->catid .'&Itemid='.$_Itemid );
Change it to:

Code: Select all

$link = sefRelToAbs( 'index.php?option=com_content&task=blogcategory&id='. $row->catid .'&Itemid='.$_Itemid );
That's it.

Except that you will now want to make some Blog - Content Category menu items for the relevant categories so that you can control the parameters (if you don't already have them). They can be in your hidden menu if you don't need them for anything else.

You've earned a beer now. Relax. Breathe deeply.

User avatar
kper
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 26, 2005 11:09 am

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Sun Oct 30, 2005 11:57 pm

As an extra little touch, you might want to add a CSS class to the span which contains the Category Name on the items in the blog - just to make it easier to style. (Don't forget when writing your CSS, it may or may not be hyperlinked, depending on the blog parameters chosen.)

In components/com_content/content.html.php
find
function Category( $row, $params ) {

and change the span tag so it reads
Last edited by kper on Mon Oct 31, 2005 12:03 am, edited 1 time in total.


Locked

Return to “FAQ Discussion Board”