Updates for Mackinac Bridge site. oldMackinacBridgeNews
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 12 Oct 2016 12:44:11 +0000 (08:44 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 12 Oct 2016 12:44:11 +0000 (08:44 -0400)
This database was really old. Made changes for field names and the one
and only table used.

index.php
tmp/wordPress.tpl

index 8a6730e..b58c73f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -20,30 +20,18 @@ if ( class_exists( Toolkit_Database ) ) {
 $sql = "
 SELECT *
   FROM news
- WHERE catid = 2
-ORDER BY pr_date";
-
+ORDER BY nldate";
 $stmt = $dbh->query($sql);
-$getBlocksSql = "
-  SELECT *
-    FROM news_block
-   WHERE news_id = :news_id
-ORDER BY pos";
-$getBlocks = $dbh->prepare($getBlocksSql);
 $data = array();
 while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
-    $prDate = strtotime($row['pr_date']);
-    $row['pubDate'] = date('r', $prDate);
-    $row['pr_date'] = date('Y-m-d H:i:s', $prDate);
-    $data[$row['id']] = $row;
-    $getBlocks->bindParam(':news_id', $row['id'], PDO::PARAM_INT);
-    $getBlocks->execute();
-    $data[$row['id']]['blocks'] = $getBlocks->fetchAll(PDO::FETCH_ASSOC);
+    $nldate              = $row['nldate'];
+    $row['pubDate']      = date('r', $nldate);
+    $row['nldate']       = date('Y-m-d H:i:s', $nldate);
+    $data[$row['artid']] = $row;
 }
-//echo '<pre>'.print_r($data, true).'</pre>';
-$smarty->assign('resized', 'http://www.gaylordgolfmecca.com/images/resized/');
-$smarty->assign('exportTitle', 'Gaylord Golf Mecca');
-$smarty->assign('siteUrl', 'blog.gaylordgolfmecca.com');
+$smarty->assign('resized', 'http://www.mackinacbridge.org/images/resized/');
+$smarty->assign('exportTitle', 'Mackinac Bridge News');
+$smarty->assign('siteUrl', 'www.mackinacbridge.org');
 $smarty->assign('data', $data);
 $smarty->display('wordPress.tpl');
 
index c9b5be7..d7670b9 100644 (file)
                <link>http://{$siteUrl}/{$row.ping_name}/</link>
                <pubDate>{$row.pubDate}</pubDate>
                <dc:creator><![CDATA[Steve]]></dc:creator>
-               <guid isPermaLink="false">http://{$siteUrl}/?p={$row.id}</guid>
+               <guid isPermaLink="false">http://{$siteUrl}/?p={$row.artid}</guid>
                <description></description>
-               <content:encoded><![CDATA[{if $row.header}<h3>{$row.header}</h3>{/if}<p>{if $row.image}<img src="{$resized}{$row.image}">{/if}{$row.description}</p>{foreach $row.blocks as $block}{if $block.header}<h3>{$block.header}</h3>{/if}<p>{if $row.image}<img src="{$resized}{$block.image}">{/if}{$block.description}</p>{/foreach}]]></content:encoded>
+               <content:encoded><![CDATA[{if $row.title}<h3>{$row.title}</h3>{/if}<p>{if $row.image}<img class="alignright size-medium wp-image-99{$row.artid}" src="{$resized}{$row.image}">{/if}{$row.body}</p>]]></content:encoded>
                <excerpt:encoded><![CDATA[]]></excerpt:encoded>
                <wp:post_id>{$row.id}</wp:post_id>
-               <wp:post_date>{$row.pr_date}</wp:post_date>
-               <wp:post_date_gmt>{$row.pr_date}</wp:post_date_gmt>
+               <wp:post_date>{$row.nldate}</wp:post_date>
+               <wp:post_date_gmt>{$row.nldate}</wp:post_date_gmt>
                <wp:comment_status>closed</wp:comment_status>
                <wp:ping_status>open</wp:ping_status>
                <wp:post_name>{$row.ping_name}</wp:post_name>