Broken table when supposed to work
So I have this code that shows top15 players on the server, and while it works like a charm, I have issue with the HTML part of the code. Table's width is not 100%, and I have tried like 100 times to fix that and it simply won't work. Does anyone at least know what the issue here is and what should I try to do next?
PHP Code:
|
Re: Broken table when supposed to work
1. You have no </td>'s or </tr>'s
2. You can eliminate the SQL_FieldNameToNum() native calls by passing the column number directly to SQL_ReadResult(). 3. You can replace formatex() with copy() on your first 5 formatex()'s. Try this PHP Code:
|
Re: Broken table when supposed to work
I manually created the HTML that you're generating with your code and it renders perfectly in the Counter-Strike motd.txt. It takes up the whole width of the MOTD window. I tried it both with and without all the newline characters and it looked perfect either way.
HTML Code:
<!DOCTYPE html><html>@Bugsy, it looks like it's able to properly render without all the closing tags as shown above. In fact, it looks like adding all the closing tags for tr and td will actually cause this to go over the 1536 character limit. Also, note that the MOTD is limited to 1536 characters so you can declare gMotd[1537] instead of using 2048. |
Re: Broken table when supposed to work
In case this can help: https://smallseotools.com/minify-html/
|
Re: Broken table when supposed to work
Quote:
|
Re: Broken table when supposed to work
Quote:
In this case, the meta tags go be removed also. |
Re: Broken table when supposed to work
For some weird reason, width: 100% in .was the problem. When motd was printed it was printed without % (meaning, only width: 100 was printed) The solution to this is to add two percentage signs, like this: width 100%% and now it works like a charm. I also added missing </td> and </tr>'s
Full working code: PHP Code:
|
Re: Broken table when supposed to work
Ah, yeah, I totally forgot about that. Great job finding that.
With all the closing tags, are you not going over the 1536 limit? If yes, you can save some characters by removing the meta tags. |
Re: Broken table when supposed to work
First thing that I have changed is that I removed css style, and added link to the same style I uploaded to my website.
I wasn't going over that limit, because total characters number was 1220 (With all current nickanmes, kills and deaths included), BUT I have done some calculations and realised that if I have all 15 players with long nicknames (33 characters long), I would go over that limit. So what I did, is checked output results again, and saw too many spaces in the html code. Then, after adding this PHP Code:
So now, even if all players have nickanes of 33 characters (495 in total), and all of them have 99,999 kills and 99,999 deaths, the total number of characters would be 645. If we add 850 to that, which is characters count of table, without names, kills, and deaths, the total number will be 1,495. So problem solved. |
Re: Broken table when supposed to work
How is " </td>" (the 2 spaces preceding </td>) ending up in your HTML to begin with? Your formatex()'s do not have spaces like that. I recommend fixing the formatting instead of calling replace, if possible.
|
| All times are GMT -4. The time now is 20:26. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.