Using Hashtags
There should be a way to link hashtags with posts/tweets, a post_id row on trends table to enhace the function search by hashtag, kind of mydomain.com?home.php?hashtag=whatever to get tweets with "whatever" hashtag on it from any user, not just the one I follow.
I found hard to load the files with the images linked as they come on the package. That's annoying.
Some CSS bugs.
Otherwise very flexible and simple.
SCREENSHOT: https://imgur.com/a/Y09xLr9
1- IMPLEMENTED SEARCH BY HASHTAG
core/classes/User.php
/* public static function search($search){ $stmt = self::connect()->prepare("SELECTid,username,name,img,imgCoverFROMusersWHEREusernameLIKE ? ORname` LIKE ?");
$stmt->bindValue(1, $search.'%', PDO::PARAM_STR);
$stmt->bindValue(2, $search.'%', PDO::PARAM_STR);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_OBJ);
} */
public static function search($search){
$stmt = self::connect()->prepare("SELECT * FROM `tweets`
WHERE `status` LIKE ?");
$stmt->bindValue(1, '%#'.$search.'%', PDO::PARAM_STR);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_OBJ);
} `
2- CHANGE LINE 6 ON assets/js/search.js TO $.post('core/ajax/search-hashtags.php', {search:search}, function(data){
3- CREATE THAT FILE WITH THIS CONTENT:
`include '../init.php';
if (isset($_POST['search'])) { $search = User::checkInput($_POST['search']);
$result = User::search($search);
if(!empty($result)) {
echo ' <div class="nav-right-down-wrap">
<ul> ';
foreach ($result as $locations) {
echo ' <li >
<div class="nav-right-down-inner">
<div class="nav-right-down-right">
<div class="nav-right-down-right-headline">
<a class="" href="'.BASE_URL.'status/'.$locations->post_id.'">'. $locations->status.'</a>
<span class="d-block">@'. $locations->status.'</span>
</div>
</div>
</div>
</li> ';
}
echo ' </ul>
</div> ';
} }`
Thank you so much @australopythecu , I will add this when I have free time!