- Posts: 9
COMMUNITY FORUM
Extract tag id in tag view list
- theD “android3dgame” Waterfly
- Topic Author
- Offline
- New Member
Or help set up the sql query. Thank you.
Please Log in or Create an account to join the conversation.
- theD “android3dgame” Waterfly
- Topic Author
- Offline
- New Member
- Posts: 9
Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
- Posts: 8743
<?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
- Topic Author
- Offline
- New Member
- Posts: 9
Please Log in or Create an account to join the conversation.
- theD “android3dgame” Waterfly
- Topic Author
- Offline
- New Member
- Posts: 9
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
- Posts: 8743
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
- Topic Author
- Offline
- New Member
- Posts: 9
ok, but how to get the id of the tag in the tag.php?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.
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
- Posts: 8743
<?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
- Topic Author
- Offline
- New Member
- Posts: 9
Please Log in or Create an account to join the conversation.
- theD “android3dgame” Waterfly
- Topic Author
- Offline
- New Member
- Posts: 9
Tell me how this method to get two variables from a db. $tagId and $tagname?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(); ?>
Please Log in or Create an account to join the conversation.