Results 1 to 8 of 8
  1. #1
    Join Date
    May 2008
    Posts
    452
    Plugin Contributions
    0

    Default can someone explain $body_code?

    Hi -

    I'm making progress on customizing my template. I've gotten the header, sidebar and footer more or less the way I want them, so I'm ready to concentrate on the main part of the display.

    In my tpl_main_page.php file, there's a line:

    require($body_code);

    that appears to call a file that does all the "dirty work." I see that $body_code is defined in main_template_vars.php, where it in turn uses something called $current_page_base to refer to a subdirectory. containing yet another main_template_vars.php file.

    At this point, I'm a bit foggy on the structure here. In this specific example, I'm trying to modify or disable the home buttons in the main display area. Can someone point me in the right direction?

    Thanks.

    www.cinderellaantiques.com

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: can someone explain $body_code?

    At this point, I'm a bit foggy on the structure here. In this specific example, I'm trying to modify or disable the home buttons in the main display area. Can someone point me in the right direction?
    Digging too deep - -

    Most all layout is in template tpl files...the core files are used unless you have a template override

    For the home button - if I am understanding your post correctly - the core file is includes/templates/template_default/common/tpl_header.php

    See these tutorials
    https://www.zen-cart.com/tutorials/i...hp?article=230
    https://www.zen-cart.com/tutorials/i...hp?article=143

    This one addresses the login link but the same principle applies for the home link
    https://www.zen-cart.com/tutorials/i...hp?article=260

    And
    https://www.zen-cart.com/tutorials/index.php?article=38
    https://www.zen-cart.com/tutorials/index.php?article=39

    There are many others
    Zen-Venom Get Bitten

  3. #3
    Join Date
    May 2008
    Posts
    452
    Plugin Contributions
    0

    Default Re: can someone explain $body_code?

    Thanks for the reply, Kobra. The home buttons I was referring to are actually not the ones in the header -- they're a ul in a div called "home-buttons" which is a few layers deep in the contentMainWrapper div. If you look at my home page (URL above), they're the three buttons below the image in the middle of the page.

    I know that these are defined somewhere in the templates area, but I just couldn't find them on my own. I used the toolkit, though, and found them here:

    includes/languages/english/html_includes/CUSTOM/define_main_page.php

    Can you explain the concept why they'd be here instead of somewhere in the templates section?

    Thanks.

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

    Default Re: can someone explain $body_code?

    All files that create language-specific content are in the /languages/ folder. The ones for your specific template will be in template subfolders under this section.

  5. #5
    Join Date
    May 2008
    Posts
    452
    Plugin Contributions
    0

    Default Re: can someone explain $body_code?

    Quote Originally Posted by gjh42 View Post
    All files that create language-specific content are in the /languages/ folder. The ones for your specific template will be in template subfolders under this section.
    OK, so...if I'm not interested in supporting other languages on this site, does this mean that I should copy this file into the template area before modifying it?

    Or, has the template's author already stipulated where this file lives as a part of her design?

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

    Default Re: can someone explain $body_code?

    It's not any one template's author; it's the structure of Zen Cart. Certain files are looked for in certain locations, and they won't be found if they are elsewhere (aside from the language/template custom locations which are accounted for).

  7. #7
    Join Date
    May 2008
    Posts
    452
    Plugin Contributions
    0

    Default Re: can someone explain $body_code?

    (This question is only to further my education in matters Zen.)

    So, the reason that the header flie lives with the templates is because it doesn't have any language-specific stuff in it? Everything it produces seems to come from constants and variables defined elsewhere.

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

    Default Re: can someone explain $body_code?

    Correct. The constants are defined in language files, so that it will be easy for someone to add another language if they need to.

 

 

Similar Threads

  1. Can someone explain?
    By Coffinwear in forum General Questions
    Replies: 6
    Last Post: 28 Jul 2010, 02:46 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