Results 1 to 10 of 12

Hybrid View

  1. #1
    Join Date
    Jun 2011
    Location
    Colorado, USA
    Posts
    46
    Plugin Contributions
    0

    help question wordpress template html_header.php blocking modules/pages/index?

    I found a template to incorporate my WordPress template around my zen-cart store. There have been some glitches which I am massaging out. The latest one is that the html_header.php (in the MY_TEMPLATE/common folder) seems to be blocking code loading from modules/pages/index. I am trying to install the slider from Kerrin Hardy's tutorial.

    If I delete the html_header.php from the template the slider code from the index folder loads in the header. But with the custom html_header.php it doesn't.

    Any suggestions as to why html_header.php might be circumventing the pages code from loading would be appreciated.

    PHP Code:
    <?php
    /**
     * Common Template
     *
     * outputs the html header. i,e, everything that comes before the \</head\> tag <br />
     * 
     * @package templateSystem
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: html_header.php 6948 2007-09-02 23:30:49Z drbyte $
     */
     
    /**
     * load the module for generating page meta-tags
     */
    require(DIR_WS_MODULES zen_get_module_directory('meta_tags.php'));

    // turn off WordPress themes and include the WordPress core:
    define('WP_USE_THEMES'false);
    define('IN_ZENCART'true);
    require(
    '../wp-blog-header.php');
    $template = new template_func(DIR_WS_TEMPLATE);

    function 
    zen_head(){
        global 
    $template$current_page_base;
        echo 
    '<!-- BEGIN ZenCart Additions -->' "\n";
        
    // load all template-specific stylesheets, named like "style*.css", alphabetically
        
    $directory_array $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css'), '/^style/''.css');
        while(list (
    $key$value) = each($directory_array)){
            echo 
    '<link rel="stylesheet" type="text/css" href="' $template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css') . '/' $value '" />'."\n";
        }
        
    // load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
        
    $manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
        
    $tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
        
    $tmp_pagename = ($this_is_home_page) ? 'index_home' $current_page_base;
        
    $sheets_array = array('/' $_SESSION['language'] . '_stylesheet'
                            
    '/' $tmp_pagename
                            
    '/' $_SESSION['language'] . '_' $tmp_pagename
                            
    '/c_' $cPath,
                            
    '/' $_SESSION['language'] . '_c_' $cPath,
                            
    '/m_' $manufacturers_id,
                            
    '/' $_SESSION['language'] . '_m_' . (int)$manufacturers_id
                            
    '/p_' $tmp_products_id,
                            
    '/' $_SESSION['language'] . '_p_' $tmp_products_id
                            
    );
        while(list (
    $key$value) = each($sheets_array)) {
            
    $perpagefile $template->get_template_dir('.css'DIR_WS_TEMPLATE$current_page_base'css') . $value '.css';
            if (
    file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' $perpagefile .'" />'."\n";
        }
        
        
    // load printer-friendly stylesheets -- named like "print*.css", alphabetically
        
    $directory_array $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css'), '/^print/''.css');
        
    sort($directory_array);
        while(list (
    $key$value) = each($directory_array)) {
            echo 
    '<link rel="stylesheet" type="text/css" media="print" href="' $template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css') . '/' $value '" />'."\n";
        }
        
        
    // load all site-wide jscript_*.js files from includes/templates/YOURTEMPLATE/jscript, alphabetically
        
    $directory_array $template->get_template_part($template->get_template_dir('.js',DIR_WS_TEMPLATE$current_page_base,'jscript'), '/^jscript_/''.js');
        while(list (
    $key$value) = each($directory_array)) {
            echo 
    '<script type="text/javascript" src="' .  $template->get_template_dir('.js',DIR_WS_TEMPLATE$current_page_base,'jscript') . '/' $value '"></script>'."\n";
        }
        
        
    // load all page-specific jscript_*.js files from includes/modules/pages/PAGENAME, alphabetically
        
    $directory_array $template->get_template_part($page_directory'/^jscript_/''.js');
        while(list (
    $key$value) = each($directory_array)) {
            echo 
    '<script type="text/javascript" src="' $page_directory '/' $value '"></script>' "\n";
        }
        
    // load all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically
        
    $directory_array $template->get_template_part($template->get_template_dir('.php',DIR_WS_TEMPLATE$current_page_base,'jscript'), '/^jscript_/''.php');
        while(list (
    $key$value) = each($directory_array)){
            
    // include content from all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically.
            // These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
            
    require($template->get_template_dir('.php',DIR_WS_TEMPLATE$current_page_base,'jscript') . '/' $value); echo "\n";
        }
        
    // include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
        
    $directory_array $template->get_template_part($page_directory'/^jscript_/');
        while(list (
    $key$value) = each($directory_array)) {
            
    // include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
            // These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
            
    require($page_directory '/' $value); echo "\n";
        }    
        echo 
    '<!-- END ZenCart Additions -->';
    // function zen_head
    add_action('wp_head','zen_head');
    get_header();
    ?>
    <?php 
    // NOTE: Blank line following is intended: ?>

  2. #2
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: wordpress template html_header.php blocking modules/pages/index?

    Sounds like a question for the author of the mod you are trying to add to zen cart.

  3. #3
    Join Date
    Jun 2011
    Location
    Colorado, USA
    Posts
    46
    Plugin Contributions
    0

    Default Re: wordpress template html_header.php blocking modules/pages/index?

    I think I found the solution. I added $page_directory to globals in the zen_head function and away everything went.

    The purists may not like it but this is the only way I have found to include Zen Cart into WordPress and not the other way round. Thanks to Michael Wender.

  4. #4
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: wordpress template html_header.php blocking modules/pages/index?

    While Mike Wender is quite a clever chap, and his system of "blending" ZC and Wordpress appears to function, it is not a system I would ever install... After looking at his methodology, I get the impression that quite a bit could "fall over"...
    20 years a Zencart User

  5. #5
    Join Date
    Jun 2011
    Location
    Colorado, USA
    Posts
    46
    Plugin Contributions
    0

    Default Re: wordpress template html_header.php blocking modules/pages/index?

    Thanks Schoolboy. Apologies for all the questions below. Put it down to an insatiable desire to learn.

    To help educate someone new to Zen Cart can you elaborate on what gives you the impression that quite a bit could "fall over"? Also what things may be a problem? I've done a lot of programming over the years. Is this a good idea in principle that could be tweaked to work?

    Going down this track stemmed from the the fact I wasn't impressed with the way WordPress handled shopping carts nor did I like the way Zen Cart handled sites that wanted to be more than just a store. This could stem from my lack of a deeper knowledge of Zen Cart.

    Any thoughts, suggestions and advice would be appreciated. Thanks Mate!

  6. #6
    Join Date
    Jun 2011
    Location
    Colorado, USA
    Posts
    46
    Plugin Contributions
    0

    Default Re: wordpress template html_header.php blocking modules/pages/index?

    I should add that I'm not using any of the cart functionality to display the cart totals on the WordPress side from Mike's template.

 

 

Similar Threads

  1. Using Wordpress in zc - Problem with index.php URL
    By fakeDecoy in forum General Questions
    Replies: 1
    Last Post: 29 Sep 2015, 07:59 PM
  2. html_header.php is missing from my custom template
    By seliko5 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 1 Mar 2011, 02:25 PM
  3. Page specific html_header.php pages
    By mutualadvantage in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 22 Aug 2007, 11:08 PM
  4. wordpress add-on, posts not showing up on index.php
    By joshuaself in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 25 Oct 2006, 07:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg