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
|
* 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){
|
$date_posted, $tags){
|
||||||
|
if(is_null($blogpost_addr)) {
|
||||||
printf("
|
printf("
|
||||||
<div class=\"blog-preview\">
|
<div class=\"blog-preview\">
|
||||||
<a href=\"http://www.zdenekborovec-dev.cz/blog/article?blogpost_id=%s\">
|
<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>
|
</h3>
|
||||||
</a>
|
</a>
|
||||||
", $blogpost_id, $title);
|
", $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%;\">
|
print_r("<table class=\"noborder-table\" style=\"width: 100%;\">
|
||||||
<tr><td class=\"blog-tags\">");
|
<tr><td class=\"blog-tags\">");
|
||||||
|
@ -53,8 +65,8 @@ function display_blog_previews($conn){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare statement for selecting all the blogposts
|
// Prepare statement for selecting all the blogposts
|
||||||
$stmt = $conn->prepare("SELECT blogpost_id, title, abstract, date_posted
|
$stmt = $conn->prepare("SELECT blogpost_id, readable_address, title,
|
||||||
FROM blogposts ORDER BY date_posted DESC;");
|
abstract, date_posted FROM blogposts ORDER BY date_posted DESC;");
|
||||||
|
|
||||||
// Execute the statement
|
// Execute the statement
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
@ -81,8 +93,9 @@ function display_blog_previews($conn){
|
||||||
$tags_arr = $stmt->fetchall(PDO::FETCH_ASSOC);
|
$tags_arr = $stmt->fetchall(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// Display the blog
|
// Display the blog
|
||||||
display_blog_preview($blog["blogpost_id"], $blog["title"],
|
display_blog_preview($blog["blogpost_id"], $blog["readable_address"],
|
||||||
$blog["abstract"], $blog["date_posted"], $tags_arr);
|
$blog["title"], $blog["abstract"], $blog["date_posted"],
|
||||||
|
$tags_arr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue