Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Building new pages

    As i add new pages, I have to edit 8 files for each one. I got it down to where I only need 6.

    I am working on getting it down to 4. Two of the pages are absolutely identical between products.

    Rather than have dozens of identical files, it seems that I should be able to call a generic file instead.

    includes/templates/MY_TEMPLATE/templates/tpl_xxxx_default.php can be replaced with tpl_360_default.php. They are all identical.

    includes/modules/pages/xxxx/header_php.php are identical.

    The question is;

    Does anyone know where those two files are called from?
    header_php.php
    tpl_xxxx_default.php

    Thanks for any help

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,472
    Plugin Contributions
    88

    Default Re: Building new pages

    Your site's /index.php provides that sequencing. Its basic processing:


    1. Kicks off the /includes/application_top.php processing, which, in turn, brings in all auto-loaded classes, definitions and functions.
    2. Based on the current page, e.g. shopping_cart, loads all header_php[_*].php files located in /includes/modules/pages/{current_page}/.
    3. Loads the active template's /includes/templates/YOUR_TEMPLATE/common/html_header.php.
    4. Loads /includes/templates/YOUR_TEMPLATE/common/main_template_vars.php. This is where the determination of the "base" template name occurs.
    5. Loads any 'onload' type jscript_ files.
    6. Loads the active template's /includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php. This is where the "base" template file is loaded.

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,671
    Plugin Contributions
    123

    Default Re: Building new pages

    Remember that unless your pages contain database interaction or something else requiring PHP, you can just create an EZ Page (Admin->Tools->EZ-Pages).
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: Building new pages

    Quote Originally Posted by lat9 View Post
    Your site's /index.php provides that sequencing. Its basic processing:


    1. Loads the active template's /includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php. This is where the "base" template file is loaded.
    Thanks! I got a handle on the 'includes/modules/pages/xxxx/header_php.php' and it is working just fine.

    Still trying to make sense of the 'includes/templates/MY_TEMPLATE/templates/tpl_xxxx_default.php'.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Building new pages

    What sense are you trying to make? Or what are you trying to understand?

    An aside comment, regarding having or eliminating potential files, I know that I have a product type page that was created as a new type and does not match the standard other product type pages. It is its own product type with associated/necessary information. I think it's great to have the option to reduce down to what is needed for someone's basic shop, but having the flexibility to add/expand and revise without affecting other operations is good as well.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: Building new pages

    Quote Originally Posted by swguy View Post
    Remember that unless your pages contain database interaction or something else requiring PHP, you can just create an EZ Page (Admin->Tools->EZ-Pages).
    Thanks, but sorry, EZ Pages are pretty much worthless in this scenario. I tried that a year ago. Since then, I kluged together a system that worked okay, but the final 360 page could not be rendered on its own. It had to be acquired from the calling page, ergo my attempt at just building proper pages.

    Except for the title, everything else is identical for all 360 view products. So rather than building a bunch of folders and duplicate files, I am trying to intercept the call to "includes/templates/MY_TEMPLATE/templates/tpl_xxxx_default.php' to force the 360 view products to 'includes/templates/MY_TEMPLATE/templates/tpl_360_default.php'.

    I got the 'header_php.php' file dealt with and a none of the others are needed. I can get my new pages down to a single page (the 'xxxx.php' variables page), once I figure out the last step.

    This is the page that needs duplicated over and over. Not really a big deal, except that I need to name it and create a folder for each one. (and actually, each page just calls this file)

    Here is an example of the page 360 view

    Code:
    <?php
    $_SESSION['navigation']->remove_current_page();
    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
    ?>
    
    <div class="buttonRow back">
    
    <?php
      echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT);
      ?>
    </a>
    </div><br>
    
    <div class='centerColumn' align='center'>
    <h1><?php echo HEADING_TITLE; ?></h1>
    
    <div class='content'>
    
    <?php
    
      // $ImgData is used for the hyperlink title //
      // directory is Store/images/360/$products_name/ //
    
      $img_dir = './images/360/' . FOLDER_TITLE . '/';
    
      // all images are named _0000x.JPG convenient for OSX renaming//
      $product_img = $img_dir . '_00001.JPG'; // update to PNG
      
      // number of jpegs needed for function //
      // this allows for differing image counts //
      $img_files = glob($img_dir . "*JPG"); 
      $filecount = count($img_files);
      
      // _##### is wildcard = _00000 --> _000XX //
      $img_seq = $img_dir . '_#####.JPG|1..' . $filecount;
      
      // function does not run without W/H //
      list($width, $height) = getimagesize($product_img);
      
      // generate 360 view
      echo '<img src="' . $product_img . '" width=' . $width . ' height=' . $height . ' class="reel" id="image"  data-images="' . $img_seq . '">';
      ?>
    
    <h1><?php echo TEXT_INFORMATION; ?></h1>
    
    </div>
    </div>
    Last edited by IATIA; 13 Jan 2019 at 12:00 AM.

  7. #7
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,671
    Plugin Contributions
    123

    Default Re: Building new pages

    Quote Originally Posted by IATIA View Post
    This is the page that needs duplicated over and over.
    Instead of doing that, can you create a parameter (or parameters) that will pass the information which differs from page to page?
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  8. #8
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: Building new pages

    It's calling tpl_xxxx_default.php, so it has to be there. I am trying to get it to call tpl_360_default.php instead. I don't want tpl_xxxx_default.php to exist. There is no difference between the pages.

  9. #9
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,671
    Plugin Contributions
    123

    Default Re: Building new pages

    OK. In includes/templates/template_default/templates/main_template_vars.php, there is a block of code. In 1.5.6a, it is on line 33.

    $body_code = $template->get_template_dir('tpl_' . preg_replace('/.php/', '',$_GET['main_page']) . '_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_' . $_GET['main_page'] . '_default.php';^M

    You can check to see if it's your page, and if so, set $body_code to tpl_360_default.php instead of using this logic.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  10. #10
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: Building new pages

    Thanks! That did it. Just need to check '$_GET['main_page']' and change if ... Thanks again!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Building New Modules
    By acetate in forum General Questions
    Replies: 2
    Last Post: 24 Aug 2008, 11:01 AM
  2. New to Web building
    By NettlesJewelry in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 24 Jul 2008, 03:50 PM
  3. Having layout troubles building my new template
    By Pyralis in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 25 Apr 2008, 01:06 PM
  4. Building a new site... need help!
    By canemasters in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 6 Feb 2008, 01:20 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR