Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    May 2012
    Posts
    38
    Plugin Contributions
    0

    Default Adding new element to main or other page

    I'm trying and failing to customize the Zencart interface a bit more than the template system seems to allow. I hope I'm just missing something.

    I created a CUSTOM folder (not using that exact name) under (my site, ZC 1.5.0)/includes/templates/ and copied tpl_main_page.php there. I edited that tpl_main_page.php copy and added a line:

    <h3>hello world</h3>

    Here's the bit of code where I added it-first line at "body id" is line 53:

    <body id="<?php echo $body_id . 'Body'; ?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
    <?php
    if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerOne" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <h3>hello world</h3>
    <?php
    }
    }
    ?>


    But my text appears nowhere on the main page.

    I tried likewise with tpl_header.php; same result.

    Why don't I see a change, and how can I get such a change? Once I know how to do "hello world", I hope to add an image just beneath the main banner (actually substituting for it) with a linkable map that I control.

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

    Default Re: Adding new element to main or other page

    I created a CUSTOM folder (not using that exact name) under (my site, ZC 1.5.0)/includes/templates/
    One must match folders & contents to that of template_default

    So tpl_main_page.php belongs in a folder named "common" under/in your custom template folder

  3. #3
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Adding new element to main or other page

    You also need to have a template_info.php file in the template's root directory (includes/templates/custom) and select the template in Admin - Tools - Template Selection

  4. #4
    Join Date
    May 2012
    Posts
    38
    Plugin Contributions
    0

    Default Re: Adding new element to main or other page

    Aha, thank you. Putting the tpl_header.php file into the "common" subdirectory makes my little code bit display. However, placing tpl_main.php there too does not display anything.

    I do have a template_info.php in the proper place.

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

    Default Re: Adding new element to main or other page

    placing tpl_main.php there too does not display anything.
    Then you have made an error, whether in filename or location or syntax of your new code we can't say without more information. What exactly did you do with tpl_main_page.php?

  6. #6
    Join Date
    May 2012
    Posts
    38
    Plugin Contributions
    0

    Default Re: Adding new element to main or other page

    gjh42, thanks for replying. In tpl_main_page, I make the change below line 58 (where this snippet starts at line 53):
    <body id="<?php echo $body_id . 'Body'; ?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
    <?php
    if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerOne" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <h3>xping_tpl_main_page</h3>
    <?php
    }
    }
    ?>

    I have changed "hello world" to a more easily searchable string. I noticed that my string is inside a structure that seems to be executed when banners are displayed, so I tried turning the banners on, but got the same result.

    I also added another string just below the snippet shown here. That finally gave me a result, at the top of the page. It is located outside the principal area of display, so is not useable, but I can experiment further.

    If it's not against Zencart policy in some way, I suggest some FAQ or tutorial on adding display elements interspersed with those in the site layout, as I am trying to do. Seems it might be a useful, alternative means of controlling appearance and function.

  7. #7
    Join Date
    May 2012
    Posts
    38
    Plugin Contributions
    0

    Default Re: Adding new element to main or other page

    Hmm, this looks like it might be what I have in mind:
    http://www.zen-cart.com/content.php?...der-and-footer

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

    Default Re: Adding new element to main or other page

    You have to not just turn bannergroup1 on, but have a banner in it to display, in order for the code to execute.

    You might just better put your code outside that conditional (as your last comment suggests), unless you really only want it to execute when the banner displays.

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

    Default Re: Adding new element to main or other page

    And yes, as that tutorial describes, you generally want to add custom display code in specific page element files rather than tpl_main_page.php, unless you want your new element outside the normal page elements.

  10. #10
    Join Date
    May 2012
    Posts
    38
    Plugin Contributions
    0

    Default Re: Adding new element to main or other page

    Experimenting with tpl_header, I can put my little strings at a number of places above the second "Home" link to the main screen and the "Welcome..." message. However, making similar changes to the tpl_footer file does not give me anything else - I can't change anything in the region of the products listing. The obvious points to try seem clear: at the eof/bof comments in tpl_footer.php. Why do these changes make no difference?

    I am starting from the barebones template, if that's a clue. Also, adding the tpl_header changes seems to make the banners vanish, although I have all banners turned on.

    And I think I don't want to use tpl_main for anything here.

    Thanks again for your help!

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Adding new element to header menu
    By GabyWalker in forum Basic Configuration
    Replies: 5
    Last Post: 5 Dec 2013, 09:52 PM
  2. Replies: 1
    Last Post: 17 Oct 2009, 11:50 PM
  3. Main page display other than New Products?
    By ddye in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 12 May 2007, 03:53 PM
  4. Adding flash element to product page
    By wcjmproducer in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 Nov 2006, 10:53 PM
  5. Adding Category Name to the New Products/Featured/Specials Boxes on Main Page
    By chinchilla2 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 21 Aug 2006, 09: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