Ayuda! "syntax error" en hoja PHP

  • Autor Autor DonScript
  • Fecha de inicio Fecha de inicio
D

DonScript

Alfa
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Hola hermanos de ForoBeta, necesito de su ayuda... veran me sale este error en una web que estoy haciendo en Localhost

Insertar CODE, HTML o PHP:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\mylist.php on line 83

pero donde indica line 83 esa simplemente el cierre ?>

¿Como puedo arreglar esto?... dejo la hoja de codigos:

Insertar CODE, HTML o PHP:
<?php
session_start();
if (!empty($_SESSION['userid']))
{
    if (is_array($_SESSION['userid']))
    {
?>
	<div class="Info">
		<div class="Player"></div>
		<div class="Name2"><b>PlayList ( PLAYLIST )</b></div>
		<div class="playall"><a href="#" onclick="playall();">[ PLAY ALL ]</a></div>
		<div class="Playlist"></div>
	</div>
<?
        foreach ($_SESSION['userid'] as $key => $value)
        {
            $rs .= $value;
            $rssil .= $key;
            //--------------
            $feedURL     = "http://gdata.youtube.com/feeds/api/videos?vq=" . urlencode($value) . "&orderby=rating&max-results=50&start-index=1";
            // read feed into SimpleXML object
            $sxml        = [MENTION=68920]Simple[/MENTION]xml_load_file(($feedURL));
            //$sxml = mb_convert_encoding((string) $sxml  , 'UTF-8' , 'ISO-8859-9'); 
            // get summary counts from opensearch: namespace
            $counts      = @$sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
            $total       = $counts->totalResults;
            $startOffset = $counts->startIndex;
            $endOffset   = ($startOffset - 1) + $counts->itemsPerPage;
            // echo '<ul class="results">';
            $i           = 0;
            foreach ($sxml->entry as $entry)
            {
                // get nodes in media: namespace for media information
                $media     = $entry->children('http://search.yahoo.com/mrss/');
                // get video player URL
                $attrs     = $media->group->player->attributes();
                $watch     = $attrs['url'];
                $watch     = str_replace('http://www.youtube.com/watch?v=', 'index.php?w=', $watch);
                $kod1      = str_replace('index.php?w=', '', $watch);
                $kod       = str_replace('&feature=youtube_gdata', '', $kod1);
                $kod       = str_replace('_player', '', $kod);
                // get video thumbnail
                $attrs     = $media->group->thumbnail[0]->attributes();
                $thumbnail = $attrs['url'];
                // get <yt:duration> node for video length
                $yt        = $media->children('http://gdata.youtube.com/schemas/2007');
                $attrs     = $yt->duration->attributes();
                $length    = $attrs['seconds'];
                $mins      = floor($length / 60);
                $secs      = $length % 60;
                // get <gd:rating> node for video ratings
                $gd        = $entry->children('http://schemas.google.com/g/2005');
                if ($gd->rating)
                {
                    $attrs  = $gd->rating->attributes();
                    $rating = @$attrs['average'];
                }
                else
                {
                    $rating = 0;
                }
?>	

<div class="Result">

		<div class="Player"><img src="images/icon.jpg" alt=""></div>

		<div class="Name"><a onclick="play('<?= $kod ?>');return false;" href="<?= $kod ?>" title="<?= $media->group->title ?>"><?= substr($media->group->title, 0, 45) ?></a> </div>

		<div class="Listen"><a href="pop_up" onClick="window.name='share'; window.open('http://www.facebook.com/sharer.php?u=http://mp3.zpdma.com/dinle.php?cal=<?= $kod ?>','pop_up', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=550,height=350'); return false;"><img src="http://mp3.zpdma.com/fb.gif" alt="SHARE"/></a></div>

		<div class="Playlist" id="plyst1000<?= $key ?>"><a onclick="removelist('<?= $kod ?>','1000<?= $key ?>');return false;" href="#" title="Remove"><img src="images/remove.png" border="0" /></a></div>

	</div>
	
	
	<?
            }
        }
        //echo "::::::::my playlist:::::: <br>$rs<br>";
    }
}
?>

Muchas gracia desde ya!..
 
Prueba así:

Insertar CODE, HTML o PHP:
<?php
session_start();
if (!empty($_SESSION['userid']))
{
    if (is_array($_SESSION['userid']))
    {
?>
    <div class="Info">
        <div class="Player"></div>
        <div class="Name2"><b>PlayList ( PLAYLIST )</b></div>
        <div class="playall"><a href="#" onclick="playall();">[ PLAY ALL ]</a></div>
        <div class="Playlist"></div>
    </div>
<?php
        foreach ($_SESSION['userid'] as $key => $value)
        {
            $rs .= $value;
            $rssil .= $key;
            //--------------
            $feedURL     = "http://gdata.youtube.com/feeds/api/videos?vq=" . urlencode($value) . "&orderby=rating&max-results=50&start-index=1";
            // read feed into SimpleXML object
            $sxml        = Simplexml_load_file(($feedURL));
            //$sxml = mb_convert_encoding((string) $sxml  , 'UTF-8' , 'ISO-8859-9'); 
            // get summary counts from opensearch: namespace
            $counts      = @$sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
            $total       = $counts->totalResults;
            $startOffset = $counts->startIndex;
            $endOffset   = ($startOffset - 1) + $counts->itemsPerPage;
            // echo '<ul class="results">';
            $i           = 0;
            foreach ($sxml->entry as $entry)
            {
                // get nodes in media: namespace for media information
                $media     = $entry->children('http://search.yahoo.com/mrss/');
                // get video player URL
                $attrs     = $media->group->player->attributes();
                $watch     = $attrs['url'];
                $watch     = str_replace('http://www.youtube.com/watch?v=', 'index.php?w=', $watch);
                $kod1      = str_replace('index.php?w=', '', $watch);
                $kod       = str_replace('&feature=youtube_gdata', '', $kod1);
                $kod       = str_replace('_player', '', $kod);
                // get video thumbnail
                $attrs     = $media->group->thumbnail[0]->attributes();
                $thumbnail = $attrs['url'];
                // get <yt:duration> node for video length
                $yt        = $media->children('http://gdata.youtube.com/schemas/2007');
                $attrs     = $yt->duration->attributes();
                $length    = $attrs['seconds'];
                $mins      = floor($length / 60);
                $secs      = $length % 60;
                // get <gd:rating> node for video ratings
                $gd        = $entry->children('http://schemas.google.com/g/2005');
                if ($gd->rating)
                {
                    $attrs  = $gd->rating->attributes();
                    $rating = @$attrs['average'];
                }
                else
                {
                    $rating = 0;
                }
?>    

<div class="Result">

        <div class="Player"><img src="images/icon.jpg" alt=""></div>

        <div class="Name"><a onclick="play('<?= $kod ?>');return false;" href="<?= $kod ?>" title="<?= $media->group->title ?>"><?= substr($media->group->title, 0, 45) ?></a> </div>

        <div class="Listen"><a href="pop_up" onClick="window.name='share'; window.open('http://www.facebook.com/sharer.php?u=http://mp3.zpdma.com/dinle.php?cal=<?= $kod ?>','pop_up', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=550,height=350'); return false;"><img src="http://mp3.zpdma.com/fb.gif" alt="SHARE"/></a></div>

        <div class="Playlist" id="plyst1000<?= $key ?>"><a onclick="removelist('<?= $kod ?>','1000<?= $key ?>');return false;" href="#" title="Remove"><img src="images/remove.png" border="0" /></a></div>

    </div>
    
    
    <?php
            }
        }
        //echo "::::::::my playlist:::::: <br>$rs<br>";
    }
}
?>
 
Usas Wampserver?? siempre debes utilizar la etiqueta de php completa <?php ?>.
 
te falta el cierre del ciclo de los 2 for antes del ?>

Insertar CODE, HTML o PHP:
foreach ($_SESSION['userid'] as $key => $value)
        {
            $rs .= $value;
            $rssil .= $key;
            //--------------
            $feedURL     = "http://gdata.youtube.com/feeds/api/videos?vq=" . urlencode($value) . "&orderby=rating&max-results=50&start-index=1";
            // read feed into SimpleXML object
            $sxml        = Simplexml_load_file(($feedURL));
            //$sxml = mb_convert_encoding((string) $sxml  , 'UTF-8' , 'ISO-8859-9'); 
            // get summary counts from opensearch: namespace
            $counts      = @$sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
            $total       = $counts->totalResults;
            $startOffset = $counts->startIndex;
            $endOffset   = ($startOffset - 1) + $counts->itemsPerPage;
            // echo '<ul class="results">';
            $i           = 0;
            foreach ($sxml->entry as $entry)
            {
                // get nodes in media: namespace for media information
                $media     = $entry->children('http://search.yahoo.com/mrss/');
                // get video player URL
                $attrs     = $media->group->player->attributes();
                $watch     = $attrs['url'];
                $watch     = str_replace('http://www.youtube.com/watch?v=', 'index.php?w=', $watch);
                $kod1      = str_replace('index.php?w=', '', $watch);
                $kod       = str_replace('&feature=youtube_gdata', '', $kod1);
                $kod       = str_replace('_player', '', $kod);
                // get video thumbnail
                $attrs     = $media->group->thumbnail[0]->attributes();
                $thumbnail = $attrs['url'];
                // get <yt:duration> node for video length
                $yt        = $media->children('http://gdata.youtube.com/schemas/2007');
                $attrs     = $yt->duration->attributes();
                $length    = $attrs['seconds'];
                $mins      = floor($length / 60);
                $secs      = $length % 60;
                // get <gd:rating> node for video ratings
                $gd        = $entry->children('http://schemas.google.com/g/2005');
                if ($gd->rating)
                {
                    $attrs  = $gd->rating->attributes();
                    $rating = @$attrs['average'];
                }
                else
                {
                    $rating = 0;
                }

es eso

saludos
Carlos
 
Última edición:
Prueba asi te falto cerrar unas cosillas tienes que estar mas atento a la sintaxis :encouragement:
PHP:
<?php
session_start();
if (!empty($_SESSION['userid']))
{
    if (is_array($_SESSION['userid']))
    {
?>
	<div class="Info">
		<div class="Player"></div>
		<div class="Name2"><b>PlayList ( PLAYLIST )</b></div>
		<div class="playall"><a href="#" onclick="playall();">[ PLAY ALL ]</a></div>
		<div class="Playlist"></div>
	</div>
<?
        foreach ($_SESSION['userid'] as $key => $value)
        {
            $rs .= $value;
            $rssil .= $key;
            //--------------
            $feedURL     = "http://gdata.youtube.com/feeds/api/videos?vq=" . urlencode($value) . "&orderby=rating&max-results=50&start-index=1";
            // read feed into SimpleXML object
            $sxml        = Simplexml_load_file(($feedURL));
            //$sxml = mb_convert_encoding((string) $sxml  , 'UTF-8' , 'ISO-8859-9'); 
            // get summary counts from opensearch: namespace
            $counts      = @$sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
            $total       = $counts->totalResults;
            $startOffset = $counts->startIndex;
            $endOffset   = ($startOffset - 1) + $counts->itemsPerPage;
            // echo '<ul class="results">';
            $i = 0;
            foreach ($sxml->entry as $entry)
            {
                // get nodes in media: namespace for media information
                $media     = $entry->children('http://search.yahoo.com/mrss/');
                // get video player URL
                $attrs     = $media->group->player->attributes();
                $watch     = $attrs['url'];
                $watch     = str_replace('http://www.youtube.com/watch?v=', 'index.php?w=', $watch);
                $kod1      = str_replace('index.php?w=', '', $watch);
                $kod       = str_replace('&feature=youtube_gdata', '', $kod1);
                $kod       = str_replace('_player', '', $kod);
                // get video thumbnail
                $attrs     = $media->group->thumbnail[0]->attributes();
                $thumbnail = $attrs['url'];
                // get <yt:duration> node for video length
                $yt        = $media->children('http://gdata.youtube.com/schemas/2007');
                $attrs     = $yt->duration->attributes();
                $length    = $attrs['seconds'];
                $mins      = floor($length / 60);
                $secs      = $length % 60;
                // get <gd:rating> node for video ratings
                $gd        = $entry->children('http://schemas.google.com/g/2005');
                if ($gd->rating)
                {
                    $attrs  = $gd->rating->attributes();
                    $rating = @$attrs['average'];
                }
                else
                {
                    $rating = 0;
                }
			
?>	

<div class="Result">

		<div class="Player"><img src="images/icon.jpg" alt=""></div>

		<div class="Name"><a onclick="play('<?= $kod ?>');return false;" href="<?= $kod ?>" title="<?= $media->group->title ?>"><?= substr($media->group->title, 0, 45) ?></a> </div>

		<div class="Listen"><a href="pop_up" onClick="window.name='share'; window.open('http://www.facebook.com/sharer.php?u=http://mp3.zpdma.com/dinle.php?cal=<?= $kod ?>','pop_up', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=550,height=350'); return false;"><img src="http://mp3.zpdma.com/fb.gif" alt="SHARE"/></a></div>

		<div class="Playlist" id="plyst1000<?= $key ?>"><a onclick="removelist('<?= $kod ?>','1000<?= $key ?>');return false;" href="#" title="Remove"><img src="images/remove.png" border="0" /></a></div>

	</div>
	
	
	<?
            }
        }
    }
}

?>
 
Recomendación, pega la línea de la sintaxis que te da error, para que te puedan ayudar más rápido!
 
Atrás
Arriba