Blog list prefers address over guid
This commit is contained in:
parent
08c2c31644
commit
47de0245d8
1 changed files with 18 additions and 5 deletions
|
@ -6,8 +6,9 @@ include_once($COMMONS."/header.php");
|
|||
/**
|
||||
* Display a blog-preview div
|
||||
*/
|
||||
function display_blog_preview($blogpost_id, $title, $abstract,
|
||||
function display_blog_preview($blogpost_id, $blogpost_addr, $title, $abstract,
|
||||
$date_posted, $tags){
|
||||
if(is_null($blogpost_addr)) {
|
||||
printf("
|
||||
<div class=\"blog-preview\">
|
||||
<a href=\"http://www.zdenekborovec-dev.cz/blog/article?blogpost_id=%s\">
|
||||
|
@ -16,6 +17,17 @@ function display_blog_preview($blogpost_id, $title, $abstract,
|
|||
</h3>
|
||||
</a>
|
||||
", $blogpost_id, $title);
|
||||
}
|
||||
else {
|
||||
printf("
|
||||
<div class=\"blog-preview\">
|
||||
<a href=\"http://www.zdenekborovec-dev.cz/blog/article?address=%s\">
|
||||
<h3>
|
||||
%s
|
||||
</h3>
|
||||
</a>
|
||||
", $blogpost_addr, $title);
|
||||
}
|
||||
|
||||
print_r("<table class=\"noborder-table\" style=\"width: 100%;\">
|
||||
<tr><td class=\"blog-tags\">");
|
||||
|
@ -53,8 +65,8 @@ function display_blog_previews($conn){
|
|||
}
|
||||
|
||||
// Prepare statement for selecting all the blogposts
|
||||
$stmt = $conn->prepare("SELECT blogpost_id, title, abstract, date_posted
|
||||
FROM blogposts ORDER BY date_posted DESC;");
|
||||
$stmt = $conn->prepare("SELECT blogpost_id, readable_address, title,
|
||||
abstract, date_posted FROM blogposts ORDER BY date_posted DESC;");
|
||||
|
||||
// Execute the statement
|
||||
$stmt->execute();
|
||||
|
@ -81,8 +93,9 @@ function display_blog_previews($conn){
|
|||
$tags_arr = $stmt->fetchall(PDO::FETCH_ASSOC);
|
||||
|
||||
// Display the blog
|
||||
display_blog_preview($blog["blogpost_id"], $blog["title"],
|
||||
$blog["abstract"], $blog["date_posted"], $tags_arr);
|
||||
display_blog_preview($blog["blogpost_id"], $blog["readable_address"],
|
||||
$blog["title"], $blog["abstract"], $blog["date_posted"],
|
||||
$tags_arr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue