• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[HTML/Web Problem] Creating Latest News problem

lokatylokacz

New Member
Joined
Feb 26, 2011
Messages
58
Solutions
2
Reaction score
4
Location
P(r)oland
Hey,
when I create Latest News on main OTS web it create crazy big "space" in the beginning of each post if I use HTML code editor.
After submit: https://imgur.com/6asbbEg
In editor b4 submit: https://imgur.com/SCNYD6v

In editor it looks great but after submit idk... and it happens just if I use HTML, if there is clean text np there is no crazy space. I can make just clean table in html and got this free lines ...

There is no problems with HTML code cause I try many examples, if you wanna that html it's here:
HTML:
<table border="1" style="width:90%;margin-left:auto;margin-right:auto"><tbody><tr class="NewsHeadlineBackground" style="background-image:url(./layouts/tibiacom/images/news/newsheadline_background.gif)"><td colspan="2" style="color:white;font-weight:bold"><center>Experience/Skill Rates</center></td></tr><tr bgcolor="#F1E0C6"><td style="font-weight:bold;">Exp rate</td><td>8 - 29 level, 60x<br>30 - 49 level, 50x<br>50 - 74 level, 35x<br>75 - 94 level, 20x<br>95 - 119 level, 15x<br>120 - 149 level, 10x<br>150 - 199 level, 5x<br>200 - 299 level, 3x<br> 300 + level, 2x<br></td></tr><tr bgcolor="#D4C0A1"><td style="font-weight:bold;">Melee rate</td><td>30x</td></tr><tr bgcolor="#F1E0C6"><td style="font-weight:bold;">Dist rate</td><td>30x</td></tr><tr bgcolor="#D4C0A1"><td style="font-weight:bold;">Magic rate</td><td>7x</td></tr><tr bgcolor="#F1E0C6"><td style="font-weight:bold;">Loot rate</td><td>3x</td></tr></tbody></table>
(HTML code isn't important at all, that's not the problem)

Even code like this make same problem
HTML:
<table style="height: 72px; width: 254px;" border="2" cellspacing="2" cellpadding="2">

<tbody>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>


Soft:
Windows 7 x64
TFS 1.2
Gesior acc 2012
UniServer
 
Solution
Ok, idk why I didn't do that earlier xD

http://pastebin.com/3WQfSN3u

Have you done any changes to that file before?
You got a bunch of code that isen't on the main repo.

Ex.
PHP:
if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action != 'newnews')
   {
       $main_content .= '
           <font style="font-size: 16px; font-weight: bold; margin-left: 20px;">Adding News</font>
           <form action="index.php?subtopic=latestnews&action=newnews" method="post" >
               <table border="0">
                   <tr>
                       <td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td>
                       <td>
                           <table border="0">...
Post your latest news PHP file, located in /pages/latestnews.php.
You most likely have a bunch of <br /> ' s in there before it loads the code from your database.
 
Post your latest news PHP file, located in /pages/latestnews.php.
You most likely have a bunch of <br /> ' s in there before it loads the code from your database.

PHP:
$tickerSql = $SQL->query("SELECT ");
//NEWSTICKER
$time = time();
$vTick = $SQL->query("SELECT " .$SQL->fieldName('date'). " FROM " .$SQL->tableName('z_news_tickers'). " WHERE " .$SQL->fieldName('hide_ticker'). " = '0'")->fetch();
if(isset($vTick['date'])){
$news_content .= '
    <div id="NewsTicker" class="Box">
        <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
        <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
        <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
        <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div>
        <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline" />
            <div class="Border_2">
                  <div class="Border_3">
                    <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
                    //##################### ADD NEW TICKER #####################
                    if($action == "newticker") {
                        if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
                            $ticker_text = stripslashes(trim($_POST['new_ticker']));
                            $ticker_icon = (int) $_POST['icon_id'];
                            if(empty($ticker_text)) {
                                $news_content .= 'You can\'t add empty ticker.';
                            }
                            else
                            {
                            if(empty($ticker_icon)) {
                                $news_icon = 0;
                            }
                    $SQL->query('INSERT INTO '.$SQL->tableName('z_news_tickers').' (date, author, image_id, text, hide_ticker) VALUES ('.$SQL->quote($time).', '.$account_logged->getId().', '.$ticker_icon.', '.$SQL->quote($ticker_text).', 0)');
                    $news_content .= '
                        <center>
                            <h2>
                                <font color="red">Added new ticker:</font>
                            </h2>
                        </center>
                        <hr/>
                        <div id="newsticker" class="Box">
                            <div id="TickerEntry-1" class="Row" onclick=\'TickerAction("TickerEntry-1")\'>
                                  <div class="Odd">
                                    <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
                                    <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
                                    <div class="NewsTickerText">
                                              <span class="NewsTickerDate">'.date("d/m/Y", $time).' -</span>
                                              <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">';
                    $news_content .= '
                        <a href="?subtopic=latestnews&action=deleteticker&id='.$time.'">
                            <img src="'.$layout_name.'/images/news/delete.png" border="0">
                        </a>';
                    $news_content .= short_text($ticker_text, 60).'</div>
                          <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
                    $news_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
                    $news_content .= $ticker_text.'
                        </div>
                    </div>
                  </div>
            </div>
        </div>
    <hr/>';
    }
}
else
{
    $news_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
}
    $news_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
}

Can't post full latestnews.php it's over 25000 symbols if that's not the fragment you need I will post full in 2-3 posts.
 
PHP:
$tickerSql = $SQL->query("SELECT ");
//NEWSTICKER
$time = time();
$vTick = $SQL->query("SELECT " .$SQL->fieldName('date'). " FROM " .$SQL->tableName('z_news_tickers'). " WHERE " .$SQL->fieldName('hide_ticker'). " = '0'")->fetch();
if(isset($vTick['date'])){
$news_content .= '
    <div id="NewsTicker" class="Box">
        <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
        <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
        <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
        <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div>
        <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline" />
            <div class="Border_2">
                  <div class="Border_3">
                    <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
                    //##################### ADD NEW TICKER #####################
                    if($action == "newticker") {
                        if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
                            $ticker_text = stripslashes(trim($_POST['new_ticker']));
                            $ticker_icon = (int) $_POST['icon_id'];
                            if(empty($ticker_text)) {
                                $news_content .= 'You can\'t add empty ticker.';
                            }
                            else
                            {
                            if(empty($ticker_icon)) {
                                $news_icon = 0;
                            }
                    $SQL->query('INSERT INTO '.$SQL->tableName('z_news_tickers').' (date, author, image_id, text, hide_ticker) VALUES ('.$SQL->quote($time).', '.$account_logged->getId().', '.$ticker_icon.', '.$SQL->quote($ticker_text).', 0)');
                    $news_content .= '
                        <center>
                            <h2>
                                <font color="red">Added new ticker:</font>
                            </h2>
                        </center>
                        <hr/>
                        <div id="newsticker" class="Box">
                            <div id="TickerEntry-1" class="Row" onclick=\'TickerAction("TickerEntry-1")\'>
                                  <div class="Odd">
                                    <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
                                    <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
                                    <div class="NewsTickerText">
                                              <span class="NewsTickerDate">'.date("d/m/Y", $time).' -</span>
                                              <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">';
                    $news_content .= '
                        <a href="?subtopic=latestnews&action=deleteticker&id='.$time.'">
                            <img src="'.$layout_name.'/images/news/delete.png" border="0">
                        </a>';
                    $news_content .= short_text($ticker_text, 60).'</div>
                          <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
                    $news_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
                    $news_content .= $ticker_text.'
                        </div>
                    </div>
                  </div>
            </div>
        </div>
    <hr/>';
    }
}
else
{
    $news_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
}
    $news_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
}

Can't post full latestnews.php it's over 25000 symbols if that's not the fragment you need I will post full in 2-3 posts.
Use pastebin to post scripts that reaches the limit.
 
Ok, idk why I didn't do that earlier xD

http://pastebin.com/3WQfSN3u

Have you done any changes to that file before?
You got a bunch of code that isen't on the main repo.

Ex.
PHP:
if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action != 'newnews')
   {
       $main_content .= '
           <font style="font-size: 16px; font-weight: bold; margin-left: 20px;">Adding News</font>
           <form action="index.php?subtopic=latestnews&action=newnews" method="post" >
               <table border="0">
                   <tr>
                       <td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td>
                       <td>
                           <table border="0">
                               <tr bgcolor="F1E0C6">
                                   <td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td>
                                   <td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td>
                                   <td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td>
                                   <td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td>
                                   <td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td>
                               </tr>
                               <tr bgcolor="D4C0A1">
                                   <td><input type="radio" name="icon_id" value="0" checked="checked"></td>
                                   <td><input type="radio" name="icon_id" value="1" /></td>
                                   <td><input type="radio" name="icon_id" value="2" /></td>
                                   <td><input type="radio" name="icon_id" value="3" /></td>
                                   <td><input type="radio" name="icon_id" value="4" /></td>
                               </tr>
                           </table>
                       </td>
                   </tr>
               <tr>
                   <td align="center" bgcolor="F1E0C6"><b>Topic:</b></td>
                   <td><input type="text" name="topic" maxlenght="50" style="width: 300px" ></td>
               </tr>
               <tr>
                   <td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td>';
               //Tiny Editor
               $main_content .= '
                   <script type="text/javascript" src="'.$layout_name.'/tiny_mce/tiny_mce.js"></script>
                   <script type="text/javascript">
                       tinyMCE.init({
                           // General options
                           mode : "textareas",
                           theme : "advanced",
                           plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
                  
                           // Theme options
                           theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
                           theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,link,unlink,anchor,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                           theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl",
                           theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
                           theme_advanced_toolbar_location : "top",
                           theme_advanced_toolbar_align : "left",
                           theme_advanced_statusbar_location : "bottom",
                           theme_advanced_resizing : true,
                  
                           // Example content CSS (should be your site CSS)
                           content_css : "css/content.css",
                  
                           // Drop lists for link/image/media/template dialogs
                           template_external_list_url : "lists/template_list.js",
                           external_link_list_url : "lists/link_list.js",
                           external_image_list_url : "lists/image_list.js",
                           media_external_list_url : "lists/media_list.js",
                  
                           // Style formats
                           style_formats : [
                               {title : \'Bold text\', inline : \'b\'},
                               {title : \'Red text\', inline : \'span\', styles : {color : \'#ff0000\'}},
                               {title : \'Red header\', block : \'h1\', styles : {color : \'#ff0000\'}},
                               {title : \'Example 1\', inline : \'span\', classes : \'example1\'},
                               {title : \'Example 2\', inline : \'span\', classes : \'example2\'},
                               {title : \'Table styles\'},
                               {title : \'Table row 1\', selector : \'tr\', classes : \'tablerow1\'}
                           ],
                  
                           // Replace values for the template plugin
                           template_replace_values : {
                               username : "Some User",
                               staffid : "991234"
                           }
                       });
                   </script>';
               $main_content .= '
                   <td bgcolor="F1E0C6">
                       <textarea name="text" id="elm1" rows="6" cols="60"></textarea>
                   </td>
               </tr>
               <tr>
                   <td width="180"><b>Character:</b></td>
                   <td>
                       <select name="char_id">
                          <option value="0">(Choose character)</option>';
                           foreach($account_logged->getPlayers() as $player)
                           {
                            $main_content .= '<option value="'.$player->getID().'">'.$player->getName().'</option>';
                           }      
                           $main_content .= '      
                         </select>
                   </td>
               </tr>
               <tr>
                   <td>
                       <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div>
                       <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" >
                   </div>
               </div>
           </form>
       </td>
   </tr>
</table>
<hr/>';

One thing you can try is this to replace the file with this; https://raw.githubusercontent.com/gesior/Gesior2012/TFS-1.0/pages/latestnews.php
 
Last edited by a moderator:
Solution
Have you done any changes to that file before?
You got a bunch of code that isen't on the main repo.

Ex.
PHP:
if($group_id_of_acc_logged >= $config['site']['access_admin_panel'] && $action != 'newnews')
   {
       $main_content .= '
           <font style="font-size: 16px; font-weight: bold; margin-left: 20px;">Adding News</font>
           <form action="index.php?subtopic=latestnews&action=newnews" method="post" >
               <table border="0">
                   <tr>
                       <td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td>
                       <td>
                           <table border="0">
                               <tr bgcolor="F1E0C6">
                                   <td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td>
                                   <td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td>
                                   <td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td>
                                   <td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td>
                                   <td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td>
                               </tr>
                               <tr bgcolor="D4C0A1">
                                   <td><input type="radio" name="icon_id" value="0" checked="checked"></td>
                                   <td><input type="radio" name="icon_id" value="1" /></td>
                                   <td><input type="radio" name="icon_id" value="2" /></td>
                                   <td><input type="radio" name="icon_id" value="3" /></td>
                                   <td><input type="radio" name="icon_id" value="4" /></td>
                               </tr>
                           </table>
                       </td>
                   </tr>
               <tr>
                   <td align="center" bgcolor="F1E0C6"><b>Topic:</b></td>
                   <td><input type="text" name="topic" maxlenght="50" style="width: 300px" ></td>
               </tr>
               <tr>
                   <td align="center" bgcolor="D4C0A1"><b>News<br>text:</b></td>';
               //Tiny Editor
               $main_content .= '
                   <script type="text/javascript" src="'.$layout_name.'/tiny_mce/tiny_mce.js"></script>
                   <script type="text/javascript">
                       tinyMCE.init({
                           // General options
                           mode : "textareas",
                           theme : "advanced",
                           plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
                 
                           // Theme options
                           theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
                           theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,link,unlink,anchor,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
                           theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl",
                           theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
                           theme_advanced_toolbar_location : "top",
                           theme_advanced_toolbar_align : "left",
                           theme_advanced_statusbar_location : "bottom",
                           theme_advanced_resizing : true,
                 
                           // Example content CSS (should be your site CSS)
                           content_css : "css/content.css",
                 
                           // Drop lists for link/image/media/template dialogs
                           template_external_list_url : "lists/template_list.js",
                           external_link_list_url : "lists/link_list.js",
                           external_image_list_url : "lists/image_list.js",
                           media_external_list_url : "lists/media_list.js",
                 
                           // Style formats
                           style_formats : [
                               {title : \'Bold text\', inline : \'b\'},
                               {title : \'Red text\', inline : \'span\', styles : {color : \'#ff0000\'}},
                               {title : \'Red header\', block : \'h1\', styles : {color : \'#ff0000\'}},
                               {title : \'Example 1\', inline : \'span\', classes : \'example1\'},
                               {title : \'Example 2\', inline : \'span\', classes : \'example2\'},
                               {title : \'Table styles\'},
                               {title : \'Table row 1\', selector : \'tr\', classes : \'tablerow1\'}
                           ],
                 
                           // Replace values for the template plugin
                           template_replace_values : {
                               username : "Some User",
                               staffid : "991234"
                           }
                       });
                   </script>';
               $main_content .= '
                   <td bgcolor="F1E0C6">
                       <textarea name="text" id="elm1" rows="6" cols="60"></textarea>
                   </td>
               </tr>
               <tr>
                   <td width="180"><b>Character:</b></td>
                   <td>
                       <select name="char_id">
                          <option value="0">(Choose character)</option>';
                           foreach($account_logged->getPlayers() as $player)
                           {
                            $main_content .= '<option value="'.$player->getID().'">'.$player->getName().'</option>';
                           }     
                           $main_content .= '     
                         </select>
                   </td>
               </tr>
               <tr>
                   <td>
                       <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div>
                       <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" >
                   </div>
               </div>
           </form>
       </td>
   </tr>
</table>
<hr/>';

One thing you can try is this to replace the file with this; https://raw.githubusercontent.com/gesior/Gesior2012/TFS-1.0/pages/latestnews.php

Yes, I made some changes but I will try clean letestnews.php and will add my trash ;)
thx
 
Back
Top