|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
MESSO9800 Smarty n00b
Joined: 20 Feb 2021 Posts: 2
|
Posted: Sat Feb 20, 2021 11:04 am Post subject: <?PHP TRANSALTE TO SMARTY |
|
|
Hi Guys, please help my to transalte that code to smarty:
<?php
$posts = $db->get('posts');
if (isset($_POST['like'])) {
$post_id = $_POST['like'];
$query = Array('like_count'=>$db->inc(1));
$db->where('id', $post_id);
$db->update('posts', $query);
$db->insert('likes', Array('post_id'=>$post_id));
}
foreach ($posts as $post) {
echo $post["post_text"] .' <button data-postid="'.$post['id'].'" data-likes="'.$post['like_count'].'" class="like">Like ('.$post['like_count'].')</button><hr />';
}
?> |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|