Web Analytics Made Easy -
StatCounter Parse error: syntax error, unexpected '{' - CodingForum

Announcement

Collapse
No announcement yet.

Parse error: syntax error, unexpected '{'

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parse error: syntax error, unexpected '{'

    Hi, I'm trying to figure out why I'm getting the error :


    Parse error: syntax error, unexpected '}' in D:\mysite\www\music2\components\com_content\views\frontpage\tmpl\default.php on line 128

    I can't find what is missing. Any ideas?

    my code:


    PHP Code:
    <?php // no direct access
    defined('_JEXEC') or die('Restricted access'); 

    ?>    
          
          <!--clsTopArtiest-->
          <div class="clsTopArtiest">
          
           <table class="clsHeadingTable">
              <tr>
                <td><h2>Top Artists</h2></td>
                <td class="clsViewAll1"><a href="<?php echo JRoute::_'index.php?option=com_members&type=topartist'); ?>"><img src="<?php echo $this->baseurl ?>/templates/default/images/main-viewall.jpg" /></a></td>
              </tr>
            </table>
            <table class="clsArt" cellspacing="13px">
              <tr>
                <?php
                   
    foreach ($this->topArtists as $topArtist
                 {
                      
    //thumbnail calculation
                     
    $thumbnail        =    ContentViewFrontpage::profile_image($topArtist->uid);
                     
    $profile_url    =    ContentViewFrontpage::profile_url($topArtist->uid);
                     
                     
    //initialize db
                     
    $db     =& JFactory::getDBO();
                     
    $sql    ="SELECT * FROM #__users WHERE id=$topArtist->uid";
                     
    $db->setQuery($sql);
                     
    $artist $db->loadObject();
                     
                     
    //genre calculation
                     
    $genre=explode(",",$artist->genre);
                     
                     if(
    $genre[0]!="")
                     {
                        
    $genre_names=array();
                        for(
    $i=0;$i<count($genre);$i++)
                        {
                             
    $gen_id=$genre[$i];
                              
    $db->setQuery("SELECT * FROM #__categories".
                                        
    " where section='com_genre' and id=$gen_id");
                                        
                            
    $gen $db->loadObjectList();
                            
                            foreach (
    $gen as $genr)
                            {
                                
    $genre_names[]=$genr->title;
                            }
                        }
                        
    $genre_name=implode("/",$genre_names);
                     }
                     else
                        
    $genre_name="No Genre Defined";
                     
                     
              
    ?> 
                <td class="clsInnertd">
                     <table>
                        <tr class="clsRow">
                          <td><a href="<?php echo $this->baseurl."/".$profile_url ?>"><img src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$thumbnail?>&h=58&w=85&zc=1" /></a></td>
                        </tr>
                        <tr class="clsRow1">
                          <td class="clsNoPadding"><p class="clsName1"><?=$artist->name;?></p>
                            <p class="clsName2"><?=$genre_name?></p></td>
                        </tr>
                      </table>
                  </td>
                          
                  <?php
                
    }  # for reach end
            
    ?>    
              </tr>
            </table>
          </div>
          <!--end of clsTopArtiest-->
           <div class="clsTopArtiest" >
          <div class="clsArt1"></div>
          <!--clsFeaturedArtist-->
          <div class="clsFeaturedArtist clsClearFix">
          <div class="clsNewRounderd">
          <div class="clsFeaturedLeft">
                <div class="clsHomebottom">
                    <div class="clsHomeTop">
                        <div class="clsHomecenter">
                        
                            
                                <table>
                                    
                                    
                                     <? 
                        $j
    =0;
                        
             foreach (
    $this->featureArtists as $row
             {
                 
                
                
    //initialize db
                
    $db =& JFactory::getDBO();
                     
                     
    //thumbnail calculation
                     
    $thumbnail=ContentViewFrontpage::profile_image($row->id);
                     
    $profile_url=ContentViewFrontpage::profile_url($row->id);
                    
                     
    //genre calculation
                     
    $genre=explode(",",$row->genre);
                     
                     if(
    $genre[0]!="")
                     {
                        
    $genre_names=array();
                        for(
    $i=0;$i<count($genre);$i++)
                        {
                             
    $gen_id=$genre[$i];
                              
    $db->setQuery("SELECT * FROM #__categories".
                                        
    " where section='com_genre' and id=$gen_id");
                                        
                            
    $gen $db->loadObjectList();
                            
                            foreach (
    $gen as $genr)
                            {
                            
    $genre_names[]=$genr->title;
                            }
                        }
                        
    $genre_name=implode("/",$genre_names);
                     }
                     else
                        
    $genre_name="No Genre Defined";
                        
                    if(
    $j==0){  ?>
                    <tr> <?php }           
                 if(
    $j%3==0){?>
                        <tr><?php ?>
                 <td><a class="clsbg" href="<?php echo $this->baseurl."/".$profile_url ?>"><img src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$thumbnail?>&h=72&w=72&zc=1" /></a><p class="clsName1"><a href="<?php echo $this->baseurl."/".$profile_url ?>"><?php echo $row->name?></a></p></td>
                    <?php    
                    
    if(($j+1)%3==0){?>
                    </tr><?php $j++; 
                } 
    ?>        
                </tr>                    
                                    
                                    <tr>
                                        <td class="clsViewAll1" colspan="3"><a href="<?php echo JRoute::_'index.php?option=com_members&type=feature'); ?>"></a></td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                 </div>
            <div class="clsFeaturedRight">
              <h2>Top 10 Tracks</h2>
              <ul>
               <?php
                  $i
    =0;    
                   foreach (
    $this->topTracks as $topTrack
                 {
                     
    $i++;
                     
    $db = &JFactory::getDBO();
                     
    $sql "SELECT * FROM #__audios WHERE id =".$topTrack->song_id;
                    
    $db->setQuery($sql);
                    
    $row $db->loadObject();
                    
    $profile_url    =    ContentViewFrontpage::profile_url($row->uid);    
             
    ?>     
                <li <?php if($i==10){?>class="clsHomeNoPadd" <?php ?>><a href="<?=JRoute::_("index.php?option=com_content&task=audio_view&id=$topTrack->song_id")?>"><span><?=$i?></span><?=substr($row->name,0,30)?></a></li>
            <?php  ?>    
                
              </ul>
           </div>
          </div>
          <!--end of clsFeaturedArtist-->
          <!--clsTopArtiest-->
          <div class="clsTopAlbum">
        
            <table class="clsHeadingTable">
              <tr>
                <td><h2>Albums</h2></td>
                  <td class="clsViewAll1"><a href="<?php echo JRoute::_'index.php?option=com_albums&view=albums'); ?>"><img src="<?php echo $this->baseurl ?>/templates/default/images/main-viewall.jpg" /></a></td>
              </tr>
            </table>
            <table class="clsAlbumTable" >
            <tr>
            <?php
             
    if(count($this->albums)>0)
             {
               
    $i=0;
              foreach(
    $this->albums as $album)
                  {
                  
                    
    //thumbnail=    ContentViewFrontpage::profile_image($album->uid);
                     
    $profile_url=    ContentViewFrontpage::profile_url($album->uid);
                     
    $db = &JFactory::getDBO();
                     
    $sql "SELECT * FROM #__users WHERE id=".$album->uid;
                    
    $db->setQuery($sql);
                    
    $artist $db->loadObject();
                    
    //album image
                    
    $db->setQuery("SELECT * FROM #__albums WHERE id=$album->id");
                         
    $rows_albums     $db->loadObjectList();
                     
    $album->image=$rows_albums[0]->image;
                    
    $profile_url    =    ContentViewFrontpage::profile_url($row->uid);    
                    
                if(
    $i%3==0){?>
                        <tr><?php ?>
               
                    <td class="clsAlb1">
                        <div class="clsAlbumList ">
                            <a href="<?php echo JRoute::_("index.php?option=com_audios&view=album&id=$album->id")?>"><img src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/media/system/albums/thumb/<?=$album->image?>&h=58&w=66&zc=1"/></a>
                            <p class="clsAlbumListName"><a href="<?php echo JRoute::_("index.php?option=com_audios&view=album&id=$album->id")?>"><?=substr($album->name,0,15);?></a></p>
                            <p>Added by </p>
                            <p><?=$artist->name?></p>
                            
                        </div>                     
                    </td>
                    <?php    
                    
    if(($i+1)%3==0) {?>
                </tr>
                    <?php }    $i++;    
                   }
             } 
    ?>
                                 
              </tr>
            </table>
          </div>
          <!--clsTopArtiest-->
          <div class="clsRecentArt" >
          <div class="clsArt1"></div>
           <table class="clsHeadingTable">
              <tr>
                <td><h2>Recent Activities</h2></td>
                 <td class="clsViewAll1"><a href="<?php echo JRoute::_'index.php?option=com_recent&view=recent_activity'); ?>"><img src="<?php echo $this->baseurl ?>/templates/default/images/main-viewall.jpg" /></a></td>
              </tr>
            </table>
            <table class="clsAlbumTable" >
             <? 
            
    if(count($this->recent)>0)    
            {
    ?>
              <tr>
              <?php   
               
    foreach ($this->recent as $row
                {
                    
                             
    //thumbnail calculation
                             
    $thumbnail=ContentViewFrontpage::profile_image($row->user_id);
                             
    $profile_url=ContentViewFrontpage::profile_url_listener($row->user_id);
                             
    $db = &JFactory::getDBO();
                            
    $sql "SELECT * FROM #__users WHERE id=".$row->user_id;
                            
    $db->setQuery($sql);
                            
    $user $db->loadObject();
                             if(
    $user->usertype=='Artist')
                             {
                               
    $usertype="/";
                             }
                             else   
    $usertype="/listener/";
                       if(
    $row->type=='profile')
                       {                
                       
    ?>
                            <td class="clsAlb1">
                                <div class="clsAlbumList1 ">
                                    <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><img src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$thumbnail?>&h=98&w=98&zc=1" /></a>
                                    <p class="clsAlbumListName"><a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><?=$user->name?></a></p>
                                    <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><img class="clsAddImg" src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$thumbnail?>&h=15&w=20&zc=1" /></a>
                                    <p>New User  </p>
                                    <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><p><?=$user->name?></p></a>
                                    <p>Added to Volume</p>
                                </div>                     
                            </td>
                  <?php //if end for profile
                      
    if($row->type=='photo')
                        {    
                          
                          
    $db->setQuery("SELECT * FROM #__photos WHERE id=$row->type_id");
                          
    $rows_photos     $db->loadObjectList();
                          
                          foreach (
    $rows_photos as $row)
                          {    
                   
    ?>
                    <td class="clsAlb1">
                        <div class="clsAlbumList1 ">
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><img src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$row->thumbnail?>&h=98&w=98&zc=1" /></a>
                            <p class="clsAlbumListName"><a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><?=substr($user->name,0,13);?>'s Photo</a></p>
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><img class="clsAddImg"  src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$thumbnail?>&h=15&w=20&zc=1" /></a>
                            <p>New Photo  </p>
                            <p>Added By</p>
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><p><?=$user->name?></p></a>
                            
                        </div>                     
                    </td>
                    <?php 
                      } 
    //if end for photo?>
                <?php 
                      
    if($row->type=='album')
                        {    
                          
                          
    $db->setQuery("SELECT * FROM #__albums WHERE id=$row->type_id");
                          
    $rows_albums     $db->loadObjectList();
                          foreach (
    $rows_albums as $album)
                          {    
                   
    ?>
                    <td class="clsAlb1">
                        <div class="clsAlbumList1 ">
                            <a href="index.php?option=com_audios&view=album&id=<?=$album->id?>"><img src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/media/system/albums/thumb/<?=$album->image?>&h=98&w=98&zc=1" /></a>
                            <p class="clsAlbumListName"><a href="index.php?option=com_audios&view=album&id=<?=$album->id?>"><?=$album->name;?></a></p>
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><img class="clsAddImg" src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$thumbnail?>&h=15&w=20&zc=1" /></a>
                            <p>New Album</p>
                            <p>Added By</p>
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><p><?=$user->name?></p></a>
                            
                        </div>                     
                    </td>
                    <?php 
                      } 
    //if end for album?>
                <?php 
                      
    if($row->type=='video')
                        {    
                          
                          
    $db->setQuery("SELECT * FROM #__videos WHERE id=$row->type_id");
                          
    $rows_videos     $db->loadObjectList();
                          foreach (
    $rows_videos as $video)
                          {    
                   
    ?>
                    <td class="clsAlb1">
                        <div class="clsAlbumList1 ">
                            <a href="index.php?option=com_videos&view=show&id=<?=$video->id?>"><img src="<?=$video->image_url?>" width="98" height="98" /></a>
                            <p class="clsAlbumListName"><a href="index.php?option=com_videos&view=show&id=<?=$video->id?>"><?=substr($video->title,0,27);?></a></p>
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><img class="clsAddImg" src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$thumbnail?>&h=15&w=20&zc=1" /></a>
                            <p>New Video</p>
                            <p>Added By</p>
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><p><?=$user->name?></p></a>
                            
                         </div>                     
                    </td>
                    <?php 
                      } 
    //if end for video?>
                <?php 
                      
    if($row->type=='music')
                        {    
                          
                          
    $db->setQuery("SELECT * FROM #__audios WHERE id=$row->type_id");
                          
    $rows_musics     $db->loadObjectList();
                          
    $album_id=$rows_musics[0]->album_id;
                          
    $db->setQuery("SELECT * FROM #__albums WHERE id=$album_id");
                          
    $rows_albums     $db->loadObjectList();
                          
    $album->image=$rows_albums[0]->image;
                          foreach (
    $rows_musics as $music)
                          {    
                           
                   
    ?>
                    <td class="clsAlb1">
                        <div class="clsAlbumList1 ">
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><img src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/media/system/albums/thumb/<?=$album->image?>&h=98&w=98&zc=1" /></a>
                            <p class="clsAlbumListName"><a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><?php echo substr($music->name,0,27);?></a></p>
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>"><img class="clsAddImg" src="<?php echo $this->baseurl ?>/timthumb.php?src=<?php echo $this->baseurl ?>/<?=$thumbnail?>&h=15&w=20&zc=1" /></a>
                            <p>New Music</p>
                            <p>Added By</p>
                            <a href="<?php echo $this->baseurl."$usertype".$profile_url ?>" style="text-decoration:none"><p><?=$user->name?></p></a>
                            
                        </div>                     
                    </td>
                    <?php 
                
                        } 
    //if end for music?>
                <? //for each end  
                
    }?>
                </tr>
                
            </table>
            <div class="clsArt1"></div>
          </div>
          <!--end of clsTopArtiest-->
        
        </div> <!--end of main-->
    thanks
    Last edited by Inigoesdr; Apr 5, 2009, 07:08 PM.

  • #2
    My guess is that close to, or on line 128 you have an extra } which should be deleted.











    -----
    Leonard Whistler

    Comment


    • #3
      thanks so much! Len Whistler

      I tried to delete it but give me another error :

      Parse error:
      syntax error, unexpected $end in D:\mysite\www\music2\components\com_content\views\frontpage\tmpl\default.php on line 370
      Last edited by simotori; Apr 5, 2009, 07:39 PM.

      Comment


      • #4
        Hi, this is line 128

        PHP Code:
          <tr> <?php }
        your else tag doesn't have an opening bracket. Change it to this

        PHP Code:
        else {
                            $genre_name="No Genre Defined";

                        if($j==0) ?>
                        <tr> <?php }
        Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

        Comment


        • #5
          thanks masterofollies

          Originally posted by masterofollies View Post
          Hi, this is line 128

          PHP Code:
            <tr> <?php }
          your else tag doesn't have an opening bracket. Change it to this

          PHP Code:
          else {
                              $genre_name="No Genre Defined";

                          if($j==0) ?>
                          <tr> <?php }

          I tried to open it but always the same problem

          Comment

          Working...
          X