From a251f5485d372b369896bb5476151675b2f45bc7 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 10 Mar 2015 14:28:30 -0400 Subject: [PATCH] Export Press Releases to wordpress xml export file --- .gitignore | 1 + index.php | 42 +++++++++++++++++++++++++++ tmp/wordPress.tpl | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 .gitignore create mode 100644 index.php create mode 100644 tmp/wordPress.tpl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4015fd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tmp_c diff --git a/index.php b/index.php new file mode 100644 index 0000000..a1ecb80 --- /dev/null +++ b/index.php @@ -0,0 +1,42 @@ +setTemplateDir('./tmp/'); +$smarty->setCompileDir('./tmp_c/'); +$smarty->setConfigDir('./configs/'); +$smarty->setCacheDir('./cache/'); + +$dbh = Toolkit_Database::getInstance(); + +$sql = " +SELECT * + FROM news + WHERE catid = 2 +ORDER BY pr_date"; + +$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); +} +//echo '
'.print_r($data, true).'
'; +$smarty->assign('resized', 'http://www.gaylordgolfmecca.com/images/resized/'); +$smarty->assign('exportTitle', 'Gaylord Golf Mecca'); +$smarty->assign('siteUrl', 'blog.gaylordgolfmecca.com'); +$smarty->assign('data', $data); +$smarty->display('wordPress.tpl'); + diff --git a/tmp/wordPress.tpl b/tmp/wordPress.tpl new file mode 100644 index 0000000..c9b5be7 --- /dev/null +++ b/tmp/wordPress.tpl @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + {$exportTitle} + http://{$siteUrl} + Just another Gaslight Media Sites site + {$pubDate} + en-US + 1.2 + http://{$siteUrl} + http://{$siteUrl} + + 1Stevesteve@gaslightmedia.com + + + http://wordpress.org/?v=4.1.1 + {foreach $data as $row} + + {$row.title} + http://{$siteUrl}/{$row.ping_name}/ + {$row.pubDate} + + http://{$siteUrl}/?p={$row.id} + + {$row.header}{/if}

{if $row.image}{/if}{$row.description}

{foreach $row.blocks as $block}{if $block.header}

{$block.header}

{/if}

{if $row.image}{/if}{$block.description}

{/foreach}]]>
+ + {$row.id} + {$row.pr_date} + {$row.pr_date} + closed + open + {$row.ping_name} + publish + 0 + 0 + post + + 0 + + + _edit_last + + +
+ {/foreach} +
+
-- 2.17.1