DISCUSSION: Incorrect Itemid-list of possible solutions

Discuss the FAQ's here, and get in touch with the FAQ Team.
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 » Wed Jan 11, 2006 6:44 pm

OK, great. I was just trying to think under what circumstances it might be needed, you see.

audienceone
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 214
Joined: Thu Aug 18, 2005 2:01 pm
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by audienceone » Tue Jan 17, 2006 2:16 am

With regards to templates breaking the overall layout and menu system, I'm actually using the workaround I posted in all components that has integrations with other components. It's keeps the template and menus intact all thoughout the site if you use a valid Itemid when you cross from one component to another.

to name a few:
Joomlaboard to Community Builder
Community Builder to PMS, MyPMS, UddeIM
Community Builder to PonyGallery

and many other components... Itemid is afaik the identifier with which template to use for the component or menu.
"Speak your truth quietly and clearly; and listen to others; even the dull and ignorant, for they too have their story
...
If you compare yourself with others you may become vain or bitter, for always there will be greater and lesser person than yourself."

User avatar
spike00
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Wed Jan 25, 2006 10:56 pm
Location: Busto Arsizio (VA) - Italy
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by spike00 » Wed Jan 25, 2006 11:09 pm

Well, I created a section and a category in it. Then I created a new menu (let's call it menu2) to be visible only within that category.
Everything works if I reach the category content clicking on the category name placed in the main menu (under the section). But if I reach the category content by clicking on the category link created by the showtable (i.e. the showContentList function) the menu2 is not displayed.
I found that the category link created by the showContentList functions has Itemdid = section Itemid, the category link in the main menu has a different Itemid.
How is possible to tell showContentList to use the correct Itemid? Or am I doing something wrong? (Pretty new to Joomla/mambo).

Please, forgive my bad english.
Paolo De Dionigi
Moderator of Zen Cart Italy

http://www.atfriends.net

audienceone
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 214
Joined: Thu Aug 18, 2005 2:01 pm
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by audienceone » Thu Jan 26, 2006 12:47 am

spike00 wrote: How is possible to tell showContentList to use the correct Itemid? Or am I doing something wrong? (Pretty new to Joomla/mambo).
Currently, Joomla checks first if an Itemid exists and if its null it will assign an Itemid based on sectionid, category, etc. etc. else assign 0 or 9999x.  And my approach to your problem is to have Joomla's Core Itemid assigning function prioritize assigning the Itemid used in menus as the itemid for a section or category and make the sectionid secondary and catergory id as tertiary option as Itemid.

I hope you get my point.
"Speak your truth quietly and clearly; and listen to others; even the dull and ignorant, for they too have their story
...
If you compare yourself with others you may become vain or bitter, for always there will be greater and lesser person than yourself."

mindnsoul
Joomla! Intern
Joomla! Intern
Posts: 81
Joined: Thu Sep 22, 2005 8:29 pm

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by mindnsoul » Thu Jan 26, 2006 4:37 am

Do we know if this has been resolved yet in the latest version ? because I'm 1.0.7 and still having this problem..

User avatar
spike00
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Wed Jan 25, 2006 10:56 pm
Location: Busto Arsizio (VA) - Italy
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by spike00 » Thu Jan 26, 2006 8:49 am

audienceone wrote:
Currently, Joomla checks first if an Itemid exists and if its null it will assign an Itemid based on sectionid, category, etc. etc. else assign 0 or 9999x.  And my approach to your problem is to have Joomla's Core Itemid assigning function prioritize assigning the Itemid used in menus as the itemid for a section or category and make the sectionid secondary and catergory id as tertiary option as Itemid.

I hope you get my point.
Thanks for your reply. Now I understood the logic, but not where to look to understand how I may tell to Joomla to use the Itemid used in the menu as the itemid for sections and categories as primary option.

Yesterday was the first time I looked into a joomla file, so I don't know the structure.

Just another (OT) question, Is it planned (this year, next year, never?) to modify the content management engine? I mean: It seems to me that now is too news oriented, It'd be very very very cool if it were object oriented (with object I mean everything: section, category, folder, directory, and sigle content item) having so the possibility to create our own objects: let's say I create a section, then a subsection in it, then a category in it, then a sub-category in it, then I place in this sub-category some pages, 1 forum, some news (with their own structure), some other modules/component specific only to that sub-category.
After that it would be wonderful if it could be possible to duplicate the entire structure just with one click.

Wow (very ot) I entered the office 15 mins ago normally, now I looked out and everything is white (snow), never seen such a blizzard in Italy (sorry for Ot but I love snow, so ...)
Paolo De Dionigi
Moderator of Zen Cart Italy

http://www.atfriends.net

audienceone
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 214
Joined: Thu Aug 18, 2005 2:01 pm
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by audienceone » Thu Jan 26, 2006 6:39 pm

mindnsoul wrote: Do we know if this has been resolved yet in the latest version ? because I'm 1.0.7 and still having this problem..
I don't know if this is actually a bug. Personally, I don't consider this a bug (problem)
spike00 wrote:
Thanks for your reply. Now I understood the logic, but not where to look to understand how I may tell to Joomla to use the Itemid used in the menu as the itemid for sections and categories as primary option.

Yesterday was the first time I looked into a joomla file, so I don't know the structure.

Just another (OT) question, Is it planned (this year, next year, never?) to modify the content management engine? I mean: It seems to me that now is too news oriented, It'd be very very very cool if it were object oriented (with object I mean everything: section, category, folder, directory, and sigle content item) having so the possibility to create our own objects: let's say I create a section, then a subsection in it, then a category in it, then a sub-category in it, then I place in this sub-category some pages, 1 forum, some news (with their own structure), some other modules/component specific only to that sub-category.
After that it would be wonderful if it could be possible to duplicate the entire structure just with one click.
You can read a lot about where Joomla is headed on here http://help.joomla.org/

Please visit the site.
"Speak your truth quietly and clearly; and listen to others; even the dull and ignorant, for they too have their story
...
If you compare yourself with others you may become vain or bitter, for always there will be greater and lesser person than yourself."

User avatar
gsbe
Joomla! Guru
Joomla! Guru
Posts: 871
Joined: Wed Aug 17, 2005 10:13 pm
Location: Lexington, VA
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by gsbe » Tue Feb 28, 2006 9:51 am

audienceone wrote: Currently, Joomla checks first if an Itemid exists and if its null it will assign an Itemid based on sectionid, category, etc. etc. else assign 0 or 9999x.  And my approach to your problem is to have Joomla's Core Itemid assigning function prioritize assigning the Itemid used in menus as the itemid for a section or category and make the sectionid secondary and catergory id as tertiary option as Itemid.
Fascinating solution to this old problem. Can this code be run as a mambot somehow? I'd like to see a way to force these itemID changes based on menus that didn't involve core hacking. Really cool idea here, audienceone.
http://gigcalendar.net: the world's first free solution for maintaining a touring calendar for Joomla!

audienceone
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 214
Joined: Thu Aug 18, 2005 2:01 pm
Contact:

DISCUSSION: Incorrect Itemid-list of possible solutions

Post by audienceone » Tue Feb 28, 2006 1:20 pm

gsbe wrote: ...

Fascinating solution to this old problem. Can this code be run as a mambot somehow? I'd like to see a way to force these itemID changes based on menus that didn't involve core hacking. Really cool idea here, audienceone.
Yes, this can definitely be implemented as a mambot. The solution I implemented is not much of a core hack as it will only take creating a new file, paste the function and be ensure that that new file is included by index.php or index2.php to make it available to all components and modules. But then again, converting this into a mambot is a much better idea. :D

Will look into it.
"Speak your truth quietly and clearly; and listen to others; even the dull and ignorant, for they too have their story
...
If you compare yourself with others you may become vain or bitter, for always there will be greater and lesser person than yourself."

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

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by emeyer » Fri Mar 03, 2006 2:52 am

Actually I recently reached the same conlusion about a mambot. I was working with extended menu with dtree plugin. Recently we were blessed with a "section" option in extended menu which automatically lists all the categories and items in a totally flexible set of sections--and you dont even need to make a menu for it. Harray, real automation! Just add a content item and it shows up in the menu!

Well ok it still needs to be optimized and so on, but more importantly the pathway doesnt always work properly. What I find with extended menu is, if I set up a mainmenu module with a menu item that's a section table, and then set extended menu to automatically expand the section menu item, then it shows all the items ok, and the pathway works. But with say 60 sections that means creating 60 mainmenu modules, 60 menu items, and 60 extended menu modules--and without complaining about how long that takes, I'd do it anyway, but Joomla starts getting rather sluggish.

So now there is the new extended menu option "section", where we can just enter a comma-delimited string of sections to be in one menu (say "1,2,3,4,5" for the first five sections, or even "-2" to show all sections except section 2--very well thought out). Then we dont have to make dummy menu items at all, we can just publish the extended module. It creates a menu of all the items for all the categories in those sections automagically!

Great, I thought, now I can devide up the 60 sections into five extended menu modules; add links to them in the  mainmodule; and set the magical appearance/disapprearances so that only one of the five extended menu modules is visible at a time. Seemed like a perfect idea to simplify the front end.

The links and highlights all work in the extended module menus, if they are always visible; but it doesn't work beyond that--
* First, the pathway gets confused, because all the sections in one extended module have the same itemid.
* Second,if you set an extended module to a visibility other than "all menu items", then there are times when you click links in the body (like "next page" buttons, or category links, or links in the content itself) and all the menus disappear levaing you feeling very hopless.

So actually I think mambotrs could be the perfect solution. I was wondering about two mambots:

* one that sets the pathway title to be the currently-displayed section, and category, and (if any are displayed) first item title. I guess it should have options permitting user to set blog/table view characteristics when the pathway's category or section link is clicked.

* Secondly a mambot that works out which modules should be visible, based on category and section ids, rather than menu ids--that would stop them disappearing so unwantonly.

How's that for a straw man?

- Ernest

audienceone
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 214
Joined: Thu Aug 18, 2005 2:01 pm
Contact:

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by audienceone » Sat Mar 04, 2006 11:36 pm

Hi Ernest,

Hmmnnn... the current workaround won't work with the extended menu. If it has to work it would be an entirely different mambot exhausting all the possible options of getting core menu itemid and then proceed with extended menu's menu logic. This is doable, but I think this would be a larger mambot, larger than the expected mambot sizes and would do a lot of queries in the database.

As with the pathways problem you have, that has something to do with developers not utilizing $mosMainFrame->addpathway() function to ensure that their components add a pathway.

And back to making the little workaround a mambot. Hope I'll have time soon. :D And hope with 1.1 approaching the problem will solved or the workaround be adopted with the core's getItemid()


- a1
"Speak your truth quietly and clearly; and listen to others; even the dull and ignorant, for they too have their story
...
If you compare yourself with others you may become vain or bitter, for always there will be greater and lesser person than yourself."

User avatar
barnett
Joomla! Intern
Joomla! Intern
Posts: 76
Joined: Fri Aug 19, 2005 12:52 pm
Location: Nyack, NY

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by barnett » Wed Apr 05, 2006 3:17 pm

audienceone wrote: And back to making the little workaround a mambot. Hope I'll have time soon. :D And hope with 1.1 approaching the problem will solved or the workaround be adopted with the core's getItemid()
Hey audienceone,

This mambot sounds great, and this whole discussion has been informative.  Two questions:

1) How is the progress coming on this mambot?

2) Will this mambot resolve the "readmore..." link issue I'm having with itemid?  When I click the readmore link on the frontpage it doesn't go to the correct menu I've already set up for the blogcategory in which that article is placed, but instead returns the home page itemid.

Thanks.
-barnett
http://www.contemplatedesign.com/ - Joomla Development & Design

User avatar
barnett
Joomla! Intern
Joomla! Intern
Posts: 76
Joined: Fri Aug 19, 2005 12:52 pm
Location: Nyack, NY

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by barnett » Tue Apr 25, 2006 2:35 pm

Hey Everyone-

  Any updates?  Has this discussion moved elsewhere?  Thanks.

-barnett
http://www.contemplatedesign.com/ - Joomla Development & Design

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

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kenmcd » Wed Apr 26, 2006 4:07 pm

Working links from original post
(changed "forum.opensourcematters.org" to "forum.joomla.org")

Topic: Mambo/Joomla! creates wrong urls to items
http://forum.joomla.org/index.php/topic,3509.0.html

Topic: You are not authorized to view this resource.
http://forum.joomla.org/index.php/topic,3243.0.html

Topic: menu appears with a specific category ?
http://forum.joomla.org/index.php/topic,2839.0.html

Topic: Content Category list
http://forum.joomla.org/index.php/topic,4235.0.html

Topic: Category listing links not working
http://forum.joomla.org/index.php/topic,3862.0.html

Topic: rss not displaying correct link
http://forum.joomla.org/index.php/topic,1168.0.html

Topic: Related item & Menu Highlighting not updating from Table-Content Category links
http://forum.joomla.org/index.php/topic,3567.0.html

Topic: not authorized to view ... (not same as others)
http://forum.joomla.org/index.php/topic,1136.0.html

Topic: pathway - Breadcrumbs
http://forum.joomla.org/index.php/topic,1166.0.html

Topic: Related module
http://forum.joomla.org/index.php/topic,2847.0.html

Topic: Read more-link links wrong! Why?
http://forum.joomla.org/index.php/topic,1985.0.html

Topic: Not sure: Where to post bugs?
http://forum.joomla.org/index.php/topic,1795.0.html
██ LibreTraining

Ruben_Tec
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Tue Apr 04, 2006 9:15 am

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by Ruben_Tec » Thu Apr 27, 2006 3:38 pm

kper wrote: This tip follows on from my previous one about making Category Names linkable in blog listings and on content items.

I'll try to make it short by simply posting the (commented) code. Changes are actually straightforward.

Once again, please correct any errors and point out any implications or trip-wires I have missed. I must admit, I haven't thought through on this one what will happen if you have more than one Blog - Content Section menu link for the same Section, but it can't be worse than the status quo(!)...

So; you can also make Section Names linkable on Content Items. This is extremely useful. Why?

You will have noticed that if you create Table - Content Section menu items in a hidden menu in order to normalize ItemIDs when you are primarily using blog-style listings on your site, this screws up your pathway.

It also screws up active menu highlighting. A Section Blog highlights OK, as does a (child) Category Blog, but you lose the highlighting when you click through to a Content Item, because the Content Item takes its ItemID from the hidden Table - Content Section menu item.

So, ideally, you need to provide an alternative way of showing your visitor where they are in the site - to which section and category the article they are reading belongs.

This is ONLY an issue if you have set up your site in a certain way, using blog listings. It won't apply to everyone, but is quite common.

If you show and make linkable both Section Name and Category Name in the parameters of each of your Content Items, (and assuming you have made the changes in my previous tip,) you effectively have a replacement pathway which works... ALMOST.

Unfortunately, the Section Name link picks up its ItemID from the Table - Content Section menu item in the hidden menu, which is not what we want. We want the link to take us back to our Section Blog listing, which is the visible menu item from which we came to the article.

I made the following changes (which incorporate those from the previous Category Name Link tip - everything is commented):

com_content/content.php

Code: Select all

<?php //Helps forum to do code highlighting - not relevant to solution


// loads the link for Section name
if ( $params->get( 'section_link' ) ) {
	$query = 	"SELECT a.id"
	. "\n FROM #__menu AS a"
	. "\n WHERE a.componentid = ". $row->sectionid.""
	. "\n AND a.type = 'content_blog_section'" /** Kper added this line so that a content_blog_section itemid is
	                           used for this particular link. This ties in with the change to the Category name link, below.
	                           The intention is to use these links as a replacement for the Pathway when using blog listings
	                           togeher with a LIST-SECTION menu item in a hidden menu for ItemID normalization.
	                           */
	;
	$database->setQuery( $query );
	$_Itemid = $database->loadResult();
	// Kper changed task=section to task=blogsection in the next line. See note under Category Name, below.
	$link = sefRelToAbs( 'index.php?option=com_content&task=blogsection&id='. $row->sectionid .'&Itemid='.$_Itemid );
	$row->section = '<a href="'. $link .'">'. $row->section .'</a>';
}

// loads the link for Category name
if ( $params->get( 'category_link' ) ) {
	$query = 	"SELECT a.id"
	. "\n FROM #__menu AS a"
	. "\n WHERE a.componentid = ". $row->catid.""
	;
	$database->setQuery( $query );
	$_Itemid = $database->loadResult();
/** Kper replaced the following $link line with the one below it so that linked category names in section blogs
    and on content items go to a category BLOG listing rather than a category TABLE listing. Otherwise there
    are problems with ItemIDs for the content items. This way, a LIST-SECTION menu item can be published
    and ALL the content item links will pick up their ItemIDs from that.
    If the linked category name is a TABLE rather than a BLOG listing (as it is by default), the content item links
    in it will take their ItemIDs from that TABLE-CATEGORY listing (which will, in fact, get NO ItemID if such a
    menu link is not already published), whilst the content item links in the original section blog will take their
    ItemIDs from either that section blog or (if one is published) the LIST-SECTION menu item for that section.
    Arrrrgh!
    
	$link = sefRelToAbs( 'index.php?option=com_content&task=category&sectionid='. $row->sectionid .'&id='. $row->catid .'&Itemid='.$_Itemid );

*/

	$link = sefRelToAbs( 'index.php?option=com_content&task=blogcategory&id='. $row->catid .'&Itemid='.$_Itemid );
	$row->category = '<a href="'. $link .'">'. $row->category .'</a>';
}
EDIT for stupidity: I don't know what I was thinking with this. I have now changed the SQL above from ORDER BY a.type to AND a.type = 'content_blog_section'



com_content/content.html.php

Code: Select all

<?php //Helps forum to do code highlighting - not relevant to solution


/**
* Writes Section  -  class="categorynamelinkable" added by Kper for styling of Section names
*                     when they are displayed on content items
*/
function Section( $row, $params ) {
	if ( $params->get( 'section' ) ) {
			?>
			<span class="categorynamelinkable">
			<?php
			if ( $params->get( 'category' ) ) { echo "Section: "; } //Kper added this line
			echo $row->section;
			// writes separator between Section & Category Name when both are active
			if ( $params->get( 'category' ) ) {
				echo '  > '; // I prefer this to a dash. nbsp is because I have padding on the spans via css
			}
			?>
			</span>
		<?php
	}
}

/**
* Writes Category  -  class="categorynamelinkable" added by Kper for styling of Category names
*                     when they are displayed on content items and in blog listings
*/
function Category( $row, $params ) {
	if ( $params->get( 'category' ) ) {
		?>
		<span class="categorynamelinkable">
		<?php
		if ( !$params->get( 'section' ) ) { echo "Section: "; } //Kper added this line. I know it is a category, not a section, but site visitors will perceive it as a sub-section.
		echo $row->category;
		?>
		</span>
		<?php
	}
}
Hope that is of some use to someone.
Ok, I know it may be a stupid question, but, where do I place those hacks? In what line? Do I have to replace some code or not? Thanks! :)

Ruben_Tec
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Tue Apr 04, 2006 9:15 am

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by Ruben_Tec » Tue May 02, 2006 11:51 am

Anyone??

User avatar
DaveBelden
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Thu Apr 06, 2006 6:40 pm
Location: Chicago
Contact:

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by DaveBelden » Wed May 03, 2006 10:28 pm

Ruben_Tec: I'm applying the hack posted by audienceone earlier in this thread:
http://forum.joomla.org/index.php/topic ... #msg168791

It just seems less intrusive and easier to handle. Unfortunately, I have to wait for my sysadmin to grant me some permissions first, but I'll post back here and let you know how I fared. This is a pretty confusing/frustrating issue.

Dave

User avatar
DaveBelden
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Thu Apr 06, 2006 6:40 pm
Location: Chicago
Contact:

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by DaveBelden » Wed May 03, 2006 11:05 pm

Well, that didn't seem to accomplish anything... maybe someone else will have success?

My category links are virtually useless, since they take the user to an entirely different section.

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

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Thu May 04, 2006 8:41 am

Ruben_Tec wrote: Ok, I know it may be a stupid question, but, where do I place those hacks? In what line? Do I have to replace some code or not? Thanks! :)
Sorry you are finding this difficult.

Please do be aware that, though they are a good way to learn how things work, you can easily get yourself into a mess with core hacks, so do back-up the files you are going to change before you do so, then you can revert if necessary.

Also, please note that core hacks are a pain in the neck when it comes to upgrading to the latest Joomla release because they may be overwritten by the patch. That means you may have to reapply them, and there is also a possibility that core code will have been changed by the patch in the area that you have hacked; so the hack may no longer work, may need adapting, or may no longer be relevant. There is also a risk that you may inadvertently introduce a security vulnerability. So caveat emptor (or whatever the open source equivalent is!)

So now that we've got the MS-regedit-style warnings out of the way,

com_content/content.php
and
com_content/content.html.php

mean look under your Joomla directory (which may well be the root of your site) for a directory called "components"
inside there is a directory called "com_content"
inside there are the two php files you need to hack

These two files constitute the front-end of the integrated component which displays content items in their various forms.

What you need to do is find the relevant bits of code and change them.

The code I posted is commented, so you can see which bits were there already and what changes I made.
Comments (ie. text not treated as part of the code) are either on a single line starting with //
or over multiple lines starting /** and ending */

Just use "find" to locate the right bit eg. search for "function Section".

Be careful though, these are long files with lots of bits that look quite similar. I'm afraid I can't give you line numbers off hand.

And indeed the code may have changed since I posted these hacks, so do be aware of that posibility - I haven't looked into it for a few version releases now (I'm waiting for v1.0.9 to start my next project).

It will help if you use an application which highlights code to make it easier to read, rather than a simple text editor - even Dreamweaver will do.

Good luck with it. And do back-up!  :)

Ruben_Tec
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Tue Apr 04, 2006 9:15 am

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by Ruben_Tec » Thu May 04, 2006 9:38 am

DaveBelden wrote: Well, that didn't seem to accomplish anything... maybe someone else will have success?

My category links are virtually useless, since they take the user to an entirely different section.
Yeah I tried that too but didnt seem to do nothing... ???

Ruben_Tec
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Tue Apr 04, 2006 9:15 am

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by Ruben_Tec » Thu May 04, 2006 9:40 am

kper wrote:
Ruben_Tec wrote: Ok, I know it may be a stupid question, but, where do I place those hacks? In what line? Do I have to replace some code or not? Thanks! :)
Sorry you are finding this difficult.

Please do be aware that, though they are a good way to learn how things work, you can easily get yourself into a mess with core hacks, so do back-up the files you are going to change before you do so, then you can revert if necessary.

Also, please note that core hacks are a pain in the neck when it comes to upgrading to the latest Joomla release because they may be overwritten by the patch. That means you may have to reapply them, and there is also a possibility that core code will have been changed by the patch in the area that you have hacked; so the hack may no longer work, may need adapting, or may no longer be relevant. There is also a risk that you may inadvertently introduce a security vulnerability. So caveat emptor (or whatever the open source equivalent is!)

So now that we've got the MS-regedit-style warnings out of the way,

com_content/content.php
and
com_content/content.html.php

mean look under your Joomla directory (which may well be the root of your site) for a directory called "components"
inside there is a directory called "com_content"
inside there are the two php files you need to hack

These two files constitute the front-end of the integrated component which displays content items in their various forms.

What you need to do is find the relevant bits of code and change them.

The code I posted is commented, so you can see which bits were there already and what changes I made.
Comments (ie. text not treated as part of the code) are either on a single line starting with //
or over multiple lines starting /** and ending */

Just use "find" to locate the right bit eg. search for "function Section".

Be careful though, these are long files with lots of bits that look quite similar. I'm afraid I can't give you line numbers off hand.

And indeed the code may have changed since I posted these hacks, so do be aware of that posibility - I haven't looked into it for a few version releases now (I'm waiting for v1.0.9 to start my next project).

It will help if you use an application which highlights code to make it easier to read, rather than a simple text editor - even Dreamweaver will do.

Good luck with it. And do back-up!  :)
Ok! Thanks for the info! I apreciate that. I`m going to try that hack now. I`ll post here the results.

Ruben_Tec
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Tue Apr 04, 2006 9:15 am

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by Ruben_Tec » Thu May 04, 2006 9:47 am

Well it didnt work. The behaviour is the same... thanks anyway.

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

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Thu May 04, 2006 10:07 am

Ruben_Tec wrote: The behaviour is the same
Define the behaviour.

Ruben_Tec
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Tue Apr 04, 2006 9:15 am

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by Ruben_Tec » Thu May 04, 2006 10:21 am

kper wrote:
Ruben_Tec wrote: The behaviour is the same
Define the behaviour.
Well, my site (http://temp.multimeios.pt) is structured the way its suposed to be: sections>categories>content items. But Joomla cant "see" the categories. If I follow the path ,for example, Cinema>Sessões>Matrix the pathway presents the way correctly. But if, on the frontpage, I click on a link to the content item (in this case "Matrix"), the pathway presents only the section and the content item. I`ve been told that it is an issue with the Itemid. So, I was trying to find an hack to solve this problem. Tha hack you sugested didnt seem to have any kind of effect. Maybe it wasnt for this specific issue.

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

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Thu May 04, 2006 12:05 pm

Yes, it is sort of an ItemID issue and sort of a pathway issue. Unfortunately you are scrabbling around for a magic bullet solution when there isn't one. You have to read carefully, fully understand the problem and then structure your site accordingly. The hack you have now implemented could be part of a solution, but that depends on how you want your site to work.

The pathway is built based on the structure of the main menu. It works in the way that you want it to only when you click on the Matrix link under the Sessões menu item because your main menu is presumably structured:

Cinema (Section Blog)
----Sessões (Category Blog)
--------Matrix (Content Item Link)

You will notice that that Matrix content item link has its own separate ItemID of 170, so the pathway looks at the main menu structure and dutifully reflects it.

Unfortunately, all the other links to the Matrix content item (on the frontpage and in the two blogs) are picking up their ItemID from the Cinema Section Blog.

When a link takes its ItemID from a blog of any kind, the pathway always shows only
Home > Blog > Content Item

Which is annoying.

See here for a little more enlightening info to think about:
http://forum.joomla.org/index.php/topic,23352.0.html

Ruben_Tec
Joomla! Intern
Joomla! Intern
Posts: 52
Joined: Tue Apr 04, 2006 9:15 am

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by Ruben_Tec » Thu May 04, 2006 1:09 pm

kper wrote: Yes, it is sort of an ItemID issue and sort of a pathway issue. Unfortunately you are scrabbling around for a magic bullet solution when there isn't one. You have to read carefully, fully understand the problem and then structure your site accordingly. The hack you have now implemented could be part of a solution, but that depends on how you want your site to work.

The pathway is built based on the structure of the main menu. It works in the way that you want it to only when you click on the Matrix link under the Sessões menu item because your main menu is presumably structured:

Cinema (Section Blog)
----Sessões (Category Blog)
--------Matrix (Content Item Link)

You will notice that that Matrix content item link has its own separate ItemID of 170, so the pathway looks at the main menu structure and dutifully reflects it.

Unfortunately, all the other links to the Matrix content item (on the frontpage and in the two blogs) are picking up their ItemID from the Cinema Section Blog.

When a link takes its ItemID from a blog of any kind, the pathway always shows only
Home > Blog > Content Item

Which is annoying.

See here for a little more enlightening info to think about:
http://forum.joomla.org/index.php/topic,23352.0.html
Thats exactly the issue! So, as you say, the way I structured the site causes this ItemId problem. But, is there a different way to do such structure and, in consequence, avoid the ItemId "bug"? If there is, could you point me where I can read an explanation to do so? Thanks! :)

User avatar
DaveBelden
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Thu Apr 06, 2006 6:40 pm
Location: Chicago
Contact:

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by DaveBelden » Thu May 04, 2006 5:10 pm

I sort-of solved part of this issue, at least for my particular setup. To recap, if I was viewing a content item, and decided to follow the Category link (to view a list of all items in that category, naturally) the list would appear under the wrong Section.

For example, this is my structure:

News (section)
  -  news items (a category under the News section)
    -  content item (in the news items category, which is in the News section)

However, when viewing the content item, I'd click the 'news items' category link, and the list of news items would appear in the 'Bio' section of the site (which actually isn't a section, it's a static content item linked to from my mainmenu... maybe that's part of the problem?).

So, my 'fix' was to create a dummy menu in the Menu Manager (I called it dummymenu). I did NOT even publish this menu!

Under the Category Manager, I edited my 'news items' category so that it linked to the dummymenu with Type: Content Category Blog

Now, when I click the category link in the content item, it shows a listing of the news items, but doesn't assign any particular section. For a user, this might be a little confusing, since my mainmenu doesn't highlight the active section (it oughta highlight the News section), but at least the title bar is correct, and it's not residing in the 'Bio' section any more. Hope that makes sense. Here's a link to the site in question (it's not finished yet):

http://www.soovin.com/joomla/

Another catch is that I don't know where to go if I want to style the category list (I'd like to kill off the filter menu, for starters).

Hope this helps someone,
Dave

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

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Thu May 04, 2006 7:18 pm

@DaveBelden

I really like the site (except that the picture behind the concert listing on the front page needs fading out and desaturating - but you did say it was unfinished).

Unfortunately, the rest of what you describe doesn't make sense to me; but that is likely more down to me than to you. Perhaps just a confusion of terminology... I'm glad you sorted out your problem, anyway.

To change the way a category list is presented (including removing the filter), set the parameters of the relevant menu item.


@Ruben_Tec

That's what this whole thread is basically about! You will probably need to read it all a few times and play about with a test setup before you get your head around it though... I certainly had to.

Bear in mind that you may need to ditch the idea of using the pathway at all. It seems like a nice feature, but if you are using blog listings rather than table listings it can be more trouble than it is worth.

The hack you implemented is intended to allow you to use parameter options as a substitute for the pathway by displaying a link back up to the relevant section or category blog under circumstances when visitors might want to go back up a level or to see clearly where they are in the site structure (particularly when menu highlighting has been lost because a hidden menu has been used to normalize ItemIDs). But it might not fit how you envisage your site.

You may want to look into the various "SEF" URL add-ons, eg. SEFAdvance, because if your URLs make sense to a human being, they won't need a pathway.

There are also many other add-ons (eg. Extended Menu by Daniel Ecer) which, whilst not actually solving the problem at root in themselves, may allow you to come to a setup which works for you and masks the issue - working with Joomla rather than against it.

Some setups may also merit looking into hacking the includes/pathway.php file itself.

It will all be worth it in the end!... I haven't found a better system, taken overall, than Joomla, anyway, regardless of these little quirks...
Last edited by kper on Thu May 04, 2006 8:58 pm, edited 1 time in total.

User avatar
DaveBelden
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Thu Apr 06, 2006 6:40 pm
Location: Chicago
Contact:

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by DaveBelden » Thu May 04, 2006 8:50 pm

kper wrote: @DaveBelden

I really like the site (except that the picture behind the concert listing needs fading out and desaturating - but you did say it was unfinished).

Unfortunately, the rest of what you describe doesn't make sense to me; but that is likely more down to me than to you. I'm glad you sorted out your problem, anyway.

To change the way a category list is presented (including removing the filter), set the parameters of the relevant menu item.
Whoa! You're seeing a picture behind a concert listing?! That shouldn't be happening anywhere at any time. Can you tell me what browser/platform you're using? Here's the site again for reference:
http://www.soovin.com/joomla

As for setting parameters on the menu item to NOT display the filter; I'm not given that option in any of the relevant menus. (I know what you're talking about because I've been able to control the display elsewhere, just not here.

Thanks,
Dave

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

Re: DISCUSSION: Incorrect Itemid-list of possible solutions

Post by kper » Thu May 04, 2006 9:22 pm

DaveBelden wrote: Whoa! You're seeing a picture behind a concert listing?! That shouldn't be happening anywhere at any time. Can you tell me what browser/platform you're using?
Yup! Windows 2000 SP4 IE6
In Firefox the listing is below the picture.
Maybe it's because I have Flash (well, all ActiveX, in fact,) disabled in IE?
DaveBelden wrote: As for setting parameters on the menu item to NOT display the filter; I'm not given that option in any of the relevant menus. (I know what you're talking about because I've been able to control the display elsewhere, just not here.
That's because Joomla has automatically generated the Table - Content Category link on your content item: you haven't explicitly created your own menu link of that type (if I understand you correctly, you created a hidden menu link to a category blog listing instead). If you do so, you should be able to set parameters for it, all other things being equal.

BTW: Note the scroll bars on that screenshot. That's full screen at 1024x768.  Same in Firefox.
You do not have the required permissions to view the files attached to this post.
Last edited by kper on Thu May 04, 2006 9:26 pm, edited 1 time in total.


Locked

Return to “FAQ Discussion Board”