Forums / Installing on a Linux/Unix Server / EZ Pages links showing up where they shouldn't

EZ Pages links showing up where they shouldn't

Views: 2,982

Results 1 to 14 of 14
16 Apr 2013, 4:14 AM
#1
rcbitz avatar

rcbitz

New Zenner

Join Date:
Apr 2013
Location:
Melbourne
Posts:
14
Plugin Contributions:
0

EZ Pages links showing up where they shouldn't

Hi I just started configuring my Zen Cart using a picaflor azul template.

I have been able to configure, customise most things and I haven't installed any extra modules.

My problem is that I have created some EZ Pages links to appear in my header and footer (for external pages) and they work fine. Now I wanted to add some additional EZ Pages with their own content (internal pages) to appear in a side box - which I have turned on in the Layout Manager.

I have got the side box appearing with my additional link however some of the links from the header/footer also appear and I don't want them to. I think I have got the setup right in my configuration see the attached picture
Attachment 12355

The links I want to appear in header/footer are working fine : AUS RC, RC Groups Forum, RC Tech & Servo Database

The links I want to appear in the side box are : How To Videos
However the ones from the header & footer appear as well.

This is my site : https://www.rcbitz.com.au

I hope I have provided enough information, is someone able to tell me what I have done wrong?

Many Thanks in advance.
Peter

16 Apr 2013, 4:51 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: EZ Pages links showing up where they shouldn't

It appears that the RC Groups Forum, RC Tech & Servo Database pages are now enabled for the sidebox. Are you certain those settings are still as you showed in your screenshot?

16 Apr 2013, 5:17 AM
#3
rcbitz avatar

rcbitz

New Zenner

Join Date:
Apr 2013
Location:
Melbourne
Posts:
14
Plugin Contributions:
0

Re: EZ Pages links showing up where they shouldn't

Hi there, thanks for replying - yes I am 100% sure - I haven't touched any setting since taking the screen shot.

16 Apr 2013, 4:07 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: EZ Pages links showing up where they shouldn't

If all of the header/footer links showed in the sidebox, I would say the sidebox code is corrupted somehow so it doesn't distinguish between location settings. But one header/footer link does not appear in the sidebox. This is just strange and inexplicable without looking in detail at all the relevant code.

18 Apr 2013, 3:02 AM
#5
rcbitz avatar

rcbitz

New Zenner

Join Date:
Apr 2013
Location:
Melbourne
Posts:
14
Plugin Contributions:
0

Re: EZ Pages links showing up where they shouldn't

Thanks gjh42 for thinking about my problem a little further. I think or rather I hope that my sidebox code is not corrupted, I did have a look at it to confirm the the SQL query was infact only retrieving records with 'status_sidebox' = true (or 1 I can't remember )and also that it excludes EZ Pages whose sort order is set to zero which you will see is how it is in my screen shot. All I have done is change the heading name of my EZ Pages side box from I think it was "Important Links" to "More Information".

I am a .net developer by trade so am comfortable reading code but the code in there does have me a little lost since the EZ Pages can be configured in 3 different ways. Maybe someone with a fresh-clean install of Zen Cart could do a test run for me.

Create 1 or 2 EZ Pages that opens in a "new window" and links to an external site that is to display only on header/footer and then another one that has HTML content that links only to the sidebox and see what appears?

Got me stumped and I always try more than one way to skin a cat...

18 Apr 2013, 5:40 AM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: EZ Pages links showing up where they shouldn't

I see that you have (or your template has) BetterCategoriesEZInfo installed. This is overriding the stock ez-pages sidebox code, so you need to look at that to be sure it is correct. You say you changed the sidebox title; what file did you edit? What happens if you rename the custom ez-pages sidebox files to .bak so the stock ez-pages sidebox files are used? Try disabling them one by one if possible.

18 Apr 2013, 10:13 AM
#7
rcbitz avatar

rcbitz

New Zenner

Join Date:
Apr 2013
Location:
Melbourne
Posts:
14
Plugin Contributions:
0

Re: EZ Pages links showing up where they shouldn't

Hi gjh42, thanks for some more pointers - I didn't realize that my picaflor azul Sheffield Blue template had over ridden the stock ez-pages sidebox .

Ok so, I changed the title of my EZ Pages Sidebox by editing the file located at :** includes/languages/english/extra_definitions/ez_pages_definitions.php **
I changed this line to read : define('BOX_HEADING_EZPAGES','More Information');

I renamed the default EZ Pages file located at : /includes/modules/sideboxes/ezpages.php -> ezpages.bak and when I refreshed my site the sidebox disappeared completely, so I renamed it back to normal.

I then renamed the file I can see that may have an impact : /includes/modules/sideboxes/sheffield_blue/ezpages_drop_menu.php -> ezpages_drop_menu.bak and when I refreshed my site it displayed the header then the rest of the site wouldn't display (and the EZ Page links in the header weren't there), so I renamed it back to normal.

I then renamed the file I can see that may have an impact : **/includes/templates/sheffield_blue/sideboxes/tpl_ezpages.php **-> tpl_ezpages.php.bak and when I refreshed my site, the problem was still there, so I renamed it back to normal.

Is there another place I should look for an overload? or would it help to see the contents of one of the files?

Thanks so much for your help so far.

18 Apr 2013, 2:17 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: EZ Pages links showing up where they shouldn't

Post the content of /includes/templates/sheffield_blue/sideboxes/tpl_ezpages.php - that should have gilby's name in the header comments. It's a very short file, and is probably not the source of the issue, but let's make sure.

After that, what happens if you switch to the Classic template? If the sidebox works correctly then, the problem is in one of your /sheffield_blue/ files.
If not, there is some corruption in a deeper core file.

18 Apr 2013, 2:47 PM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: EZ Pages links showing up where they shouldn't

The only other storefront-side file that could be relevant is /includes/modules/sideboxes/ezpages.php (or /includes/modules/sideboxes/sheffield_blue/ezpages.php if it exists). It should have this line (as you indicated it does): ```php
$page_query = $db->Execute("select * from " . TABLE_EZPAGES . " where status_sidebox = 1 and sidebox_sort_order > 0 order by sidebox_sort_order, pages_title");

You mention /includes/modules/sideboxes/sheffield_blue/ezpages_drop_menu.php, which has nothing to do with the sidebox, but it might be possible that it somehow interferes with sidebox function. Seeing any relevant parts of that might be useful.

The last resort is that the database, or the admin interface, is corrupted somehow. First, what happens if you make new ez-pages with various display settings?
18 Apr 2013, 10:48 PM
#10
rcbitz avatar

rcbitz

New Zenner

Join Date:
Apr 2013
Location:
Melbourne
Posts:
14
Plugin Contributions:
0

Re: EZ Pages links showing up where they shouldn't

Hi again gjh42. Ok first things first.

Here is the code for /includes/templates/sheffield_blue/sideboxes/tpl_ezpages.php it does indeed have gilby's name in the header.

<?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 $
 *
 * BetterCategoriesEzInfo v1.3.5 added  2006-09-19  gilby
 */
 
  $pointer = zen_image(DIR_WS_TEMPLATE_IMAGES . 'bc_ezpages.gif');
  // uncomment next line to add 1 space between image & text
  // $pointer .= ' ';

  $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><div class="betterEzpages"><a href="' . $var_linksList[$i]['link'] . '">' . $pointer . $var_linksList[$i]['name'] . '</a></div></li>' . "\n" ;
  } // end FOR loop
  $content  .= '</ul>' . "\n";
  $content .= '</div>';
?>

Secondly - when I reverted back to the Classic template the site looked very crap, but side box appeared ok with only the 2 EZ pages I wanted to appear. So I guess that at least means my database is not corrupted.
Attachment 12370

18 Apr 2013, 10:59 PM
#11
rcbitz avatar

rcbitz

New Zenner

Join Date:
Apr 2013
Location:
Melbourne
Posts:
14
Plugin Contributions:
0

Re: EZ Pages links showing up where they shouldn't

Onto the next items to investigate :

The file /includes/modules/sideboxes/ezpages.php is still the stock standard one that was first installed - never been altered. Now that we know it works ok under classic template and if renamed the sidebox doesn't appear at all, I "hope" we can assume it is ok and is executed on the server when pages are refreshed - it does have the line you mention.

For the sake of it, here is the contents of that file:

<?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) {
        $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'), true, true, true));
          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'), true, true, true));
          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'] > 0 ? '&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' : '');
        $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_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    }
  } // test for display

  $zco_notifier->notify('NOTIFY_END_EZPAGES_SIDEBOX');
?>

The is no such file : /includes/modules/sideboxes/sheffield_blue/ezpages.php

However you are correct, another php file is intercepting or interfering with /includes/modules/sideboxes/ezpages.php - I just don't know which one.

19 Apr 2013, 2:12 AM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: EZ Pages links showing up where they shouldn't

I notice that in ezpages.php, $page_query_list_sidebox is not being reset or initialized to empty before it starts being filled for the sidebox output. Normally, this is not a problem because the variable doesn't exist yet, so it starts empty. If the ezpages_drop_menu.php uses the same variable and there is a larger number of items in it, they will still be there. The first one(s) will be replaced with the proper sidebox content, but any that are not replaced will still be the header links.

This is a case of two sloppy practices that are harmless by themselves colliding when used together. A mod file should not use a variable that has a chance of being reused by a stock file on the same page (unless it empties it after using it), and the stock ezpages file should make sure an array is empty before filling it.

Straight variables that hold only one value do not have the same issue, though string variables have been known to mess up processing when they unexpectedly have previous content not cleaned out, and they add new content instead of absolutely assigning content.

So the solution will be to edit one of those files to eliminate the overlap. I would go with cleanup in the drop menu file, as that will solve it positively, no matter what you do with sideboxes.
/includes/modules/sideboxes/sheffield_blue/ezpages_drop_menu.php
Add near the end of the file (I will have to see the last dozen lines to be sure of the correct place)```php
unset($page_query_list_sidebox); //for compatibility with stock ezpages sidebox

Alternatively, you could edit ezpages.php and duplicate the function of ```php
    if (isset($var_linksList)) {
      unset($var_linksList);
    }

like this```php
if (isset($var_linksList)) {
unset($var_linksList);
}
if (isset($page_query_list_sidebox)) {
unset($page_query_list_sidebox);
}

Ironically, $var_linksList is set absolutely when used, so any previous content would be replaced anyway. The $page_query_list_sidebox array that is vulnerable is not unset before use...
19 Apr 2013, 3:22 AM
#13
rcbitz avatar

rcbitz

New Zenner

Join Date:
Apr 2013
Location:
Melbourne
Posts:
14
Plugin Contributions:
0

Re: EZ Pages links showing up where they shouldn't

gjh42 YOU ARE A LEGEND!!

After sending in my last post I was re-reading the code in the files I had sent back, I wondered whether another routine was injecting entries into the array that the tpl_ezpages.php used to fill the sidebox list, but I wasn't sure where I would need to clear it out.

I added the following line as you suggested to the end of : ** /includes/modules/sideboxes/sheffield_blue/ezpages_drop_menu.php**

The last few lines of that file now read like this:

     $var_linksList = $page_query_list_sidebox;

     require($template->get_template_dir('tpl_ezpages_drop_menu.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_ezpages_drop_menu.php');
     require($template->get_template_dir('tpl_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_box_header.php');
     unset($page_query_list_sidebox); //for compatibility with stock ezpages sidebox  
   }
 } // test for display

And Voila - my EZ pages Sidebox is working as it should using Sheffield Template...

Once again, gjh42 thankyou so much for your help!!

19 Apr 2013, 3:37 AM
#14
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: EZ Pages links showing up where they shouldn't

Glad to hear it worked for you. I'll contact Anne and see if she can update the file she uses in her templates (I don't think that file is her original work, but incorporated from elsewhere).