Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 31
  1. #11
    Join Date
    May 2010
    Posts
    67
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    Quote Originally Posted by gjh42 View Post
    If you don't want to choose the right one, then you probably won't want to look at this forum thread ;)
    how to add an additional sidebox
    I was able to successfully modify the existing code in "ezpages.php" to see how it works.

    Now that I know how to edit it successfully I want to clone it but I am having trouble following the tutorial you sent me.

    I am at the part where it says to create a new configuration key called "SHOW_BANNERS_GROUP_SET10".

    I can't find the equivilent of this for EZ-Pages.

    I looked at "tpl_ezpages.php" and can't find it.

    Am I looking in the wrong place?

    Thanks!,

    ojhernandez

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

    Default Re: Sorting EZ-Pages Into Sideboxes

    The content details of that post are for a banner sidebox, and are not applicable to the ezpages sidebox. Make the clone by duplicating the module and template file with "2" added to the name in all relevant places including inside the file code, adjust for the different page ids, and you should be good to go.

    Another way you could handle it would be to get the Blank Sidebox mod from Free Addons, adjust its filenames to your purposes, and copy the functional ez-pages code into those files and adjust.

  3. #13
    Join Date
    May 2010
    Posts
    67
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    Quote Originally Posted by gjh42 View Post
    The content details of that post are for a banner sidebox, and are not applicable to the ezpages sidebox. Make the clone by duplicating the module and template file with "2" added to the name in all relevant places including inside the file code, adjust for the different page ids, and you should be good to go.
    Hello!

    Thanks for all your help until this point. I greatly appreciate it.

    I cloned it and I believed it was successful except now, the sidebox doesn't display EZ-Pages. When the ID is enabled in the code, it displays the sidebox with the heading but doesn't actually show the pages.

    I put the code here because I know I'm probably making a simple mistake.

    ezpages.php:

    PHP Code:
    <?php
    /**
     * ezpages sidebox - used to display links to EZ-Pages content
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 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: ezpages.php 6021 2007-03-17 16:34:19Z ajeh $
     */

      
    $zco_notifier->notify('NOTIFY_START_EZPAGES_SIDEBOX');

      
    // test if sidebox should display
      
    if (EZPAGES_STATUS_SIDEBOX == '1' or (EZPAGES_STATUS_SIDEBOX== '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE$_SERVER['REMOTE_ADDR'])))) {
        if (isset(
    $var_linksList)) {
          unset(
    $var_linksList);
        }
        
    $page_query $db->Execute("select * from " TABLE_EZPAGES " where status_sidebox = 1 and sidebox_sort_order > 0 order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) {
          
    $title =  BOX_HEADING_EZPAGES;
          
    $box_id =  'ezpages';
          
    $rows 0;
          while (!
    $page_query->EOF) {

        if (
    in_array($page_query->fields['pages_id'], explode(',''11,12,13,14,15,16'))) { //list of ez-page ids to display in this box

            
    $rows++;
            
    $page_query_list_sidebox[$rows]['id'] = $page_query->fields['pages_id'];
            
    $page_query_list_sidebox[$rows]['name'] = $page_query->fields['pages_title'];
            
    $page_query_list_sidebox[$rows]['altURL']  = "";
            switch (
    true) {
              
    // external link new window or same window
              
    case ($page_query->fields['alt_url_external'] != ''):
              
    $page_query_list_sidebox[$rows]['altURL']  = $page_query->fields['alt_url_external'];
              break;
              
    // internal link new window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '1'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
              
    // internal link same window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '0'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
            }

            
    // if altURL is specified, use it; otherwise, use EZPage ID to create link
            
    $page_query_list_sidebox[$rows]['link'] = ($page_query_list_sidebox[$rows]['altURL'] =='') ?
            
    zen_href_link(FILENAME_EZPAGES'id=' $page_query->fields['pages_id'] . ($page_query->fields['toc_chapter'] > '&chapter=' $page_query->fields['toc_chapter'] : ''), ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL')) :
            
    $page_query_list_sidebox[$rows]['altURL'];
            
    $page_query_list_sidebox[$rows]['link'] .= ($page_query->fields['page_open_new_window'] == '1' '" target="_blank' '');

        } 
    //in_array        

        
    $page_query->MoveNext();
          }

          
    $title_link false;

          
    $var_linksList $page_query_list_sidebox;

          require(
    $template->get_template_dir('tpl_ezpages.php',DIR_WS_TEMPLATE$current_page_base,'sideboxes'). '/tpl_ezpages.php');

          
    $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
          require(
    $template->get_template_dir($column_box_defaultDIR_WS_TEMPLATE$current_page_base,'common') . '/' $column_box_default);
        }
      } 
    // test for display

      
    $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
    ?>
    ezpages2.php
    PHP Code:
    <?php
    /**
     * ezpages sidebox - used to display links to EZ-Pages content
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 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: ezpages.php 6021 2007-03-17 16:34:19Z ajeh $
     */

      
    $zco_notifier->notify('NOTIFY_START_EZPAGES2_SIDEBOX');

      
    // test if sidebox should display
      
    if (EZPAGES2_STATUS_SIDEBOX == '1' or (EZPAGES2_STATUS_SIDEBOX== '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE$_SERVER['REMOTE_ADDR'])))) {
        if (isset(
    $var_linksList)) {
          unset(
    $var_linksList);
        }
        
    $page_query $db->Execute("select * from " TABLE_EZPAGES2 " where status_sidebox = 1 and sidebox_sort_order > 0 order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) {
          
    $title =  BOX_HEADING_EZPAGES2;
          
    $box_id =  'ezpages2';
          
    $rows 0;
          while (!
    $page_query->EOF) {
            if (
    in_array($page_query->fields['pages_id'], explode(',''2,3,17,4,5,6,1,7,8,9,10'))) { //list of ez-page ids to display in this box

             
            
    $rows++;
            
    $page_query_list_sidebox[$rows]['id'] = $page_query->fields['pages_id'];
            
    $page_query_list_sidebox[$rows]['name'] = $page_query->fields['pages_title'];
            
    $page_query_list_sidebox[$rows]['altURL']  = "";
            switch (
    true) {
              
    // external link new window or same window
              
    case ($page_query->fields['alt_url_external'] != ''):
              
    $page_query_list_sidebox[$rows]['altURL']  = $page_query->fields['alt_url_external'];
              break;
              
    // internal link new window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '1'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
              
    // internal link same window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '0'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
            }

            
    // if altURL is specified, use it; otherwise, use EZPage ID to create link
            
    $page_query_list_sidebox[$rows]['link'] = ($page_query_list_sidebox[$rows]['altURL'] =='') ?
            
    zen_href_link(FILENAME_EZPAGES2'id=' $page_query->fields['pages_id'] . ($page_query->fields['toc_chapter'] > '&chapter=' $page_query->fields['toc_chapter'] : ''), ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL')) :
            
    $page_query_list_sidebox[$rows]['altURL'];
            
    $page_query_list_sidebox[$rows]['link'] .= ($page_query->fields['page_open_new_window'] == '1' '" target="_blank' '');
           } 
    //in_array
         
    $page_query->MoveNext();
          }

          
    $title_link false;

          
    $var_linksList $page_query_list_sidebox;

          require(
    $template->get_template_dir('tpl_ezpages2.php',DIR_WS_TEMPLATE$current_page_base,'sideboxes'). '/tpl_ezpages2.php');

          
    $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
          require(
    $template->get_template_dir($column_box_defaultDIR_WS_TEMPLATE$current_page_base,'common') . '/' $column_box_default);
        }
      } 
    // test for display

      
    $zco_notifier->notify('NOTIFY_END_EZPAGES2_SIDEBOX');
    ?>
    tpl_ezpages.php:
    PHP Code:
    <?php
    /**
     * Side Box Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 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: tpl_ezpages.php 2982 2006-02-07 07:56:41Z birdbrain $
     */
      
    $content "";
      
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent">';
      
    $content  .= "\n" '<ul style="margin: 0; padding: 0; list-style-type: none;">' "\n";
      for (
    $i=1$n=sizeof($var_linksList); $i<=$n$i++) { 
        
    $content .= '<li><a href="' $var_linksList[$i]['link'] . '">' $var_linksList[$i]['name'] . '</a></li>' "\n" ;
      } 
    // end FOR loop
      
    $content  .= '</ul>' "\n";
      
    $content .= '</div>';
    ?>
    tpl_ezpages2.php:
    PHP Code:
    <?php
    /**
     * Side Box Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 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: tpl_ezpages.php 2982 2006-02-07 07:56:41Z birdbrain $
     */
      
    $content "";
      
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent">';
      
    $content  .= "\n" '<ul style="margin: 0; padding: 0; list-style-type: none;">' "\n";
      for (
    $i=1$n=sizeof($var_linksList); $i<=$n$i++) { 
        
    $content .= '<li><a href="' $var_linksList[$i]['link'] . '">' $var_linksList[$i]['name'] . '</a></li>' "\n" ;
      } 
    // end FOR loop
      
    $content  .= '</ul>' "\n";
      
    $content .= '</div>';
    ?>
    I will say that to me, it didn't look like I needed to change anything in the "tpl" files so they are exactly the same, maybe that right there is the problem?

    Thanks in Advance!

    ojhernandez

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

    Default Re: Sorting EZ-Pages Into Sideboxes

    One name that must not be changed is the database table: TABLE_EZPAGES2 should still be TABLE_EZPAGES. Does the original ezpages sidebox still work correctly?
    PHP Code:
        $page_query $db->Execute("select * from " TABLE_EZPAGES2 " where status_sidebox = 1 and sidebox_sort_order > 0 order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) { 

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

    Default Re: Sorting EZ-Pages Into Sideboxes

    When I look at the contributions Glenn Herbert makes to this forum I realise just how fortunate the forum is to have his expertise and commitment.

    This series of posts is extremely valuable. Thanks a TON, Glen, for all you do around here.
    20 years a Zencart User

  6. #16
    Join Date
    May 2010
    Posts
    67
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    Quote Originally Posted by schoolboy View Post
    When I look at the contributions Glenn Herbert makes to this forum I realise just how fortunate the forum is to have his expertise and commitment.
    I agree wholeheartedly with this observation.


    Quote Originally Posted by gjh42 View Post
    One name that must not be changed is the database table: TABLE_EZPAGES2 should still be TABLE_EZPAGES. Does the original ezpages sidebox still work correctly?
    PHP Code:
        $page_query $db->Execute("select * from " TABLE_EZPAGES2 " where status_sidebox = 1 and sidebox_sort_order > 0 order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) { 
    The original EZ-Pages Sidebox does work correctly!

    "ezpages2.php" however is another story. I was trying to test it out with my EZ-Page '1' and it will not display even after I have verified that it is set to show in the sidebox with a sort order of 1.

    I have edited the file by changing the mistake you told me to fix. The code is shown below.

    ezpages2.php:
    PHP Code:
    <?php
    /**
     * ezpages sidebox - used to display links to EZ-Pages content
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 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: ezpages.php 6021 2007-03-17 16:34:19Z ajeh $
     */

      
    $zco_notifier->notify('NOTIFY_START_EZPAGES2_SIDEBOX');

      
    // test if sidebox should display
      
    if (EZPAGES2_STATUS_SIDEBOX == '1' or (EZPAGES2_STATUS_SIDEBOX== '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE$_SERVER['REMOTE_ADDR'])))) {
        if (isset(
    $var_linksList)) {
          unset(
    $var_linksList);
        }
        
    $page_query $db->Execute("select * from " TABLE_EZPAGES " where status_sidebox = 1 and sidebox_sort_order > 0 order by sidebox_sort_order, pages_title");
        if (
    $page_query->RecordCount()>0) {
          
    $title =  BOX_HEADING_EZPAGES2;
          
    $box_id =  'ezpages2';
          
    $rows 0;
          while (!
    $page_query->EOF) {
            if (
    in_array($page_query->fields['pages_id'], explode(',''1,2,3,17,4,5,6,1,7,8,9,10'))) { //list of ez-page ids to display in this box

             
            
    $rows++;
            
    $page_query_list_sidebox[$rows]['id'] = $page_query->fields['pages_id'];
            
    $page_query_list_sidebox[$rows]['name'] = $page_query->fields['pages_title'];
            
    $page_query_list_sidebox[$rows]['altURL']  = "";
            switch (
    true) {
              
    // external link new window or same window
              
    case ($page_query->fields['alt_url_external'] != ''):
              
    $page_query_list_sidebox[$rows]['altURL']  = $page_query->fields['alt_url_external'];
              break;
              
    // internal link new window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '1'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
              
    // internal link same window
              
    case ($page_query->fields['alt_url'] != '' and $page_query->fields['page_open_new_window'] == '0'):
              
    $page_query_list_sidebox[$rows]['altURL']  = (substr($page_query->fields['alt_url'],0,4) == 'http') ?
              
    $page_query->fields['alt_url'] :
              (
    $page_query->fields['alt_url']=='' '' zen_href_link($page_query->fields['alt_url'], '', ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL'), truetruetrue));
              break;
            }

            
    // if altURL is specified, use it; otherwise, use EZPage ID to create link
            
    $page_query_list_sidebox[$rows]['link'] = ($page_query_list_sidebox[$rows]['altURL'] =='') ?
            
    zen_href_link(FILENAME_EZPAGES2'id=' $page_query->fields['pages_id'] . ($page_query->fields['toc_chapter'] > '&chapter=' $page_query->fields['toc_chapter'] : ''), ($page_query->fields['page_is_ssl']=='0' 'NONSSL' 'SSL')) :
            
    $page_query_list_sidebox[$rows]['altURL'];
            
    $page_query_list_sidebox[$rows]['link'] .= ($page_query->fields['page_open_new_window'] == '1' '" target="_blank' '');
           } 
    //in_array
         
    $page_query->MoveNext();
          }

          
    $title_link false;

          
    $var_linksList $page_query_list_sidebox;

          require(
    $template->get_template_dir('tpl_ezpages2.php',DIR_WS_TEMPLATE$current_page_base,'sideboxes'). '/tpl_ezpages2.php');

          
    $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
          require(
    $template->get_template_dir($column_box_defaultDIR_WS_TEMPLATE$current_page_base,'common') . '/' $column_box_default);
        }
      } 
    // test for display

      
    $zco_notifier->notify('NOTIFY_END_EZPAGES2_SIDEBOX');
    ?>
    Could it be something related to "tpl_ezpages2.php"? I have left this file unchanged.

    Thanks in Advance!

    ojhernandez

  7. #17
    Join Date
    May 2010
    Posts
    67
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    I was looking at "ezpages2.php" again and saw that there was one mention of "EZPAGES" that was not edited to have the 2 after it.

    This is shown in the line below:
    PHP Code:
    $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX'); 
    This line is now edited to read:
    PHP Code:
    $zco_notifier->notify('NOTIFY_END_EZPAGES2_SIDEBOX'); 
    I fixed this and it still does not work.

    Just wanted to add this in case that was the error.

    Thanks,

    ojhernandez

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

    Default Re: Sorting EZ-Pages Into Sideboxes

    I can't see anything that should be a problem, assuming all of the constants for EZPAGES2 have been defined correctly... Okay, that's it.
    Some of the constants are for admin settings, and without adding new code to probably several admin files, this test will fail:
    PHP Code:
      // test if sidebox should display
      
    if (EZPAGES2_STATUS_SIDEBOX == '1' or (EZPAGES2_STATUS_SIDEBOX== '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE$_SERVER['REMOTE_ADDR'])))) { 
    It needs to refer to the only existing admin setting, EZPAGES_STATUS_SIDEBOX
    PHP Code:
      // test if sidebox should display
      
    if (EZPAGES_STATUS_SIDEBOX == '1' or (EZPAGES_STATUS_SIDEBOX== '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE$_SERVER['REMOTE_ADDR'])))) { 
    Both sideboxes will be on or off together.

  9. #19
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    6,196
    Plugin Contributions
    0

    Default Re: Sorting EZ-Pages Into Sideboxes

    Quote Originally Posted by schoolboy View Post
    When I look at the contributions Glenn Herbert makes to this forum I realise just how fortunate the forum is to have his expertise and commitment.

    This series of posts is extremely valuable. Thanks a TON, Glen, for all you do around here.
    I second that comment.....

  10. #20
    Join Date
    Sep 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Sorting EZ-Pages Into Sideboxes

    I had to make a few more changes to get it to work. On line 53 of ezpages2.php it should say

    Code:
      zen_href_link(FILENAME_EZPAGES, 'id='
    (without EZPAGES2)

    The page_query that decides which EZ Page goes into which box wasn't working, because they both had the same name, so I renamed the second to $page_query2

    And I had to add

    define('BOX_HEADING_EZPAGES2','Box 2 Heading');

    to ez_pages_definitions.php

    And now it works a treat!

    Would it be worth making it a contrib?

 

 
Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Sorting Product List pages by order popularity
    By Cozmoz in forum Code Collaboration
    Replies: 16
    Last Post: 1 Dec 2014, 11:04 AM
  2. How to add more pages into "Information"? (sideboxes/information.php)
    By n_t_r in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 27 May 2011, 01:50 PM
  3. Copyright bleeding into sideboxes
    By xavioremu in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 May 2010, 09:45 PM
  4. Sorting EZ_Page Footer links into columns?
    By bumba000 in forum General Questions
    Replies: 6
    Last Post: 4 Oct 2009, 05:36 AM
  5. Pulling Sideboxes into non zencart pages
    By halfwitt in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 22 Aug 2007, 02:51 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