vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Help with a CMS Widget Please (https://vborg.vbsupport.ru/showthread.php?t=279045)

B16MCC 02-23-2012 12:19 PM

Help with a CMS Widget Please
 
Hi guys, I have a problem that is most likely a very simple fix, but with my very limited knowledge I'm at a loss on how to fix it. Could anyone help please.

I have this code in a Static HTML widget and it works just fine.

HTML Code:

<a href="url_removed_by_me" onclick="window.open('url_removed_by_me','popup','width=400,height=200,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">Start JukeBox</a>
Now then, I also have another PHP Direct Exec widget, with the following code..

PHP Code:

ob_start();
include(
"radio_stats.php");
echo 
"<br />\n";
$output .= ob_get_contents();
ob_end_clean(); 

The output from radio_stats.php is displayed ok and I'm almost there. Here's my problem, I want to add the first section of code to the radio_stats.php to give me a link that opens the page in a sized popup.

Here's my radio_stats.php

PHP Code:

<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website

// Add-On MAXLISTNERS insead of the / 10 MAXLISTENERS which was set, and the BITRATE add-on.
// Online and Offline graphics, and add-on code.
// Better HTML Script.

// Do Not Try To Edit This Only Unless You Know What You're Doing!!!!!!!

include('config_radio.php');

$scfp fsockopen("$scip"$scport, &$errno, &$errstr30);
 if(!
$scfp) {
  
$scsuccs=1;
echo
''.$scdef.' is Offline'
 }
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($scfp1000);
 }
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define  xml elements
 
$loop = array("STREAMSTATUS""BITRATE""SERVERTITLE""CURRENTLISTENERS""MAXLISTENERS""BITRATE");
 
$y=0;
 while(
$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)
   $
$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(
$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]);
  
$dj[$t] = ereg_replace(".*<SERVERTITLE>"""$page);
  
$dj[$t] = ereg_replace("</SERVERTITLE>.*"""$pageed);
$r++;
 }
//end song info
fclose($scfp);
}

//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>'
.$scdef.'</title>
</head>

<body text="" bgcolor="">

<p align="center"><center>
<img src="online.jpg"><br>
'
.$servertitle.'<br>
<br>
<b>Listeners:</b> '
.$currentlisteners.' / '.$maxlisteners.' <b> Bitrate:</b> '.$bitrate.'kbps<br>
<b>Current Song:</b> '
.$song[0].'</p><b>
<br>
<a href="streams.html" target="_blank">Listen Now</a>
</p>
</body>

</html>'
;
}
if(
$streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>Radio Server Is Offline</title>
</head>

<body text="" bgcolor="">
<center>
<img src="offline.jpg">
</body>

</html>'
;
}
?>

OK, so, the majority of the above code is probably not important, I simply want to use the method shown in the first code snipet to replace the :-

'<a href="streams.html" target="_blank">Listen Now</a>'

in the above code snipet. So , basically, when the shoutcast server is online, I display a link to open the player in a popup.

So far, when I add the code, I get the error :-
Code:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /url/removed/by/me/radio_stats.php on line 87
Many thanks for reading, here's hoping...
B16MCC.

kh99 02-23-2012 12:44 PM

You would need to put a backslash in front of each single quote in the code you're trying to add, like:

HTML Code:

<a href="url_removed_by_me" onclick="window.open(\'url_removed_by_me\',\'popup\',\'width=400,height=200,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0\'); return false">Start JukeBox</a>

B16MCC 02-23-2012 12:57 PM

Nothing less than Magnificent ! I knew it would be easy. Thank you very much you're a star !


All times are GMT. The time now is 05:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01029 seconds
  • Memory Usage 1,759KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete