Witam mam problem nie włączyć kodu php w szablon strony.
Chodzi mi tu o stronę radia Internetowego.(ten pierwszy kod dotyczy się theme jportalu)
To jest kod
w którym chciałbym, by był
<?
$color[1] = '#D1D7DC'; // kolor uzytkownika
$color[2] = '#ECEFF0'; // kolor uzytkownika
$color[3] = $theme; // zawiera nazwe katalogu theme'a
$color[4] = '#F8f8f8'; // kolor uzytkownika
$color[5] = '#2D2D2D'; // 1 kolor listy (forum, panel admina, itp.)
$color[6] = '#606060'; // naglowek listy (opis kolumn na forum itp.)
$color[7] = '#cccccc'; // kolor czcionki naglowkow listy
$color[8] = '#2D2D2D'; // 2 kolor listy (forum, panel admina, itp.)
$color[9] = '#cccccc'; // kolor drobnych podpisow np. w katalogu stron
function index() {
global $color;
echo'<table cellpadding="0" cellspacing="0" align="center">
<tr>
<td class="pds">';
top();
echo'<div class="s1">
<table cellpadding="0" cellspacing="0" width="750">
<tr>
<td width="159" valign="top">';
left_menu();
echo'</td>
<td width="432" valign="top" class="srodek">';
print_main();
echo'</td>
<td width="159" valign="top">';
right_menu();
echo'</td>
</tr>
</table>
</div>';
footer('');
echo'</td>
</tr>
</table>';
mapy();
}
function index2() {
global $color;
echo'<table cellpadding="0" cellspacing="0" align="center">
<tr>
<td class="pds">';
top();
echo'<div class="s1_no">
<table cellpadding="0" cellspacing="0" width="750">
<tr>
<td width="750" valign="top" class="srodek">';
print_main();
echo'</td>
</tr>
</table>
</div>';
footer('_no');
echo'</td>
</tr>
</table>';
mapy();
}
function top() {
global $color;
$allonline = $GLOBALS['members']+$GLOBALS['guests'];
echo'<table cellpadding="0" cellspacing="0">
<tr>
<td>
<td><img src="theme/'.$color[3].'/images/t1.jpg" alt="" border="0" usemap="#posluchaj"></div>
<td><img src="theme/'.$color[3].'/images/t2.jpg" alt=""></div>
<td class="t3">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="tx5">Praesent m et diam - LOREM ;)</td>
<tr>
<td class="tx1">ONLINE NA STRONIE: '.$allonline.'</td>
<tr>
<td class="tx2">SŁUCHACZY: 425</td>
<tr>
<td class="tx3">REKORD: 966</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="m1">
<a href="index.php">HOME</a>
<a href="download.php">DOWNLOAD</a>
<a href="links.php">LINKI</a>
<a href="module.php?op=gbook">KSIĘGA GOŚCI</a>
<a href="forum.php">FORUM DYSKUSYJNE</a>
<a href="login.php">ZALOGUJ SIĘ</a>
<a href="mailer.php">KONTAKT</a>
</td>
<tr>
<td class="t5">
<div class="tx4">
<SCRIPT>document.write("Dzisiaj jest " + getDateStr())</SCRIPT>.
<script type="text/javascript">WypiszImieniny("Imieniny: "," ",", "," i ");</script>
</div>
</td>
</td>
</tr>
</table>';
}
function footer($no="") {
global $footer1, $footer2, $color;
echo'<div class="d1'.$no.'">
<div style="padding:15px 5px 12px 5px; width: 100%; text-align: center;">'.$footer1.' '.$footer2.'</div>
</div>
<div><img src="theme/'.$color[3].'/images/d2.jpg" alt="" border="0" usemap="#dol"></div>';
}
function mapy() {
echo'<map name="dol" id="dol"><area shape="rect" coords="667,5,742,31" href="http://d4u.pl" target="_blank" alt="szablony www">
</map>
<map name="posluchaj" id="posluchaj"><area shape="rect" coords="39,195,124,235" href="#" alt="">
<area shape="rect" coords="128,195,223,236" href="#" alt="">
</map>';
}
function left_menu_open() {
global $color;
echo '
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>';
}
function left_menu_close() {
global $color;
echo '
</td>
</tr>
</table>';
}
function right_menu_open() {
global $color;
echo '
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
';
}
function right_menu_close() {
global $color;
echo '
</td>
</tr>
</table>';
}
function left_menu_title_open()
{
global $color;
echo '<table style="margin-bottom: 8px;" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="mng">';
}
function left_menu_title_close()
{
global $color;
echo '</td>
</tr>
<tr>
<td class="mtekst">
';
}
function left_menu_text_open() {}
function left_menu_text_close()
{
global $color;
echo '
</td>
</tr>
</table>';
}
function right_menu_title_open()
{
global $color;
echo '<table style="margin-bottom: 8px;" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="mng">';
}
function right_menu_title_close()
{
global $color;
echo '</td>
</tr>
<tr>
<td class="mtekst">
';
}
function right_menu_text_open() {}
function right_menu_text_close()
{
global $color;
echo '
</td>
</tr>
</table>';
}
function main_title_open()
{
global $color;
echo '<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="sng">';
}
function main_title_close()
{
global $color;
echo '</td>
</tr>
<tr>
';
}
function main_text_open()
{
echo '<td class="tresc">';
}
function main_text_close($poster=0, $date=0, $comment=0, $comment_num=0, $print=0)
{
global $color;
$print = '<a href="'.$print.'"><img SRC="theme/'.$color[3].'/gfx/print.gif" border="0" align="absmiddle"></a>';
if($comment<>'')
$comment = '<a href="'.$comment.'">komentarze: '.$comment_num.'</a> | ';
if($portal<>'0' AND $date<>0)
{
echo '
</td>
<tr>
<td class="tresc" style="text-align: right; font-size: 10px;">'.$comment.$print.' </td>
</tr>';
}
echo '
</td>
</tr>
</table>
<br>';
}
function mn_title_open()
{
global $color;
echo '<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="no_ng">';
}
function mn_title_close()
{
global $color;
echo '</td>
</tr>
<tr>
';
}
function mn_text_open()
{
echo '<td class="text">';
}
function mn_text_close($poster=0, $date=0, $comment=0, $comment_num=0, $print=0) {
global $color;
$print = '<a href="'.$print.'"><img SRC="theme/'.$color[3].'/gfx/print.gif" border="0" align="absmiddle"></a>';
if($comment<>'')
$comment = '<a href="'.$comment.'">komentarze: '.$comment_num.'</a> | ';
if($portal<>'0' AND $date<>0) {
echo '</td>
</tr>
<td><img SRC="theme/'.$color[3].'/gfx/separ.gif" width="1" height="1"></td>
</tr>
<tr>
<td class="tresc" style="text-align: right; font-size: 10px;">'.$comment.$print.' </td>
</tr>
';
}
echo '
</td>
</tr>
</table>
<br>';
}
function news_theme($mod, $title, $icon, $text, $poster, $textcd, $date, $comment, $comment_num, $print, $send)
{
global $color;
if($mod=='list')
{
if($textcd<>'') $textcd = '<a href="'.$textcd.'">więcej</a> | '; else $textcd = '';
}
else
{
if($textcd<>'') $text = '<font color="#eeeeee"><b>'.$text.'</b></font><br><br>'.$textcd;
}
if($icon<>'') $text = '<img src="'.$icon.'" align="right">'.$text;
$send = '<a href="'.$send.'" title="wyślij znajomemu"><img SRC="theme/'.$color[3].'/gfx/mail.gif" border="0" align="absmiddle"></a> ';
$print = '<a href="'.$print.'" title="wersja do druku" target="_blank"><img SRC="theme/'.$color[3].'/gfx/print.gif" border="0" align="absmiddle"></a>';
$comment = '<a href="'.$comment.'">komentarze: '.$comment_num.'</a>';
echo '<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="sng"><b>'.$title.'</b> '.substr($date, 20).'</td>
</tr>
<tr>
<td class="tresc">';
echo $text;
if($mod=='more') unset($textcd);
if($mod<>'err')
{
echo '</td>
</tr>
<tr>
<td class="tresc"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="m_bt">'.$poster.' | '.date('d.m.Y', strtotime(substr($date, 0, 10))).'</td>
<td class="m_bt" align="right">'.$textcd.$comment.' | '.$print.' '.$send.'</td>
</tr>
</table></td>
</tr>';
}
echo '
</td>
</tr>
</table>
<br>';
}
function art_theme($title, $text, $poster, $date, $comment, $comment_num, $print, $more, $opened)
{
global $color;
$more = '<a href="'.$more.'">Czytaj artykuł</a>';
$print = '<a href="'.$print.'" title="wersja do druku" target="_blank"><img SRC="theme/'.$color[3].'/gfx/print.gif" border="0" align="absmiddle"></a>';
$comment = '<a href="'.$comment.'">komentarze: '.$comment_num.'</a>';
echo '<tr>
<td>
<table style="margin-top: 5px;" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="title"><b>'.$title.'</b></td>
</tr>
<tr>
<td class="title">'.$text.'</td>
</tr>';
if($mod<>'err')
{
echo '
<tr>
<td colspan="2">
<table style="margin-top: 5px;" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="title">odsłon: '.$opened.'</td>
<td class="title" align="right">'.$more.' | '.$comment.' | '.$print.'</td>
</tr>
</table>
</td>
</tr>';
}
echo '
</table>
<br>
</td>
</tr>
';
}
function list_open() {
global $color;
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">';
}
function list_close() {
global $color;
echo '</table>';
}
function list_body_open($title="", $text="", $others="")
{
global $color;
echo '
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="title"><b>'.$title.'</b></td>
</tr>
<tr>
<td class="title" style="text-align: justify;">'.$text.'</td>
</tr>';
if($others<>'')
{
echo '
<tr>
<td class="title" align="right" style="padding-top: 5px;">'.$others.'</td>
</tr>
';
}
echo '</table>
<br>
</td>
</tr>
';
}
Ten kod
<?
$sc[czas] = 180;
$sc[host] = "83.149.122.32";
$sc[port] = 22400;
$sc[template] = " Zasilanie:<b> [status]</b><br>Stacja :<b>[dj]</b><br>Prowadzi:<b> [genre] </b><br>gg:<b>[gg]</b><br>Slucha :<b> [ile] osób</b><br>Maksymalnie<b> [max]</B><br> Rekord <b>[peak]</B>";
# $sc[template] = "<b>Status (on/off/err) :</b> [status]<br><b>GG DJ-a:</b> [gg]<br><b>Dj:</b> [genre]<br><b>Ilu sluchaczy aktualnie/maksymalnie/peak:</b> [ile]/[max]/[peak]<br>";
?>
<?
if($fp = @fsockopen($sc[host], $sc[port]))
{
fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
fgets($fp);fgets($fp);fgets($fp);
while(!feof($fp)) $in.=strip_tags(fgets($fp));
fclose($fp);
# echo $in;
// [status]
$m[0]="Server is currently";
$m[1]="";
$mp[0]=strpos($in,$m[0]);
$mp[1]=@strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) );
if( $tmp[1][0] == "up" )
$dat[status] = "on";
elseif( $tmp[1][0] == "down" )
$dat[status] = "off";
else
$dat[status] = "err";
if($dat[status]=="on")
{
// [dj]
$m[0]="Stream Title:";
$m[1]="Content Type:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
if( $tmp[1] ) $dat[dj] = $tmp[1];
else $dat[dj] = "err";
// [gg]
$m[0]="Stream AIM:";
$m[1]="Stream IRC:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
if( $tmp[1] ) $dat[gg] = $tmp[1];
else $dat[gg] = "err";
// [genre]
$m[0]="Stream Genre:";
$m[1]="Stream URL:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );
if( $tmp[1] ) $dat[genre] = $tmp[1];
else $dat[genre] = "err";
// [ile]
$m[0]="kbps with";
$m[1]="listeners";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
if( $tmp[1] ) $dat[ile] = $tmp[1][0];
else $dat[ile] = "err";
// [max]
$m[0]="kbps with";
$m[1]="listeners";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
if( $tmp[1] ) $dat[max] = $tmp[1][2];
else $dat[max] = "err";
// [peak]
$m[0]="Listener Peak:";
$m[1]="Average";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-7) );
if( $tmp[1] ) $dat[peak] = $tmp[1];
else $dat[peak] = "err";
}
}
else
{
$dat=array();
$dat[status]="err";
}
$co = array('[status]','[dj]','[gg]','[genre]','[ile]','[max]','[peak]');
$naco = array($dat[status],$dat[dj],$dat[gg],$dat[genre],$dat[ile],$dat[max],$dat[peak]);
$sc[template] = str_replace($co,$naco,$sc[template]);
echo $sc[template];
?>
Nie wiem jak do tego się zabrać walczyłem z include ale wygrało ze mną :)
http://www.beta.dance-radio.az.pl/index.php