Advertisement:

Author Topic: HTML-layout error in GenericList.template.php  (Read 2163 times)

Offline maestrosite.ru

  • Semi-Newbie
  • *
  • Posts: 93
    • Сопровождение и модификация форумов SMF
HTML-layout error in GenericList.template.php
« on: February 13, 2012, 11:21:33 AM »
Where the Error Occurred

    File: GenericList.template.php
    Line: 86-110,
    Any relevant errors in the SMF error log (if so please post them)?:

1. Start tag for tbody-element print in if-section.
lines: 86-110
Quote
   if (!($header_count < 2 && empty($cur_list['headers'][0]['label'])))
   {
      echo '
         <thead>
            <tr class="catbg">';
...
      echo '
            </tr>
         </thead>
         <tbody>';
   }

2. But end tag have unconditional print (echo without any conditionals)
lines: 139-142:
Quote
   echo '
         </tbody>
         </table>';

Total: if current list have not headers then result layout not valid - missing <tbody>.


Additionally for this function.
Don`t check existing of current list:
lines:17-19
Quote
   // Get a shortcut to the current list.
   $list_id = $list_id === null ? $context['default_list'] : $list_id;
   $cur_list = &$context[$list_id];

May be add something of this :
Quote
if( empty($context['default_list']) )
   retrun;
if( empty($context[$list_id]) )
   retrun;
« Last Edit: February 22, 2012, 06:08:49 PM by emanuele »
First of all, sorry for my english. По-русски у меня получается значительно лучше.

Проблема на форуме? Сначала посмотрите лог ошибок вашего форума и лог ошибок сайта (error_log)

You can try other modifications - see demo

Online emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,900
  • Gender: Male
  • Because Orange is Orange
Re: HTML-layout error in GenericList.template.php
« Reply #1 on: February 15, 2012, 03:20:20 PM »
Hi maestrosite.ru,

thank you for the report.

The first one is for sure a bug.

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Online emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,900
  • Gender: Male
  • Because Orange is Orange
Re: HTML-layout error in GenericList.template.php
« Reply #2 on: June 28, 2012, 05:34:18 AM »
The second is an assumption in the code (i.e. the code assume the list exists)...maybe some kind of warning if it doesn't?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline maestrosite.ru

  • Semi-Newbie
  • *
  • Posts: 93
    • Сопровождение и модификация форумов SMF
Re: HTML-layout error in GenericList.template.php
« Reply #3 on: June 28, 2012, 07:41:56 AM »
Sorry, i dont understabd your thought
First of all, sorry for my english. По-русски у меня получается значительно лучше.

Проблема на форуме? Сначала посмотрите лог ошибок вашего форума и лог ошибок сайта (error_log)

You can try other modifications - see demo

Online emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,900
  • Gender: Male
  • Because Orange is Orange
Re: HTML-layout error in GenericList.template.php
« Reply #4 on: June 28, 2012, 08:17:49 AM »
Sorry, I was thinking to another issue and the sentence is not very clear.

I mean that the current code does an assumption: the list exists.
And I agree it's not correct, at least it's not in line with (most of) the other the code in SMF.
What I'm wondering is: is it better to just "return;" or maybe create a sort of error like: "the list doesn't exist"?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline maestrosite.ru

  • Semi-Newbie
  • *
  • Posts: 93
    • Сопровождение и модификация форумов SMF
Re: HTML-layout error in GenericList.template.php
« Reply #5 on: June 28, 2012, 08:38:16 AM »
Of course, better is show error! I'm wrote code only for example.
(And I think best - throw Exception, but is not SMF-way)
First of all, sorry for my english. По-русски у меня получается значительно лучше.

Проблема на форуме? Сначала посмотрите лог ошибок вашего форума и лог ошибок сайта (error_log)

You can try other modifications - see demo