Skip to content

Commit

Permalink
Fix the display of blog posts
Browse files Browse the repository at this point in the history
  • Loading branch information
aquarion committed Apr 21, 2012
1 parent 921113e commit 880f71c
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions dayze/today.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

$tidy_config = array(
'indent' => true,
'output-xhtml' => true,
'output-html' => true,
'show-body-only' => true,
'wrap' => 200);
$tidy = new tidy;

Expand Down Expand Up @@ -149,6 +150,7 @@
$structure['things'] = array();

$music = array();
$musictotal = 0;

while ($row = mysql_fetch_assoc($results)){

Expand Down Expand Up @@ -178,6 +180,9 @@
} else {
$music[$artist] += 1;
}

$musictotal ++;

continue 2;
break;

Expand All @@ -188,7 +193,7 @@
case "twitter":
$class = "Twitter";
if ($row['originaltext'][0] == "@"){
continue 2;
//continue 2;
}
break;

Expand Down Expand Up @@ -237,7 +242,7 @@
}


$q = sprintf("select post_title, post_content, ID, unix_timestamp(post_date) as epoch from aqcom_wp_posts where post_status = 'publish' and post_date between '%s' and '%s' order by post_date", date(DATE_ISO8601, $from), date(DATE_ISO8601, $to));
$q = sprintf("select post_title, post_content, ID, unix_timestamp(post_date) as epoch, guid from aqcom_wp_posts where post_status = 'publish' and post_date between '%s' and '%s' order by post_date", date(DATE_ISO8601, $from), date(DATE_ISO8601, $to));


$results = mysql_query($q) or die(mysql_error());
Expand All @@ -246,13 +251,31 @@

$class = "Blog";

$blogpost = $row['post_content'];

$regex = "/\[caption .*?\](.*)\[\/caption\]/m";

preg_match($regex, $blogpost, $matches);

$blogpost = preg_replace($regex, '', $blogpost);

$continue = sprintf(' [<a href="%s">More...</a>]', $row['guid']);

if(count($matches)){
$image = $matches[1];
$content = sprintf("<h2>%s</h2> <div style=\"float: right\">%s</div> %s",$row['post_title'], $image, substr($blogpost, 0,500));
} else {
$content = sprintf("<h2>%s</h2> %s",$row['post_title'], substr($blogpost, 0,500));
}


#$row['content'] = $row['post_title'];
#$row['content'] = $row['post_title']." &mdash; ".substr($row['post_content'], 0,256).'[...]';
$tidy = new tidy;
$tidy->parseString($row['post_title']." &mdash; ".substr($row['post_content'], 0,256), $tidy_config, 'utf8');
$tidy = new tidy;
$tidy->parseString($content, $tidy_config, 'utf8');
$tidy->cleanRepair();
$row['content'] = $tidy;
$row['title'] = $row['post_title'];
$row['content'] = $tidy.$continue;
$row['title'] = sprintf("<h2>%s</h2>",$row['post_title']);
$row['url'] = "http://www.aquarionics.com/?p=".$row['ID'];
$row['source'] = "Aquarionics";
$row['icon'] = 'http://art.istic.net/iconography/aqcom/logo_64.png';
Expand Down

0 comments on commit 880f71c

Please sign in to comment.