Keyword

How to get tag name in tag itemlist?

  • Roman Lipatov
  • Roman Lipatov's Avatar Topic Author
  • Offline
  • Premium Member
More
8 years 5 months ago #153671 by Roman Lipatov
Replied by Roman Lipatov on topic How to get tag name in tag itemlist?
Why not? It looks same as with $tag = JRequest::getString('tag'); example...

How looks SQL query in this case?
Thanks.

Please Log in or Create an account to join the conversation.

  • Roman Lipatov
  • Roman Lipatov's Avatar Topic Author
  • Offline
  • Premium Member
More
8 years 5 months ago #153735 by Roman Lipatov
Replied by Roman Lipatov on topic How to get tag name in tag itemlist?
Can get it :(

I trying this code to get tag ID, but it does not work...
<?php
		$tag = JRequest::getString('tag'); 
		echo $tag;
		
		$dbc=&JFactory::getDBO();
		$sql="select id from k2_tags where name='".$tag."';";
		$dbc->setQuery($sql);
		echo $dbc;
?>

Please Log in or Create an account to join the conversation.

  • Roman Lipatov
  • Roman Lipatov's Avatar Topic Author
  • Offline
  • Premium Member
More
8 years 5 months ago #153736 by Roman Lipatov
Replied by Roman Lipatov on topic How to get tag name in tag itemlist?
OK, it seems I got it.
But I need your mind about this code.

I think it is too big to just get the ID value...
<?php
		$tag = JRequest::getString('tag'); 
		echo $tag;
		
		$db = JFactory::getDBO();
		$query = "SELECT * from #__k2_tags where name='".$tag."'";
		$db->setQuery($query);
		$result = $db->loadObjectList();
		foreach($result as $key=>$value){
		echo $value->id;
										}
?>

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 5 months ago #153791 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to get tag name in tag itemlist?
Hello Roman,

I will need some context, the query appears indeed correct.
Where did you paste it? In the top of the tag.php file or inside the loop?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Roman Lipatov
  • Roman Lipatov's Avatar Topic Author
  • Offline
  • Premium Member
More
8 years 5 months ago #153803 by Roman Lipatov
Replied by Roman Lipatov on topic How to get tag name in tag itemlist?
Hi Krikor,
I paste this code at the top.



My idea is to add new columns in k2_tags mysql table - description, meta description, meta title, icon.

So, I will be able to build tags pages, that will looks same as categories.



I think, that this feature should be a part of K2...



But right now I trying to make it with hack, and I not sure, that code above is correct, and it will not work slow (I'm not programmer).

Thanks.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum