Nov 30, 2005

Cold Weather Yummies

Cold Weather Yummies

With the temperatures dropping, it’s a good time to curl up with a book and a snack of ice cream bread and homemade hot choclate.

Nov 29, 2005

Just Around the Corner

Just Around the Corner

At last night’s Wender Club, we walked in and saw that Christmas is right around the corner.

Nov 28, 2005

Embedding WordPress into OS Commerce

I’ve created the following tutorial in response to topic 47148: osCommerce and WordPress at WordPress Support.

While I have been programming PHP for a while, I am new to both OS Commerce and WordPress. That being said, for this integration I have tried to follow the coding standards for creating a new OS Commerce page. If you see any refinements I need to make to my code, feel free to comment. I hope this helps all of you who are looking to integrate OS Commerce and WordPress.

10/06/2006 – UPDATE: In response to comments below, I’ve written a Part II to this tutorial showing how to embed WordPress into a default install of OSC MS2.2.

PLEASE NOTE: The code in this tutorial assumes that your OS Commerce install is located in your server’s web root and your WordPress install is located in a subdirectory named wordpress/.

ALSO NOTE: This tutorial is written for OS Commerce installs using the Basic Template Structure (BTS). For OSC installs using the Simple Template Structure (STS), please see comment number 9 below:

  1. Create a file for your WordPress blog in the root folder of your OS Commerce install. For our purposes, we’ll name this file blog.php. The contents of this file are as follows:
    <?php
    /*
    Title: Embedding WordPress into OS Commerce
    Author: Michael Wender (www.michaelwender.com)
    Disclaimer: This Software is provided "AS IS" and without warranty of any kind. The user assumes all risks associated with its use and installation.
    $Id: blog.php,v 1.1.1.1 2004/03/04 23:38:02 ccwjr Exp $
    
    osCommerce, Open Source E-Commerce Solutions
    
    http://www.oscommerce.com
    
    Copyright (c) 2003 osCommerce
    Released under the GNU General Public License
    */
    
    // turn off WordPress themes and include the WordPress</b> core:
    define('WP_USE_THEMES', false);
    require('./wordpress/wp-blog-header.php');
    
    require('includes/application_top.php');
    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_BLOG);
    $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_BLOG));
    $content = CONTENT_BLOG;
    require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_BLOG_PAGE);
    require(DIR_WS_INCLUDES . 'application_bottom.php');
    ?>
    
  2. Open the file oscommerce_root/includes/filenames.php.
    • Find the section that begins with the comment // define the content used in the project, and add the following code:
    • define('CONTENT_BLOG', 'blog');
    • Find the section that begins with // define the filenames used in the project, and add the following:
    • define('FILENAME_BLOG', CONTENT_BLOG . '.php');
    • Find the section that begins with // define the templatenames used in the project, and add the following:
    • define('TEMPLATENAME_BLOG_PAGE', 'blog_page.tpl.php');
  3. Create the following file: oscommerce_root/templates/your_template_dir/blog_page.tpl.php (Note: This file’s filename matches the variable you defined as TEMPLATENAME_BLOG_PAGE in filenames.php).

    The contents of this file will vary according to which template you are using (to start, I suggest making a copy of your main_page.tpl.php); however, the body content on this page will be your WordPress blog. You will display your blog using The WordPress Loop. The following file is only meant to show you how to get started. Your blog_page.tpl.php will vary according to the template you are using in OS Commerce:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS; ?>>
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=<?php echo CHARSET; ?>">
    <?php
    if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
      require(DIR_WS_INCLUDES . 'header_tags.php');
    } else {
    ?>
      <title><?php echo TITLE ?></title>
    <?php
    }
    ?>
    <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
    <link rel="stylesheet" type="text/css" href="<? echo TEMPLATE_STYLE;?>">
    </head>
    <body onload="preloadImages();" style="background-color: #8E8B8B;">
    <!-- warnings //-->
    <?php require(DIR_WS_INCLUDES . 'warnings.php'); ?>
    <!-- warning_eof //-->
    
    <!-- header //-->
    <?php require(DIR_WS_TEMPLATES . TEMPLATE_NAME .'/header.php'); ?>
    <!-- header_eof //-->
    <?php
    	// INSERT YOUR WordPress Loop Code HERE:
    	if (have_posts()) :
    	   while (have_posts()) :
    		  the_post();
    		  the_content();
    	   endwhile;
    	endif;
    	// END WordPress Loop Code
    ?>
    <!-- footer //-->
    <?php require(DIR_WS_TEMPLATES . TEMPLATE_NAME .'/footer.php'); ?>
    <!-- footer_eof //-->
    </body>
    </html>
    

    A discussion of The WordPress Loop is beyond the scope of this tutorial; however, here are some excellent resources:

  4. Create the following file: oscommerce_root/includes/languages/your_language/blog.php (Note: This file must be named the same as the file you created in step 1). The contents of this file are as follows:
    <?php
    /*
    Title: Embedding WordPress into OS Commerce
    Author: Michael Wender (www.michaelwender.com)
    Disclaimer: This Software is provided "AS IS" and without warranty of any kind. The user assumes all risks associated with its use and installation.
    
    $Id: blog.php,v 1.2 2004/03/05 00:36:42 ccwjr Exp $
    
    osCommerce, Open Source E-Commerce Solutions
    
    http://www.oscommerce.com
    
    Copyright (c) 2003 osCommerce
    
    Released under the GNU General Public License
    */
    
    define('NAVBAR_TITLE', STORE_NAME. ' Blog');
    define('HEADING_TITLE', 'Blog');
    ?>
    
  5. Okay, your WordPress blog should now be embedded into your OS Commerce install. Keep in mind that you will need to adjust your menus and links to point to this new page you have created. If your OS Commerce install is located in your site’s web root, and you have used the same filenames suggested in this tutorial, then the link to your blog will be: http://your-domain.com/blog.php.

Nov 28, 2005

Grayson and Drew

Here’s a couple of shots of Grayson and Drew at yesterday’s Brown Family Thanksgiving Celebration.

Nov 27, 2005

Grocery Shopping

Grocery Shopping

Last night, Beth and I had fun by going grocery shopping at our new Food City.

Nov 26, 2005

Friday Night Fun

Friday Night Fun

Last night, Beth and I joined Dee and Tyler for a UT Men’s Basketball game.

Nov 25, 2005

Happy Thanksgiving!

Selected shots from yesterday: 1. Watching the Macy’s ThksGiving Day Parade. 2. Wender ThksGiving Collage. 3. Let’s eat! 4. Evening fun at the Shinn’s.

Nov 24, 2005

Recreate the Date

Last night, Beth and I continued our time-honored tradition of recreating our first date: 1. Dinner at Litton’s. 2. Nerts at the UT library.

Nov 23, 2005

Bote Mountain Hike

Author’s note: I began this entry on Saturday, November 12, 2005; however, I didn’t get the chance to finish it until Wednesday, November 23, 2005.

David, Bryan, Ryan, and I pause for a picture at Spence Field.Yesterday, around 7am, as my wife was leaving for work, David and Bryan were parking their cars on the street. On Monday, Bryan had sent out an email about hiking on Friday. Visions of crunching through fallen leaves and feeling the crisp fall air on my face interposed themselves on the rest of my work week.

In my office, David and Bryan pulled up the weather forecast while I put on a couple more layers. We checked my voice mail: Rusty had called a little before six o’clock. He said his knee was feeling a little tender this morning, so he wouldn’t be able to make it. Ryan’s message from 7:10, said he was on his way to meet us. We called Matt. No answer.

By 7:30, we had our backpacks in Bryan’s trunk, and we were on our way. The roads were filled with parents driving their kids to school and business men and women trying to get to work by eight o’clock. Our conversation ranged from such topics as D-Day and World War II to ethics to decision making and God’s will. We were only dimly aware of the Great Smoky Mountains growing gradually in the front windshield.

It was no time before we were helping Bryan navigate the final set of turns before reaching our destination. Once we were in the park, we passed only one or two cars. At the School House Gap Trailhead, we had our pick of parking spaces. Bryan popped the trunk, and we stepped around some horse droppings while we pulled out our packs.

To get to the trailhead, we had to walk back down the main road for 250 yards. The trailhead sign read Bote Mountain Trail with an arrow indicating the Appalachian Trail was 7.2 miles away. However, this morning, I find that my guide book, Hiking Trails of the Smokies, lists the distance as 6.9 miles with the following disclaimer:

Be forewarned that the mileages used in this book often do not match mileages on park trail signs or on some maps. This book uses mileages recently obtained from a thorough measurement of all park trails. It is much more accurate than any other source for trail distances.

We started out along the trail under the cover of hardword with rhododendron all around. It wasn’t long before I took off my rain jacket. We broke out onto the ridgeline. The morning sun greeted us and revealed the mountains drapped in red, yellow, crimson, and gold. Ryan and I were magnetically drawn to our cameras.

The view from along Bote Mountain Trail.

After our short photo session followed by a snack, we continued. Regardless of whether the trail is 7.2 or 6.9 miles, it required a good effort from each of us. The last couple of miles felt like I was trying to go up the “down” escalator. Along the way we passed only one couple coming down, and we wondered what time they had started.

Finally, a little after noon, we reached Spence Field. We had to hunt for a nice spot to collapse as there were day hikers and campers up from other trails. Up over a crest and around a rhododendron we found our resting place. Few words were spoken while we ate our lunches. For the unintiated, I must tell you that the taste of peanut butter and jelly after 6.9 miles in the mountains is a gourmet meal. After lunch, I changed into a dry shirt and fleece I had taken off earlier, and I added my rain coat. Pulling my hood over my head, I laid back and drifted off.

Our resting place at Spence Field.

A short while later I awoke to the quiet stillness of the mountains. I stretched my hands above my head and stared into the blue sky. Everyone else was stirring as well. It wasn’t long before we were ambling our way back down the mountain. This time we passed riders on horseback and others making their way up from Cades Cove. By the end of the hike our feet we tired, but our spirits were well rested.

Nov 23, 2005

Dinner. Quick!

Dinner. Quick!

Coming from the school of cooking my spaghetti sauce for 6 hours or more, it took my wife some time to win me over to her 30 minute recipe. However, I’ve been pleasantly surprised by the results.