Ir para conteúdo
Entre para seguir isso  
Eratsu

[Gesior AAC] Scrolling Tickers

Recommended Posts

Eratsu    37
Eratsu

[Gesior AAC] Scrolling Newsticker Feature

Autor:Cybermaster Versão: 0.1

Retirado: OtLand

 

mrz14i.jpg

 

Informações:

javascript: Mioplanet.com

Coding: PHP+XHTML+JAVASCRIPT

Rev: 0.1

 

Instalação:

Adicione uma nova tabela ao banco de dados.

 

MySQL:

CREATE TABLE `z_scrolling_news` (   `id` int(11) NOT NULL auto_increment,   `header` varchar(255),   `header_color` varchar(255),   `header_bgcolor` varchar(255),   `text` text COMMENT '© Cybermaster OTland.net',   `text_bgcolor` varchar(255),   PRIMARY KEY (`id`) ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;  INSERT INTO `z_scrolling_news` (`id`, `header`, `header_color`, `header_bgcolor`, `text`, `text_bgcolor`) VALUES (NULL, 'Example', 'blue', 'yellow', 'This a test script. If you see the words scrolling from right to left then the script is working fine. Script by Cybermaster -OTland.net', 'white');  INSERT INTO `z_scrolling_news` (`id`, `header`, `header_color`, `header_bgcolor`, `text`, `text_bgcolor`) VALUES (NULL, 'Example No. 2', 'red', 'orange', 'Again, a noob example. Now you see another ticker coming after the first one. Script by Cybermaster -OTland.net', 'lightgreen');  INSERT INTO `z_scrolling_news` (`id`, `header`, `header_color`, `header_bgcolor`, `text`, `text_bgcolor`) VALUES (NULL, 'Yet another one', 'blue', 'yellow', 'Already had enough? Now with another ticker you might find useful to add many tickers at once, so players will read the scrolling newsticker more closely. Script by Cybermaster -OTland.net', 'aqua');

SQLITE:

CREATE TABLE "z_scrolling_news" (   "id" int(11) NOT NULL auto_increment,   "header" varchar(255),   "header_color" varchar(255),   "header_bgcolor" varchar(255),   "text" text COMMENT '© Cybermaster OTland.net',   "text_bgcolor" varchar(255),   PRIMARY KEY ("id") ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;  INSERT INTO "z_scrolling_news" ("id", "header", "header_color", "header_bgcolor", "text", "text_bgcolor") VALUES (NULL, 'Example', 'blue', 'yellow', 'This a test script. If you see the words scrolling from right to left then the script is working fine. Script by Cybermaster -OTland.net', 'white');  INSERT INTO "z_scrolling_news" ("id", "header", "header_color", "header_bgcolor", "text", "text_bgcolor") VALUES (NULL, 'Example No. 2', 'red', 'orange', 'Again, a noob example. Now you see another ticker coming after the first one. Script by Cybermaster -OTland.net', 'lightgreen');  INSERT INTO "z_scrolling_news" ("id", "header", "header_color", "header_bgcolor", "text", "text_bgcolor") VALUES (NULL, 'Yet another one', 'blue', 'yellow', 'Already had enough? Now with another ticker you might find useful to add many tickers at once, so players will read the scrolling newsticker more closely. Script by Cybermaster -OTland.net', 'aqua');

Crie um arquivo JavaScript em htdocs/scrolling_newsticker.js.

CREATE TABLE "z_scrolling_news" (   "id" int(11) NOT NULL auto_increment,   "header" varchar(255),   "header_color" varchar(255),   "header_bgcolor" varchar(255),   "text" text COMMENT '© Cybermaster OTland.net',   "text_bgcolor" varchar(255),   PRIMARY KEY ("id") ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;  INSERT INTO "z_scrolling_news" ("id", "header", "header_color", "header_bgcolor", "text", "text_bgcolor") VALUES (NULL, 'Example', 'blue', 'yellow', 'This a test script. If you see the words scrolling from right to left then the script is working fine. Script by Cybermaster -OTland.net', 'white');  INSERT INTO "z_scrolling_news" ("id", "header", "header_color", "header_bgcolor", "text", "text_bgcolor") VALUES (NULL, 'Example No. 2', 'red', 'orange', 'Again, a noob example. Now you see another ticker coming after the first one. Script by Cybermaster -OTland.net', 'lightgreen');  INSERT INTO "z_scrolling_news" ("id", "header", "header_color", "header_bgcolor", "text", "text_bgcolor") VALUES (NULL, 'Yet another one', 'blue', 'yellow', 'Already had enough? Now with another ticker you might find useful to add many tickers at once, so players will read the scrolling newsticker more closely. Script by Cybermaster -OTland.net', 'aqua');

Adicione ao htdocs/index.php

case "scrollnews"; 
             $topic = "Scroll News"; 
            $subtopic = "scrollnews"; 
            include("scrollnews.php"); 
   break;  

Adicione um novo arquivo php, htdocs/scrollnews.php

<?PHP 
/**************************************** 
||   SCROLLNEWS FEATURE © Cybermaster  || 
||    * * * * * * OTland.net    * * * * * * || 
||* * * * * * * * * * * * * * * * * * *|| 
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 

if($action == "edit_ticker") { 
   if($logged && $group_id_of_acc_logged >= $config['site']['access_admin_panel']) { 
       $main_content .= '<h2>SCROLLNEWS CONTROL PANEL</h2><hr /><br/>'; 
       $header = htmlspecialchars(stripslashes(substr(trim($_POST['header']),0,2000))); 
       $header_color = htmlspecialchars(stripslashes(substr(trim($_POST['header_color']),0,2000))); 
       $header_bgcolor = htmlspecialchars(stripslashes(substr(trim($_POST['header_bgcolor']),0,2000))); 
       $text = htmlspecialchars(stripslashes(substr(trim($_POST['text']),0,2000))); 
       $text_bgcolor = htmlspecialchars(stripslashes(substr(trim($_POST['text_bgcolor']),0,2000))); 

   if($_POST['updateticker'] == 1 && $logged && $group_id_of_acc_logged >= $config['site']['access_admin_panel']) {     
       $SQL->query("INSERT INTO `z_scrolling_news` (`id`, `header`, `header_color`, `header_bgcolor`, `text`, `text_bgcolor`) VALUES (NULL, '".$header."', '".$header_color."', '".$header_bgcolor."', '".$text."', '".$text_bgcolor."')");                 
       $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Added New Ticker</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Your news ticker has been published.</td></tr>          </table>        </div>  </table></div></td></tr><br><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=scrollnews&action=edit_ticker" method="post" ><tr><td style="border:0px;" ><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" ><br/></div></div></td></tr></form></table></center>'; 
       } 
   else 
       {     
   $main_content .= '<form action="?subtopic=scrollnews&action=edit_ticker" method=post><div class="TableContainer"><table class="Table1" cellpadding="0" cellspacing="0" ><div class="CaptionContainer" >      <div class="CaptionInnerContainer" >      <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span><span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span><span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >[+] Add a ticker</div>       <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></span>  <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></span>   </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td class="LabelV" >Ticker Title:</td><td style="width:100%;" ><input name="header" value="" size="30" maxlength="50" ></td></tr><tr><td class="LabelV" ><a href="http://www.w3schools.com/HTML/html_colornames.asp">Title Font Color:</a></td><td style="width:100%;" ><input name="header_color" value="" size="15" maxlength="30" > ex. orange, aqua, #F0F8FF</td></tr>    <tr><td class="LabelV" ><a href="http://www.w3schools.com/HTML/html_colornames.asp">Title BG Color:</a></td><td style="width:100%;" ><input name="header_bgcolor" value="" size="15" maxlength="30" ></td></tr><td class="LabelV" ><span>Ticker Text:</span></td><td style="width:100%;"><textarea name="text" rows="6" cols="45" wrap="virtual"></textarea></td></tr>    <tr><td class="LabelV" ><a href="http://www.w3schools.com/HTML/html_colornames.asp">Ticker Text BGColor:</a></td><td><input name="text_bgcolor" value="" size="15" maxlength="30" ></td></tr></table>        </div>  </table></div></td></tr><table width="100%"><tr align="center"><td><table border="0" cellspacing="0" cellpadding="0" >    <tr><td style="border:0px;" ><input type="hidden" name="updateticker" value="1" >    <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></td>    <tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ></table></td></tr></table>'; 
       } 

   $news = $SQL->query('SELECT * FROM `z_scrolling_news` ORDER BY `id`;'); 
   $main_content .= '<br/><h2>[-] Delete a ticker</h2><br/><div style="height:200px;width:530px;font:12px/16px Georgia, Garamond, Serif;overflow:scroll;"><table width="100%" border="0" cellpadding="0" cellspacing="1"><tr bgcolor="'.$config['site']['vdarkborder'].'" align="left"><td><strong><span style="color:white;">ID</span></strong></td><td align="center"><span style="color:white;"><strong>Header</strong></span></td><td align="center"><span style="color:white;"><strong>Text</strong></span></td><td align="center"><span style="color:white;"><strong>Action</strong></span></td></tr>'; 

   foreach ($news as $ticker)  
   {$order++; 
       if(is_int($order / 2)) $bgcolor = $config['site']['darkborder']; else $bgcolor = $config['site']['lightborder']; 
       $text = $ticker['text'];  
       $header = $ticker['header']; 
       if (strlen($text) > 50) $text = substr($text, 0, strrpos(substr($text, 0, 50), ' ')) . '...'; 
       if (strlen($header) > 15) $header = substr($header, 0, strrpos(substr($header, 0, 15), ' ')) . '...'; 
       $main_content .= '<tr bgcolor="'.$bgcolor.'"><td>'.$ticker['id'].'<br/></td><td>'.$header.'<br/></td><td>'.$text.'<br/></td><td><a href="?subtopic=scrollnews&action=remove_ticker&id='.$ticker['id'].'" onclick="return confirm(\'Are you sure that you want remove this ticker? \')"><span style="color:red">[DELETE]</span></a></td></tr>'; 
   } 
   $main_content .= '</table></div>'; 
   } 

   else 
       $main_content .= 'You are not logged in or you are not authorized to access this page.'; 
   } 

   if($action == 'remove_ticker') { 
       if($logged && $group_id_of_acc_logged >= $config['site']['access_admin_panel']) { 
           $id = (int) $_REQUEST['id']; 
           $tickerr = $SQL->query("SELECT `id` FROM `z_scrolling_news` WHERE `id` = ".$id." LIMIT 1")->fetch(); 

           if($tickerr['id'] == $id){ 
               $SQL->query("DELETE FROM `z_scrolling_news` WHERE `id` = ".$tickerr['id']); 
               header('Location: ?subtopic=scrollnews&action=edit_ticker'); 
           } 
           else 
               $main_content .= 'Ticker with ID '.$id.' does not exist. Could not perform deletion.'; 
       } 
       else 
           $main_content .= 'You are not logged in or you are not authorized to access this page.'; 
       } 
?>

 

Adicione NEWS TICKER em Lastets News

abra htdocs/latestnews.php

/**************************************** 
||   SCROLLNEWS FEATURE © Cybermaster  || 
||    * * * * * * OTland.net    * * * * * * || 
||* * * * * * * * * * * * * * * * * * *|| 
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 

$news = $SQL->query('SELECT * FROM `z_scrolling_news` ORDER BY `id`;'); 
$main_content .= '<div id="TICKER" style="overflow:hidden;width:800px;float:left;border-top:1px solid #000000; border-bottom:1px solid #000000;">'; 
foreach($news as $scroll) { 
$main_content .= '<span style="background-color:'.$scroll['header_bgcolor'].';color:'.$scroll['header_color'].'">'.$scroll['header'].'</span> <span style="background-color:'.$scroll['text_bgcolor'].';">'.$scroll['text'].' | '; 
}     
$main_content .= '</div><script type="text/javascript" src="scrolling_newsticker.js" language="javascript"></script><br/>';  
/* * * * * * * * * * * * * * * * * * * * * 
 ^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*/  

 

</span></span>Adicionar o link no layout

if($group_id_of_acc_logged >= $config['site']['access_admin_panel']) 
echo "<a href='?subtopic=scrollnews&action=edit_ticker'> 
 <div id='submenu_polls' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'> 
   <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div> 
   <div id='ActiveSubmenuItemIcon_polls' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div> 
   <div class='SubmenuitemLabel'><font color=\"red\">! Scrollnews CP !</font></div> 
   <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div> 
 </div> 
</a>";  

 

Configuração do código Java Script:

Você pode editar o arquivo scrolling_newsticker.js e alterar os valores para as seguintes variáveis:

 

TICKER_RIGHTTOLEFT = false;

TICKER_SPEED = 2;

TICKER_STYLE = "font-family:Arial; font-size:12px; color:#444444";

TICKER_PAUSED = false;

 

TICKER_RIGHTTOLEFT

Defina para true se o texto é em árabe, hebraico ou outras línguas de escrita da direita para a esquerda.

 

TICKER_SPEED

Defina a velocidade de rolagem. O valor padrão é 2.

 

TICKER_STYLE

Defina o estilo padrão para o texto de rolagem.

 

TICKER_PAUSED

When tQuando essa variável é definida como true, o ticker de rolagem está em pausa.

Este valor pode ser alterado em tempo de execução, por exemplo, quando o mouse está sobre o ticker.

Compartilhar este post


Link para o post
Velho Doidao    2
Velho Doidao

Obrigado pela contribuição, Aprovado.

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×