The call I had been avoiding answering for not long enough:
WildBlue Rep: I’m calling to tell you about a new download we have for you. It’s the WildBlue optimizer.
Me: I’m going to save you some time here. The optimizer does not work under Linux, so it won’t work on my system.
WildBlue Rep: What’s Linux?
Me: It’s an operating system, like Windows. Except your optimizer does not work under it.
WildBlue Rep: What’s an operating system?
Me: *facepalm*
Last month I posted a way to create a blog page in OpenCart that uses a single category of an existing WordPress blog. Here is how to give that page its own RSS feed that links to that blog page you created in your store instead of to WordPress outside your store.
Create a new file and paste the following code in it.
<?php print '<?xml version="1.0" encoding="ISO-8859-1" ?>'; ?>
<rss version="2.0">
<?php
$link = mysql_connect('DB_HOST', 'DB_USERNAME', 'DB_PASSWORD') or die();
mysql_select_db('YOUR_DB') or die();
?>
<channel>
<title>YOUR_STORE_NAME</title>
<?php
$query = 'SELECT * FROM TABLEPREFIX_term_relationships, TABLEPREFIX_posts WHERE TABLEPREFIX_term_relationships.term_taxonomy_id = ## AND TABLEPREFIX_term_relationships.object_id = TABLEPREFIX_posts.ID ORDER BY TABLEPREFIX_posts.post_date DESC LIMIT 3';
$wppostsresult = mysql_query($query) or die();
while ($line = mysql_fetch_array($wppostsresult)) {
?>
<item>
<title><?php print $line['post_title']; ?></title>
<pubDate><?php print date('D, d M Y H:i:s', strtotime($line['post_date'])); ?></pubDate>
<author>YOUR_NAME</author>
<description><?php print $line['post_content']; ?></description>
<link>URL_OF_YOUR_BLOG_PAGE</link>
</item>
<?php
}
mysql_free_result($wppostsresult);
?>
</channel>
<?php
mysql_close($link);
?>
</rss>
In that code, replace the single instance of DB_HOST with your database host, DB_USERNAME with your database username, DB_PASSWORD with your database password, and YOUR_DB with your WordPress database. That code could be called from a separate file, but for simplicity here, it’s included in this one. Replace YOUR_STORE_NAME with the name of your store or blog.
Like in my previous post, replace the six instances of TABLEPREFIX with your WordPress database table prefix, and the one instance of ## with the desired category’s term_taxonomy_id (see previous step one). Change the limit (number of posts to retrieve) to something other than 3 if you wish. Replace the single instance of YOUR_NAME with your blog author (or this can be retrieved as a field from the database), and URL_OF_YOUR_BLOG_PAGE to the url of your store blog. Save the file as blogfeed.php, and upload it to your top store directory.
Paste the following code into your blog template’s common/header.tpl file, between the <head></head> tags.
<?php if($_SERVER['REQUEST_URI'] == '/YOURSUBDIRECTORY/blog'): ?>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="FULL_URL_TO/blogfeed.php" />
<?php endif; ?>
If your blog is in a subdirectory, replace YOURSUBDIRECTORY with it, or if it is in the top directory, delete the /YOURSUBDIRECTORY part. Note that this is not the full url. Replace FULL_URL_TO with the full url to your blogfeed.php file.
Now your customers should be able to subscribe to a blog feed that is exclusively for your store, while you can avoid having to install a separate blog program. You can see this solution live on my store’s blog.
Here is a quick way to get a single category of your WordPress blog posts onto your OpenCart page. I’ve done this using OpenCart 1.4.9.3 with SEO url’s enabled, the default theme, and WordPress 3.0.4. As always, back up your file before editing.
<?php
if($_SERVER['REQUEST_URI'] == '/blog'):
$query = 'SELECT * FROM TABLEPREFIX_term_relationships, TABLEPREFIX_posts WHERE TABLEPREFIX_term_relationships.term_taxonomy_id = ## AND TABLEPREFIX_term_relationships.object_id = TABLEPREFIX_posts.ID ORDER BY TABLEPREFIX_posts.post_date DESC LIMIT 3';
$wppostsresult = mysql_query($query) or die('Query failed: ' . mysql_error());
while ($line = mysql_fetch_array($wppostsresult)) {
print '<h2>'. $line['post_title'] . '</h2><div>'. $line['post_date'] .'</div><div>' . $line['post_content'] . '</div>';
}
mysql_free_result($wppostsresult);
endif;
?>
Now the posts in that category should appear in your WordPress blog (unless you disable this) as well as in your online shop blog.
Plain ol’ call and text cell phones are bad enough, but my worst fears about “smartphones” are true. Do these phones really enhance life enough to make giving away every stitch of privacy worth it? And just as it’s good to have endless data available for our perusal and convenience on the internet, there have to be times when we can disconnect completely from all the technology and live our private, practical lives.
Let’s say an unsavory character who worked at a hunting goods store broke into the store after hours with a buddy. And he stole a gun from a case and placed it on the counter for his buddy to take. And his buddy went out and shot someone with the gun. It’s obvious that the shooter should pay for his crime. But how about the manufacturer of the counter? After all, the counter displayed the gun along with numerous other items that could have been used for good or bad by anyone who came in. Or just maybe counters and guns are merely tools, though the real tool in this case is the one who started it all by stealing the gun from his employer and giving it away.
Julian Assange is the founder of WikiLeaks, which is a valuable resource for keeping governments transparent. WikiLeaks is the counter that displays what an information shopper might find useful. Bradley Manning is a tool, a traitor who stole sensitive military information from the country he was sworn to serve, and gave it away freely. Julian Assange isn’t the criminal here. That focus is misplaced. Far from being honored by Berkeley, Manning ought to reap the ultimate traitor’s rewards.
Studies on the chemistry of love seem to prove time and again what we already know through experience and common lore. After all, who experiences love without the rush it brings to mind, interconnected emotions, and body? There’s even science behind why each of us is drawn to a certain type.
The science of it is interesting, but in small doses. Best to take the larger doses of the sweet addiction itself.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Apr | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||