Results 1 to 8 of 8

Threaded View

  1. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Substituting mod code for core code in v2.0

    Thank you very much - that is the best info I have seen yet on what will be possible.

    Some of my mods only change a few lines inside a large file, e.g. Smart Backgrounds adds a bit of code to tpl_main_page.php for setting a body classname (could be done with a notifier hook), but then uses a changed line for outputting the body div HTML with classname. If the original body div HTML then executed, it would obviously cause big problems. I will need to swap my new output line for the original one.

    This code could be moved into an observer:
    PHP Code:
    <?php //Smart Backgrounds
    $smart_image '';
    if (
    $current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and cPath to bg filename only if individual cat bg image exists, else add _ and top cat id to bg filename only if top cat bg image exists
      
    $smart_image file_exists(DIR_WS_TEMPLATE_IMAGES 'smartbg_' $_GET[cPath] . '.gif')?'_' $_GET[cPath]:(file_exists(DIR_WS_TEMPLATE_IMAGES 'smartbg_' . (int)$_GET[cPath] . '.gif')?'_' . (int)$_GET[cPath]:'');
    } elseif (
    $current_page_base == 'page') { //add _page and ez-page id to bg filename only if ez-page id bg image exists, else add _page to bg filename only if general ez-page bg image exists
      
    $smart_image file_exists(DIR_WS_TEMPLATE_IMAGES 'smartbg_page' $_GET[id] . '.gif')?'_page' $_GET['id']:(file_exists(DIR_WS_TEMPLATE_IMAGES 'smartbg_page.gif')?'_page':'');
    } else { 
    //add _ and page base to bg filename only if page bg image exists
      
    $smart_image file_exists(DIR_WS_TEMPLATE_IMAGES 'smartbg_' $current_page_base '.gif')?'_' $current_page_base:''//default/home page class will be just .smartBG, and filename smartbg.gif
    }// /Smart Backgrounds?>
    but this line needs to substitute for the original in tpl_main_page.php:
    PHP Code:
    <body id="<?php echo $body_id 'Body'?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'?>>
    I would love to be able to do this without having to make an override copy of the whole tpl_main_page.php.


    Coming back after a bit of core code executed and "redoing" it would sometimes work, but if you don't know the original values of variables the core was working on, it might not be possible to completely reverse the original action. If the core code performed output, that would be a bit difficult to "take back" :)
    Last edited by gjh42; 9 Sep 2009 at 07:47 PM.

 

 

Similar Threads

  1. Discount Code - Invalid Code Message Not Appearing - FEC
    By pennylane in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 11 Jan 2010, 11:21 PM
  2. product description os utputting code -stylesheet and comment code
    By edt123 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 15 Dec 2009, 07:06 PM
  3. CVV2 Code - where's the card security code entered?
    By jamieboulder in forum General Questions
    Replies: 2
    Last Post: 12 Mar 2008, 06:05 PM

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