Keyword

Extract tag id in tag view list

  • theD “android3dgame” Waterfly
  • theD “android3dgame” Waterfly's Avatar Topic Author
  • Offline
  • New Member
More
10 years 4 months ago #128161 by theD “android3dgame” Waterfly
Extract tag id in tag view list was created by theD “android3dgame” Waterfly
Hello. Tell me how to get the name or id of the tag in the output template tag.
Or help set up the sql query. Thank you.

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

  • theD “android3dgame” Waterfly
  • theD “android3dgame” Waterfly's Avatar Topic Author
  • Offline
  • New Member
More
10 years 4 months ago #128162 by theD “android3dgame” Waterfly
Replied by theD “android3dgame” Waterfly on topic Re: Extract tag id in tag view list
why doesn't this?
Log in  or Create an account to join the conversation.

More
10 years 4 months ago #128163 by Lefteris
Replied by Lefteris on topic Re: Extract tag id in tag view list
Hi. You can get the tag from the URL variable:
<?php echo JRequest::getVar('tag'); ?>

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

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

  • theD “android3dgame” Waterfly
  • theD “android3dgame” Waterfly's Avatar Topic Author
  • Offline
  • New Member
More
10 years 4 months ago #128164 by theD “android3dgame” Waterfly
Replied by theD “android3dgame” Waterfly on topic Re: Extract tag id in tag view list
Thank you very much. Your solution helped bring the tag name. Now how can I get the tag id?

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

  • theD “android3dgame” Waterfly
  • theD “android3dgame” Waterfly's Avatar Topic Author
  • Offline
  • New Member
More
10 years 4 months ago #128165 by theD “android3dgame” Waterfly
Replied by theD “android3dgame” Waterfly on topic Re: Extract tag id in tag view list
I created a column with the name of the image in the database _k2_tags how to get out of it is in the template tag.php

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

More
10 years 4 months ago #128166 by Lefteris
Replied by Lefteris on topic Re: Extract tag id in tag view list
I don't get the your last message. What you want to do. You should not alter the K2 database tables on your own as this might break your site.

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

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

  • theD “android3dgame” Waterfly
  • theD “android3dgame” Waterfly's Avatar Topic Author
  • Offline
  • New Member
More
10 years 4 months ago - 10 years 4 months ago #128167 by theD “android3dgame” Waterfly
Replied by theD “android3dgame” Waterfly on topic Re: Extract tag id in tag view list

Lefteris Kavadas wrote: I don't get the your last message. What you want to do. You should not alter the K2 database tables on your own as this might break your site.

ok, but how to get the id of the tag in the tag.php?

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

More
10 years 4 months ago #128168 by Lefteris
Replied by Lefteris on topic Re: Extract tag id in tag view list
Unfortunately it is not available in the view. You will have to query the database:
<?php
$db = JFactory::getDBO();
$tag = JRequest::getString('tag');
$sql = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($tag);
$db->setQuery($sql, 0, 1);
$tagId = $db->loadResult();
?>

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

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

  • theD “android3dgame” Waterfly
  • theD “android3dgame” Waterfly's Avatar Topic Author
  • Offline
  • New Member
More
10 years 4 months ago #128169 by theD “android3dgame” Waterfly
Replied by theD “android3dgame” Waterfly on topic Re: Extract tag id in tag view list
Thank you very much!

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

  • theD “android3dgame” Waterfly
  • theD “android3dgame” Waterfly's Avatar Topic Author
  • Offline
  • New Member
More
10 years 4 months ago #128170 by theD “android3dgame” Waterfly
Replied by theD “android3dgame” Waterfly on topic Re: Extract tag id in tag view list

Lefteris Kavadas wrote: Unfortunately it is not available in the view. You will have to query the database:

<?php
$db = JFactory::getDBO();
$tag = JRequest::getString('tag');
$sql = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($tag);
$db->setQuery($sql, 0, 1);
$tagId = $db->loadResult();
?>

Tell me how this method to get two variables from a db. $tagId and $tagname?

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