- Posts: 10
COMMUNITY FORUM
K2 Categories URL (SH404SEF)
- Puneet
- 
				Topic Author 
- Offline
- New Member
		Less
		More
		
			
	
		
			
	
						15 years 1 month ago				#88891
		by Puneet
	
	
		
			
	
			
			 		
													
	
				K2 Categories URL (SH404SEF) was created by Puneet			
			
				Hi,K2 team did a great job and provide additional flexibility for urls generation in v2.4I want to show only last category in category urls like mysite.com/k2 instead of mysite.com/content-construction/k2Is there any way to do this?Thank You.			
					Please Log in or Create an account to join the conversation.
- Emmanouil
- 
				
- Offline
- Senior Member
		Less
		More
		
			
	
		- Posts: 58
			
	
						15 years 1 month ago				#88892
		by Emmanouil
	
	
		
			
	
			
			 		
													
	
				Replied by Emmanouil on topic K2 Categories URL (SH404SEF)			
			
				I want this too please :)
And also remove the "blog" prefix for authors page.I removed it from xml and from K2 configuration backend but its still there...
					And also remove the "blog" prefix for authors page.I removed it from xml and from K2 configuration backend but its still there...
Please Log in or Create an account to join the conversation.
- parezar
- 
				
- Offline
- New Member
		Less
		More
		
			
	
		- Posts: 2
			
	
						15 years 1 month ago				#88893
		by parezar
	
	
		
			
	
			
			 		
													
	
				Replied by parezar on topic K2 Categories URL (SH404SEF)			
			
				file : 404sef/sef_ext/com_k2.php
string 41 - Can be $query = "SELECT * FROM #__k2_categories WHERE id=".$catid." AND published=1 AND trash=0 AND access<=".$aid;
............._categories WHERE id=".$catid." AND published=0 ?
					string 41 - Can be $query = "SELECT * FROM #__k2_categories WHERE id=".$catid." AND published=1 AND trash=0 AND access<=".$aid;
............._categories WHERE id=".$catid." AND published=0 ?
Please Log in or Create an account to join the conversation.
- Puneet
- 
				Topic Author 
- Offline
- New Member
		Less
		More
		
			
	
		- Posts: 10
			
	
						15 years 1 month ago				#88894
		by Puneet
	
	
		
			
	
			
			 		
													
	
				Replied by Puneet on topic K2 Categories URL (SH404SEF)			
			
				@Roman
There is no com_k2.php file in the location you mentioned
					There is no com_k2.php file in the location you mentioned
Please Log in or Create an account to join the conversation.
- Emmanouil
- 
				
- Offline
- Senior Member
		Less
		More
		
			
	
		- Posts: 58
			
	
						15 years 4 weeks ago				#88895
		by Emmanouil
	
	
		
			
	
			
			 		
													
	
				Replied by Emmanouil on topic K2 Categories URL (SH404SEF)			
			
				I solved this :)
To remove blog from authors prefix :
File:components/com_k2/sef_ext/com_k2.php
Line:77
Should be: $authorPrefix = $params->get('sh404SefLabelUser');
To show only last category:
File:components/com_k2/sef_ext/com_k2.php
Line:39
Should be: getCategoryPath($row->child, true);
It works for me this way.
					To remove blog from authors prefix :
File:components/com_k2/sef_ext/com_k2.php
Line:77
Should be: $authorPrefix = $params->get('sh404SefLabelUser');
To show only last category:
File:components/com_k2/sef_ext/com_k2.php
Line:39
Should be: getCategoryPath($row->child, true);
It works for me this way.
Please Log in or Create an account to join the conversation.
- B_Dark
- 
				
- Offline
- Premium Member
		Less
		More
		
			
	
		- Posts: 126
			
	
						14 years 5 months ago				#88896
		by B_Dark
	
	
		
			
	
			
			 		
													
	
				Replied by B_Dark on topic K2 Categories URL (SH404SEF)			
			
				and if you wont to show only the item alias and no the categories? like mysite.com/category-1/my-item-1 to mysite.com/my-item-01any solution?!?!			
					Please Log in or Create an account to join the conversation.
- BBC
- 
				
- Offline
- Platinum Member
		Less
		More
		
			
	
		- Posts: 663
- B_Dark
- 
				
- Offline
- Premium Member
		Less
		More
		
			
	
		- Posts: 126
			
	
						14 years 5 months ago				#88898
		by B_Dark
	
	
		
			
	
			
			 		
													
	
				Replied by B_Dark on topic K2 Categories URL (SH404SEF)			
			
					Please Log in or Create an account to join the conversation.
- Odin Mayland
- 
				
- Offline
- Platinum Member
		Less
		More
		
			
	
		- Posts: 404
			
	
						11 years 5 months ago				#88899
		by Odin Mayland
	
	
		
			
	
			
			 		
													
	
				Replied by Odin Mayland on topic Re: K2 Categories URL (SH404SEF)			
			
				3 years later in v 2.6.8 I would also like to only show the last category in the url.
The sef_ext/com_k2.php no longer has the code that I can edit per this topic.
Does anyone have a solution to only show domain.com/lastcategory instead of domain.com/parentcat/childcat/lastcategory
					The sef_ext/com_k2.php no longer has the code that I can edit per this topic.
Does anyone have a solution to only show domain.com/lastcategory instead of domain.com/parentcat/childcat/lastcategory
Please Log in or Create an account to join the conversation.
- Lefteris
- 
				
- Offline
- Platinum Member
		Less
		More
		
			
	
		- Posts: 8743
			
	
						11 years 5 months ago				#88900
		by Lefteris
	
	
		
			
	
			
			 		
													
	
				Replied by Lefteris on topic Re: K2 Categories URL (SH404SEF)			
			
				@modernmagic
Hi. Are you talking about category links or item links. The code that generates the category links can be found in line 196 of file sef_ext/com_k2.php.
					Hi. Are you talking about category links or item links. The code that generates the category links can be found in line 196 of file sef_ext/com_k2.php.
Please Log in or Create an account to join the conversation.
- Odin Mayland
- 
				
- Offline
- Platinum Member
		Less
		More
		
			
	
		- Posts: 404
			
	
						11 years 5 months ago		 -  11 years 5 months ago		#88901
		by Odin Mayland
	
	
		
			
		
				
		
	
	
		
	
	
	
	
		
			
					
	
	
	
	
	
	
	
			
						
	
		
	
                    
                
				Replied by Odin Mayland on topic Re: K2 Categories URL (SH404SEF)			
			
				@Lefteris
Category Links. (I have set the item links in the parameters/advanced to be only the last category)
What do I change on line 196?
	
	Category Links. (I have set the item links in the parameters/advanced to be only the last category)
What do I change on line 196?
Log in  or Create an account to join the conversation.
	
		
			 		
													- Lefteris
- 
				
- Offline
- Platinum Member
		Less
		More
		
			
	
		- Posts: 8743
			
	
						11 years 5 months ago				#88902
		by Lefteris
	
	
		
			
	
			
			 		
													
	
				Replied by Lefteris on topic Re: K2 Categories URL (SH404SEF)			
			
				Good news: You can apply the following code:
Replace:with:
Bad news : there is no override path as far as i remember. So you will have to hack the core file. Before doing so ask the developers of SH404SEF if there is a path for overrides, just in case.
					Replace:
foreach ($fullPath as $path)
				{
					$title[] = $path;
				}$title[] = array_pop($fullPath);Bad news : there is no override path as far as i remember. So you will have to hack the core file. Before doing so ask the developers of SH404SEF if there is a path for overrides, just in case.
Please Log in or Create an account to join the conversation.