-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to render template when using route with token #2
Comments
Hi @Sokhavuth. tokens don't look like an issue here. When you write: It looks like the issue is in https://github.com/Sokhavuth/tvp/blob/master/controllers/admin/posts/edit.php: $sql = "SELECT * FROM posts WHERE id=?";
$post = $f3->get('DB')->exec($sql, $id); The 2nd line gets you an array of rows matching $id. So you'd better write something like: $sql = "SELECT * FROM posts WHERE id=?";
$posts = $f3->get('DB')->exec($sql, $id);
if (!$posts) {
// no posts matching, do something, for example throw a 404:
$f3->error(404);
} else {
// everthing's ok, fetch first post and continue
$post = $posts[0];
} |
I have tried not to insert any data into the template in question. But nothing happens. The problem is static files such as css, js, and images are not loaded. I'm trying to build a blog exactly like I did with Express.js here: http://khmerweb-tv.herokuapp.com/ . In Express.js everything works really good. |
out of curiosity, just to rule out heroku, when you load your app with |
The route with token works really smooth. The problem is only the rendering of template with that route. |
I love f3 framework. It is similar to Express.js for Node.js. I have tried to build a blog engine with f3 framework as I use to do with Python and Node.js. Everything works fine. However, I am unable to render any template when using route with token (route with parameter in other frameworks). Here the link to the repository: https://github.com/Sokhavuth/tvp, and the link to the working blog on Heroku is here https://khmerweb-tvp.herokuapp.com/ . You could login with email "[email protected]" and password "password"; the link for login is https://khmerweb-tvp.herokuapp.com/login. On the admin page, click on the second icon on top, and try to click on edit icon of the post at the bottom, you will see the problem (do not click on delete icon, it will delete post).
The text was updated successfully, but these errors were encountered: