Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Nerodo grajančios dainos

Parašė T-Boy· 2014 Kov. 18 15:03:01
#1

Turiu tokį smulkutį HTML dizainą. Tačiau susidūriau su tokia problema, kad nerodo grojančios dainos, nors ir įvestas tas kintamasis, kuris turėtų rodyti dainą. Tai kame čia problema? Gal galėtų tas include blogai prirašytas?


<div id="now_playing">
 <div id="now">Now playing:</div>
 <div id="line"></div>
 <div id="playing"><?php include_once "daina.php"; ?>'.$daina.'</div>
</div>

Parašė Gytisz· 2014 Kov. 18 16:03:30
#2

Parodyk daina.php failą

Parašė T-Boy· 2014 Kov. 18 16:03:42
#3


<?php
error_reporting(0);
$scdef = "Šiuo metu radija yra."; // Default station name to display when server or stream is down
$scip = "localhost"; // ip or url of shoutcast server (DO NOT ADD <a href='HTTP://' target='_blank'><span style='color:005C5B'>HTTP://</span></a> don't include the port)
$scport = "8000"; // port of shoutcast server
$scpass = "changeme"; // password to shoutcast server
//End configuration
error_reporting(0);
$scsuccs = NULL;
$page = NULL;
$scfp = @fsockopen("$scip", $scport, $errno, $errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.'išjungta';
}
if ($scsuccs != 1) {
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "AIM");
$y=0;
while (isset($loop[$y])) {
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if (($loop[$y] == "SERVERGENRE") || ($loop[$y] == "SERVERTITLE") || ($loop[$y] == "SONGTITLE") || ($loop[$y] == "SERVERTITLE") || ($loop[$y] == "AIM"))
$$scphp = urldecode($$scphp);
 
// uncomment the next line to see all variables
// echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while (isset($songatime[$r])) {
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$AIM[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$AIM[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
$daina = str_replace('_',' ',substr ($song[0],0,90));
//end song info
 
fclose($scfp);
}
 
//Eterio Foto
if($streamstatus == "1"){
switch ($aim) {
case 'Dj Dede': $aimlogo = "Dede"; break;
case 'dJ BaNgIs': $aimlogo = "BaNgIs"; break;
case 'Dj Montis': $aimlogo = "Montis"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
default: $aimlogo = "dj";
}
$_SESSION['djus'] = $aim;
 
// daina groja
echo''.$daina.'';
 
}
if($streamstatus == "0")
{
echo'<font size="2" face="tahoma" color="#6C6D7B">Šiuo metu radija yra išjungta.</font>';
}
?>

Parašė avice· 2014 Kov. 18 17:03:29
#4


 
<div id="now_playing">
 
 <div id="now">Now playing:</div>
 
 <div id="line"></div>
 
 <div id="playing"><?php include_once "daina.php"; echo $daina ?></div>
</div>
 

Bet yra bet, matau tavo daina.php

echo ''.$daina.'';

kuris ir turetu atvaizduot, beto kam tos kabutes echo ''.$daina.''? nepaprasciau echo $daina?

Parašė T-Boy· 2014 Kov. 18 18:03:37
#5

Gerai. Pakeičiau tą include pagal tave ir tą kintamąjį pertvarkiau pagal tave, dėkui už šį patarimą, tačiau vistiek nieko nauja. Viskas lygiai tas pats. Kaip nerodo, taip nerodo

Redagavo T-Boy· 2014 Kov. 18 18:03:50

Parašė Gytisz· 2014 Kov. 18 19:03:09
#6

Tavo vietoj daryčiau šitaip:


 
 
<?php
error_reporting(0);
$scdef = "Šiuo metu radija yra."; // Default station name to display when server or stream is down
$scip = "localhost"; // ip or url of shoutcast server (DO NOT ADD <a href='HTTP://' target='_blank'><span style='color:005C5B'>HTTP://</span></a> don't include the port)
$scport = "8000"; // port of shoutcast server
$scpass = "changeme"; // password to shoutcast server
//End configuration
error_reporting(0);
$scsuccs = NULL;
$page = NULL;
$scfp = @fsockopen("$scip", $scport, $errno, $errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.'išjungta';
}
if ($scsuccs != 1) {
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS", "AIM");
$y=0;
while (isset($loop[$y])) {
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if (($loop[$y] == "SERVERGENRE") || ($loop[$y] == "SERVERTITLE") || ($loop[$y] == "SONGTITLE") || ($loop[$y] == "SERVERTITLE") || ($loop[$y] == "AIM"))
$$scphp = urldecode($$scphp);
 
// uncomment the next line to see all variables
// echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while (isset($songatime[$r])) {
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$AIM[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$AIM[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
$daina = str_replace('_',' ',substr ($song[0],0,90));
//end song info
 
fclose($scfp);
}
 
//Eterio Foto
if($streamstatus == "1"){
switch ($aim) {
case 'Dj Dede': $aimlogo = "Dede"; break;
case 'dJ BaNgIs': $aimlogo = "BaNgIs"; break;
case 'Dj Montis': $aimlogo = "Montis"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
default: $aimlogo = "dj";
}
$_SESSION['djus'] = $aim;
 
// daina groja
echo '<div id="now_playing">';
echo '<div id="now">Now playing:</div>';
echo '<div id="line"></div>';
echo '<div id="playing">';
echo''.$daina.'';
echo '</div></div>';
 
}
if($streamstatus == "0")
{
echo'<font size="2" face="tahoma" color="#6C6D7B">Šiuo metu radija yra išjungta.</font>';
}
?>
 
 


Tada iš dizainos kodo išimam šias eilutes:

<div id="now_playing">
 
<div id="now">Now playing:</div>
 
<div id="line"></div>
 
<div id="playing"><?php include_once "daina.php"; echo $daina ?></div>
</div>
 


ir pakeičiam į


<?php include_once "daina.php"; ?>


beto galbūt neįrašiai serverio duomenų kad nerodo kokia daina groja :] ?

Redagavo Gytisz· 2014 Kov. 18 19:03:29

Parašė T-Boy· 2014 Kov. 18 20:03:36
#7

Duomenys visi surašyti ir tikrai gerai! :D dėkui, kad stengiesi, bet net pats pasimečiau, nes vistiek kažkas negerai. Nu man tikrai viskas čia tvarkingai atrodo, bet kame esmė, tai nebepagaunu...

Parašė Gytisz· 2014 Kov. 18 20:03:42
#8

Būna kažkoks erroras? Kokį serverį naudoji? Icecast/shoutcast? Jai icecast šiuo atvėju radijos panelė netinka.

Redagavo Gytisz· 2014 Kov. 18 20:03:19

Parašė T-Boy· 2014 Kov. 18 20:03:57
#9

Erroro visiškai jokio. Naudoju shoutcast. Tiesiog nerodo jokio teksto.

Parašė Gytisz· 2014 Kov. 18 20:03:27
#10

Bandyk šitaip.

Daina.php:

 
 
<?php
 $ip = "ip adresas";
 $port = "portas";
 $fp = @fsockopen($ip,$port,$errno,$errstr,1);
 if (!$fp) 
    { 
    $title = "Serveris išjungtas";
    } 
    else
    { 
    fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
    while (!feof($fp)) 
       {
       $info = fgets($fp);
       }
    $info = str_replace('</body></html>', "", $info);
    $split = explode(',', $info);
    if (empty($split[6]) )
       {
       $title = "Daina neturi savo duomenu!";
       }
    else
       {
       $count = count($split);
       $i = "6";
       while($i<=$count)
          {
          if ($i > 6)
             {
             $title .= ", " . $split[$i];
             }
          else
             {
             $title .= $split[$i];
             }
          $i++;
          }
       }
    }
 $title = substr($title, 0, -2);
 
echo '<div id="now_playing">';
echo '<div id="now">Now playing:</div>';
echo '<div id="line"></div>';
echo '<div id="playing">';
echo '.$title.';
echo '</div></div>';
?>
 
 


Tada iš dizainos kodo išimam šias eilutes:

<div id="now_playing">
 
<div id="now">Now playing:</div>
 
<div id="line"></div>
 
<div id="playing"><?php include_once "daina.php"; echo $daina ?></div>
</div>
 


ir pakeičiam į


<?php include_once "daina.php"; ?>

Redagavo Gytisz· 2014 Kov. 18 20:03:51

Parašė T-Boy· 2014 Kov. 18 21:03:24
#11

Neveikia. Išvis dingsta eilutė, kur turėtų rodyti pavadinimą. Nesvarbu tada. Paduosiu koduotojui, kuris tvarkė seniau šitą dizainą, kad sutvarkytų iki galo. Dėkui už pagalbą, pakėliau įvertinimą ;)

Parašė Gytisz· 2014 Kov. 18 21:03:46
#12

Galbūt galėčiau užmesti akį kur darai? Į pm ;)

Parašė avice· 2014 Kov. 19 12:03:38
#13

O tau apskritai veikia tas script'as niekur neincludinus? t.y atidarant paprastai adressas.lt/daina.php ?

Parašė T-Boy· 2014 Kov. 19 16:03:22
#14

Nu taip, veikia man .

Parašė T-Boy· 2014 Kov. 19 16:03:32
#15

Taip, veikia man tas daina.php. Kątik iš kito dizaino išsitraukia tą eterio panelę ir sukeičiau, bet bėda tai ta pati. Turiu nuojautą, kad čia blogai includina. Ir čia šiaip tik HTML dizainas, tai gal visai kažkaip tą include reikia daryti? :?

Redagavo T-Boy· 2014 Kov. 19 16:03:00