Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules
Author Message
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm



Joined: Aug 13, 2009
Posts: 1123

PostPosted: Mon Sep 30, 2013 8:03 am Reply with quote

Guys!

Now I understand how painful can be to convert one old module in order to work with RavenNuke. I think it is much better to make a new one but sometimes we do not have the knowledge or to make time for it. I want you to know I've been spending hours of my free time to make it work.

This is just the index.php of Multiheadlines Module. I've trying to validate the whole file but I am getting an irritant warning I can't get rid of bit. I would like to know how to fix it since I don't see it myself. It is just 2 warning. I checked the file 5 times and I can not find it.


Code:


Error: line 705 column 1861 - Warning: missing <tr>
line 707 column 1472 - Warning: missing <tr>


http://validator.w3.org/check?uri=http%3a%2f%2fwww.bestbuildpc.org%2f

I do know it is a small thing but I do want to know how to find this warning.


Last edited by hicuxunicorniobestbuildpc on Sun Oct 05, 2014 10:23 am; edited 3 times in total 
View user's profile Send private message
wHiTeHaT
Life Cycles Becoming CPU Cycles



Joined: Jul 18, 2004
Posts: 579

PostPosted: Mon Sep 30, 2013 11:27 am Reply with quote

I think you have a missing tr







Sorry.... i could not resist.
 
View user's profile Send private message Send e-mail
hicuxunicorniobestbuildpc







PostPosted: Mon Sep 30, 2013 4:38 pm Reply with quote

I know that whitehat but I can not see where I have to insert it. That is why I posted here the whole index.php.
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Mon Sep 30, 2013 5:28 pm Reply with quote

If I had to guess it's somewhere function constrtable is called. line 404-407 looks suspect.... but that code is really hard to read with all the single quotes converted to entities.

Since you are taking the time to update this, you should probably make it html5 ready if you plan on using our upcoming version. That means no width, cellpadding, cellspacing, valign, border, and so forth on tables; using CSS to style instead... Or even better use a CSS grid instead of tables for layouts. We will be using Bootstrap 3 (BS3) in the upcoming distro:

http://getbootstrap.com/css/#tables
http://getbootstrap.com/css/#grid

I wouldn't use the full BS3 package with an phpnuke theme, but you can customize the download with only the components you want to use.
http://getbootstrap.com/customize/
 
View user's profile Send private message Visit poster's website
hicuxunicorniobestbuildpc







PostPosted: Tue Oct 01, 2013 1:19 am Reply with quote

Sorry for the hard code spasticdonkey

Here I have a better one

www.bestbuildpc.org/Multiheadlines.7z
 
spasticdonkey







PostPosted: Tue Oct 01, 2013 7:04 am Reply with quote

At a quick glance I don't see it, although there are functions defined outside of that file, where the issue may be coming from. Check for any functions that open a table and look for when they are called through out the script.
 
hicuxunicorniobestbuildpc







PostPosted: Tue Oct 01, 2013 7:49 am Reply with quote

That is why I can not find it. If the file could be in html or apart from those function, believe me I will find it asap but I checked every function I can not get it. Grrrr
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Tue Oct 01, 2013 3:47 pm Reply with quote

The only option left then is to find the instances of td width="50% and change them one at a time to 60% an then run the validator again until you find the right one.
 
View user's profile Send private message Send e-mail
hicuxunicorniobestbuildpc







PostPosted: Tue Oct 01, 2013 4:08 pm Reply with quote

Guardian, That is the funny thing I did look for that number if you see the index.php then u realize there isn't any 50%. Sad
 
Guardian2003







PostPosted: Wed Oct 02, 2013 2:19 am Reply with quote

It's in line 506 of the vieweed sorce code for the page, although the validator says line 508. If it is not in the actual code, then it muct be being generated by the feed itself so you could try turning of the yahoo feed and see if it's still there.
 
hicuxunicorniobestbuildpc







PostPosted: Wed Oct 02, 2013 5:07 am Reply with quote

I changed it to another feed and it is giving the same problem.

This is an example

Code:
  $sql = 'SELECT * FROM `' . $prefix . '_multiheadlines_news` WHERE `news_cat` = \'' . intval($cat) . '\' AND `news_active` = 1 ' . $string . ' LIMIT ' . (($page-1)*$conf['nr_news_cat']) . ', ' . ($page*$conf['nr_news_cat']) . '';

  $result = $db->sql_query($sql);
  $k=($page-1)*$conf['nr_news_cat']+1;
  echo '<table width="100%" border="0">';
  $catcolbrowse = $db->sql_fetchrow($db->sql_query('SELECT * FROM `' . $prefix . '_multiheadlines_categ` WHERE `categ_id` = \'' . intval($cat) . '\''));
  $w=floor(100/$catcolbrowse["categ_numcolbrowse"]).'%';
  echo '<tr>';
  while (($row = $db->sql_fetchrow($result)) && (($k > ($page-1)*$conf['nr_news_cat']) && $k <= ($page*$conf['nr_news_cat']))){
    echo '<td width="' . $w . '" valign="top">';
    $row1 = $db->sql_fetchrow($db->sql_query('SELECT * FROM `' . $prefix . '_multiheadlines_urls` WHERE `urls_active` = 1 AND `urls_id` = \'' . intval($row['news_site']) . '\''));
    $image=$row1['urls_image'];
    echo constrtable($conf['showindex'], $conf['showlogo'], $k, $row['news_link'], $row['news_title'], $row['news_description'], $row['news_id'], $row['news_pubdate'], $image, $row1['urls_site'], $row['news_status']);
    if (is_int($k/$catcolbrowse['categ_numcolbrowse'])) {
      echo '</td>';
    } else {
      echo '<tr>';
      if   ($k==$news) {
        if (!(is_int($k/$catcolbrowse['categ_numcolbrowse']))) {
          if (is_int(($k+1)/$catcolbrowse['categ_numcolbrowse'])) {
            echo '<td>&nbsp;</td>';
          } elseif (is_int($k+2/$catcolbrowse['categ_numcolbrowse'])) {
            echo '<td>&nbsp;</td><td>&nbsp;</td>';
          } elseif (is_int($k+3/$catcolbrowse['categ_numcolbrowse'])) {
            echo '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
          } elseif (is_int($k+4/$catcolbrowse['categ_numcolbrowse'])) {
            echo '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
          }
        }
      }
    }
    $k++;
  }


This line could be the issue but I am not sure.

Code:
echo '<td width="' . $w . '" valign="top">';
Sad
 
spasticdonkey







PostPosted: Thu Oct 03, 2013 4:26 pm Reply with quote

try changing that line to:
Code:
echo '<td width="' . $w . '" valign="top">IT IS HERE!!!!!';

and see if "IT IS HERE!!!!!" is inserted next to your validation problem. if not remove and try it in some other areas. crude yet it has saved me in the past when I can't find where a given error is occurring
 
hicuxunicorniobestbuildpc







PostPosted: Fri Oct 04, 2013 2:11 am Reply with quote

I thought you forgot me!!! In fact! I just wake up and I look like a warning hunter trying to find out where it comes from. Unfortunately, I didn't find it yet. I did so many test step by step and no SOLUTION. I still get the 2 warning error.

I did something like this

Code:
Lines 404


echo '<td width="' . $w . '" valign="top"><tr>';//test1

I saved it and it didn't work. I edited it again and remove tr again

echo '<td width="' . $w . '" valign="top"><tr>';//test1 didn't work.


and so on with all I have and still the same. I think this is the most difficult warning error I ever had since this is table inside another table where create a row but I will never understand such a mess.
Sad

Note: I hope from now if someone is going to make a new module or block for RavenNuke follow the best efficient code. This module is a disaster. I spent hours converting. I almost finish converting but I am stuck with this issue and I can not live with it!!! Grrr

Can u explain this part please. I can not understand this one.

Code:
  echo '<table width="100%">';

  if ($cat["categ_image"]=='0'){
    echo '<tr><td align="center"><b>' , _MH_CAT , $cat['categ_title'] . '</b></td></tr>';
  } else {
    echo '<tr><td align="center"><img src="modules/' , $module_name , '/images/categories/' , $cat['categ_image'] . '" border="0" width="90" height="30"  alt="' , $cat['categ_title'].'"><br /><b>Category: ' , $cat['categ_title'] . '</b></td></tr>';
  }
  echo '  <tr><td><b>' , _MH_DESCR , ':</b> ' , $descript , '</td></tr>
          <tr><td align="center"><b>' , _MH_SUBCAT , '</b> ' , $nr_subcats , '</td></tr>';
  if ($nr_subcats <> '0'){
    echo   '<tr><td>
                  <table width="100%"><tr>';
    $sql='SELECT * FROM `' . $prefix . '_multiheadlines_categ` WHERE `parent` = \'' . intval($cat['categ_id']) . '\' ORDER BY `categ_title` ASC';
    $result = $db->sql_query($sql);
    $c=1;
    while ($subcat = $db->sql_fetchrow($result)){
      if ($subcat['categ_image']=='0') {
        echo '<td width="' . $width . '" align="center"><a href="modules.php?name=' . $module_name . '&amp;rss=ShowNews&amp;cat=' . $subcat['categ_id'] . '">' . $subcat['categ_title'] . '</a></td>';
      } else {
        echo '<td width="' . $width . '" align="center"><a href="modules.php?name=' . $module_name . '&amp;rss=ShowNews&amp;cat=' . $subcat['categ_id'] . '"><img src="modules/' . $module_name . '/images/categories/' . $subcat['categ_image'] . '" border="0" width="60" height="20" alt="' . $subcat['categ_title'] . '" /><br />' . $subcat['categ_title'] . '</a></td>';
      }
      if ($c >= $conf['nr_cols']){
        echo '</tr><tr>';
        $c=0;
      }
      $c++;
    }
    echo '</tr></table></td></tr>';

  }


This line I don't understand since there is a closing tr or td and then it opens a table again. terrible.

Code:
    echo   '<tr><td>

                  <table width="100%"><tr>';
 
Guardian2003







PostPosted: Fri Oct 04, 2013 7:00 am Reply with quote

Looks like a classic case of nesting tables inside another tables cell. This is one of the reaons why tables are so difficult to manage even though they are appropriate in some use case scenraio's.

Looking at you testing code, it looks like you commented out the 'test1' so it wouldn't show on the page or in the source any way.

Why not try simply removing $w and replacing it with a hard value like 75px
 
hicuxunicorniobestbuildpc







PostPosted: Fri Oct 04, 2013 8:46 am Reply with quote

if I do that then I get 12 warning error Guardian
 
hicuxunicorniobestbuildpc







PostPosted: Wed Oct 09, 2013 11:00 am Reply with quote

Finally I found out where the problem was. It was difficult to find it but nothing is impossible.

I found this

Code:


        echo '</td></tr>';
      } else {
       echo '</td>';


I replaced it with this one

Code:
        echo '</td></tr><tr>';

      } else {
       echo '</td>';


Note: At least I have the first page of news validated 100%. When I go to the second page I got 1 warning saying line 577 column 1893 - Warning: missing <td>

Code:
here: http://www.bestbuildpc.org/modules.php?name=Multiheadlines&rss=ShowNewsHome&page=2


Thanks for all people who are/were interesting in solving validation/warning errors.
 
hicuxunicorniobestbuildpc







PostPosted: Fri Jan 03, 2014 8:40 am Reply with quote

Guys! I am getting an error in dblog

Code:
January 3, 2014, 2:53 pm File: htdocs/www.bestbuildpc.org/db/mysqli.php - Line: 201

Code: 1064 - Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-44755, -44750' at line 1
SQL was: SELECT * FROM `nuke_multiheadlines_news` ORDER BY `news_status` ASC, `news_pubdate` DESC LIMIT -44755, -44750
 remote addr: 66.249.76.184


I checked my index.php and I can not find any error on my Multiheadlines.

This is my index.php. I think could be a space but I tried already several ways and I still get the same error.

http://www.bestbuildpc.org/bugfiles/index.txt

I guess it is from this part but I don't see any problem.

Code:
if ($conf['home_cat']=='0') {

    $wherestring='';
  } else {
    $wherestring = 'WHERE `news_cat` = \'' . intval($cat) . '\' AND `news_active` = 1';
  }
  if ($conf['ordhome']=='1'){
    $string = 'ORDER BY `news_status` ASC, `news_pubdate` DESC';
  } elseif ($conf['ordhome']=='2'){
    $string = 'ORDER BY `news_status` ASC, `news_title` ASC';
  } elseif ($conf['ordhome']=='3'){
    $string = 'ORDER BY `news_status` ASC, `news_site` ASC';
  }
  $news = $db->sql_numrows($db->sql_query('SELECT * FROM `' . $prefix . '_multiheadlines_news`' . $wherestring));
  if ($news!==0) {
    OpenTable();
    $sql = 'SELECT * FROM `' . $prefix . '_multiheadlines_news`' . $wherestring . ' ' . $string . ' LIMIT ' . (($page-1)*$conf['nr_news']) . ', ' . ($page*$conf['nr_news']);
    $result = $db->sql_query($sql);
    $k=($page-1)*$conf['nr_news']+1;
    $w=floor(100/($conf['nrcol_home'])) . '%';
    echo '<table width="100%" border="0">
          <tr>';
    while (($row = $db->sql_fetchrow($result)) && (($k > ($page-1)*$conf['nr_news']) && $k <= ($page*$conf['nr_news']))){
      echo '<td width="' , $w , '" valign="top">';
      $row1 = $db->sql_fetchrow($db->sql_query('SELECT * FROM `' . $prefix . '_multiheadlines_urls` WHERE `urls_active` = 1 AND `urls_id` = \'' . intval($row['news_site']) . '\''));
      $image=$row1['urls_image'];
      echo constrtable($conf['showindex'], $conf['showlogo'], $k, $row['news_link'], $row['news_title'], $row['news_description'], $row['news_id'], $row['news_pubdate'], $image, $row1['urls_site'], $row['news_status']);
      if (is_int($k/$conf['nrcol_home'])) {
 
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1775

PostPosted: Fri Jan 03, 2014 9:12 am Reply with quote

Quote:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version...


Not sure but it could be an typo error in your SQL syntax Smile

try:

php Code:
$sql = 'SELECT * FROM `' . $prefix . '_multiheadlines_news`' . $wherestring . ' ' . $string . ' LIMIT ' . (($page-1)*$conf['nr_news']) . ', ' . ($page*$conf['nr_news']) . '';


instead of:

php Code:
$sql = 'SELECT * FROM `' . $prefix . '_multiheadlines_news`' . $wherestring . ' ' . $string . ' LIMIT ' . (($page-1)*$conf['nr_news']) . ', ' . ($page*$conf['nr_news']);

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message
hicuxunicorniobestbuildpc







PostPosted: Fri Jan 03, 2014 10:25 am Reply with quote

That has sense!! You again!!! Very Happy I didn't get any error yet. I will see later. Thanks for replying.
 
hicuxunicorniobestbuildpc







PostPosted: Fri Jan 03, 2014 6:26 pm Reply with quote

Neralex, Unfortunately the error came back again.

January 3, 2014, 11:01 pm File: /www.bestbuildpc.org/db/mysqli.php - Line: 201
Code: 1064 - Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-8320, -8315' at line 1
SQL was: SELECT * FROM `nuke_multiheadlines_news` ORDER BY `news_status` ASC, `news_pubdate` DESC LIMIT -8320, -8315
remote addr: 66.249.76.184

I wonder where should be the problem. I updated the index.txt again with your mod but I still get the same error. I am gonna take a look line by line again. Grrr!!!
Bang Head
 
neralex







PostPosted: Sat Jan 04, 2014 8:34 am Reply with quote

Deinstall the module and all errors are gone! Smile
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Jan 05, 2014 8:18 pm Reply with quote

All the documentation I see says LIMIT must only use non-negative values. When/Where did that change?
 
View user's profile Send private message
hicuxunicorniobestbuildpc







PostPosted: Mon Jan 06, 2014 4:23 pm Reply with quote

Hi Raven,

It doesn't matter what I change or modify. It is crazy this module. Now I am getting the same error. I did what neralex says it looks like that was the problem but now I checked again the log and I get this:

Code:
January 5, 2014, 10:18 pm File: /www.bestbuildpc.org/db/mysqli.php - Line: 201

Code: 1064 - Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-8200, -8195' at line 1
SQL was: SELECT * FROM `nuke_multiheadlines_news` ORDER BY `news_status` ASC, `news_pubdate` DESC LIMIT -8200, -8195
 remote addr: 66.249.76.184
January 5, 2014, 10:35 pm File: /www.bestbuildpc.org/db/mysqli.php - Line: 201
Code: 1064 - Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-8195, -8190' at line 1
SQL was: SELECT * FROM `nuke_multiheadlines_news` ORDER BY `news_status` ASC, `news_pubdate` DESC LIMIT -8195, -8190
 remote addr: 66.249.76.184
January 6, 2014, 4:55 am File: /www.bestbuildpc.org/db/mysqli.php - Line: 201
Code: 1064 - Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-8205, -8200' at line 1
SQL was: SELECT * FROM `nuke_multiheadlines_news` ORDER BY `news_status` ASC, `news_pubdate` DESC LIMIT -8205, -8200
 remote addr: 66.249.76.184


What am I doing wrong?

I updated the index.php, u can see it here. Can anybody tell me what it is going on?

http://www.bestbuildpc.org/bugfiles/index.txt

Quote:
Deinstall the module and all errors are gone!


Rolling Eyes I didn't know u give up so easy neralex! Actually the module is working properly but this message means something is going wrong but hard to find. I wish I could know what it is and maybe it is interesting for other. Who knows.
 
Raven







PostPosted: Mon Jan 06, 2014 8:48 pm Reply with quote

Regardless, according to what I read at mysql.com, you can't have negative values in a LIMIT clause.
 
Raven







PostPosted: Mon Jan 06, 2014 9:32 pm Reply with quote

Also, when debugging you should correct syntax errors whenever you find them because a syntax error will usually hide other errors. So, start by fixing the negtative values in your LIMIT clause and then go from there.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©