0
How to make a blog template? (HELP IS NEEDED)
I am at the blog stage in my website and I have made a layout for an individual blog post (eg. TItle, article, author name) and I have also made the "preview" layout (eg. a image related to the blog and a small description of blog). I want people to be able to click on the preview and have it open straight to the real blog. How do I do this? I also dont want to make a new HTML file for every blog layout I have to make because I will write alot of blogs, what can I do for this? Much help is needed!! Thanks in advance.
8 Answers
+ 4
Itâs a big task to explain but.
Store your articles in mysql and query them with id parameter
blog.php?id=1
+ 3
Yes php. Make one page for you blogs.
+ 3
No it does not. look up sql course too.
It could be something like this.
Links for your blogs
$q = $db->query(âSELECT * FROM articlesâ);
foreach($q as $row) {
$id = $row[âidâ];
$title = $row[âtitleâ];
echo â<a href=âblog.php?id=â . $id . ââ>$title</a>â;
}
blog.php?id=1
$id = $_GET[âidâ];
$pre = $db->prepare(âSELECT * FROM articles WHERE id=:idâ)(
$pre->bindParam(â:idâ, $id);
$pre->execute();
$row = $pre->fetch();
echo $row[âtitleâ];
echo $row[âarticleâ];
echo $row[âauthorâ];
+ 1
Please link to your code here so we can see it. Cheers.
+ 1
so i would use PHP?
+ 1
okay thanks! im learning php, just started today but im already half way through! does the course say anything about what your talking about?
+ 1
Okay ill keep this in mind! Thanks Toni!
0
Its nothing to do with my website, its how do i make a template that stays permanent without having to make a new file everytimd, and how do i make a preview layout that immediatley links to the main blog