hi,
is it now possible or easily integrated to search via the Tag itself not the id?
e.g.
instead of
http://yourdomain/index.php?action=tags;id=123do it like
http://yourdomain/index.php?action=tags;tag=NameOfTagAsText
with the same result-page.
so it would be easier to use it in posts as direct links. (sorry abou my english)
okay, I looked into the "Tags.php" and tried a little bit.
After
if (isset($_REQUEST['id']))
{
// Show the tag results for that tag
$id = (int) $_REQUEST['id'];
// Find Tag Name
$dbresult = db_query("SELECT tag FROM {$db_prefix}tags WHERE ID_TAG = $id LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
mysql_free_result($dbresult);
$context['tag_search'] = $row['tag'];
$context['page_title'] = $mbname . ' - ' . $txt['smftags_resultsfor'] . $context['tag_search'];
// Find Results
$dbresult = db_query("
SELECT t.numReplies,t.numViews,m.ID_MEMBER,m.posterName,m.subject,m.ID_TOPIC,m.posterTime, t.ID_BOARD
FROM {$db_prefix}tags_log as l, {$db_prefix}boards AS b, {$db_prefix}topics as t, {$db_prefix}messages as m
WHERE l.ID_TAG = $id AND b.ID_BOARD = t.ID_BOARD AND l.ID_TOPIC = t.ID_TOPIC AND t.ID_FIRST_MSG = m.ID_MSG AND " . $user_info['query_see_board'], __FILE__, __LINE__);
$context['tags_topics'] = array();
while ($row = mysql_fetch_assoc($dbresult))
{
$context['tags_topics'][] = array(
'ID_MEMBER' => $row['ID_MEMBER'],
'posterName' => $row['posterName'],
'subject' => $row['subject'],
'ID_TOPIC' => $row['ID_TOPIC'],
'posterTime' => $row['posterTime'],
'numViews' => $row['numViews'],
'numReplies' => $row['numReplies'],
);
}
mysql_free_result($dbresult);
$context['sub_template'] = 'results';
}
add
elseif (isset($_REQUEST['tag']))
{
// Show the tag results for that tag
$context['tag_search'] = $_REQUEST['tag'];
// Find Tag Name
$context['page_title'] = $mbname . ' - ' . $txt['smftags_resultsfor'] . $context['tag_search'];
// Find Results
$dbresult = db_query("
SELECT t.numReplies,t.numViews,m.ID_MEMBER,m.posterName,m.subject,m.ID_TOPIC,m.posterTime, t.ID_BOARD
FROM {$db_prefix}tags_log as l, {$db_prefix}boards AS b, {$db_prefix}topics as t, {$db_prefix}messages as m
JOIN {$db_prefix}tags AS TA ON (TA.ID_TAG = l.ID_TAG)
WHERE TA.tag = '" . $context['tag_search'] . "' AND b.ID_BOARD = t.ID_BOARD AND l.ID_TOPIC = t.ID_TOPIC AND t.ID_FIRST_MSG = m.ID_MSG AND " . $user_info['query_see_board'], __FILE__, __LINE__);
$context['tags_topics'] = array();
while ($row = mysql_fetch_assoc($dbresult))
{
$context['tags_topics'][] = array(
'ID_MEMBER' => $row['ID_MEMBER'],
'posterName' => $row['posterName'],
'subject' => $row['subject'],
'ID_TOPIC' => $row['ID_TOPIC'],
'posterTime' => $row['posterTime'],
'numViews' => $row['numViews'],
'numReplies' => $row['numReplies'],
);
}
mysql_free_result($dbresult);
$context['sub_template'] = 'results';
}
and you can use the tag function directly from a link:
http://yourdomain/index.php?action=tags;tag=OneTagText
but I´m no php programmer. nether than mysql.
=> so propably this is a security risk for sql injection!? how can I fix this?
=> does this make problems if wrong tags are used?
Thanks for help,
Patxi