diff options
author | Andrew Dolgov <[email protected]> | 2023-04-06 15:51:09 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-04-06 15:51:09 +0300 |
commit | af5c64045b436357006500afb448b266d927e65a (patch) | |
tree | 71a8d41771fda4566cc33994140bafcb6765689b /classes/article.php | |
parent | 0fcc7150693f88f01d09ee14ddf3c7f8c844eaae (diff) |
add simple autocompleter for tags
Diffstat (limited to 'classes/article.php')
-rwxr-xr-x | classes/article.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/classes/article.php b/classes/article.php index 609ddeebe..5bddf3bdb 100755 --- a/classes/article.php +++ b/classes/article.php @@ -239,8 +239,7 @@ class Article extends Handler_Protected { print json_encode(["id" => (int)$id, "tags" => $this->_get_tags($id)]); } - - /*function completeTags() { + function completeTags() { $search = clean($_REQUEST["search"]); $sth = $this->pdo->prepare("SELECT DISTINCT tag_name FROM ttrss_tags @@ -250,12 +249,14 @@ class Article extends Handler_Protected { $sth->execute([$_SESSION['uid'], "$search%"]); - print "<ul>"; + $results = []; + while ($line = $sth->fetch()) { - print "<li>" . $line["tag_name"] . "</li>"; + array_push($results, $line["tag_name"]); } - print "</ul>"; - }*/ + + print json_encode($results); + } function assigntolabel(): void { $this->_label_ops(true); |