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 odpowiedzi
+ 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