Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

Team Page Configuracion

Aloittaja Aportadordelmix, maaliskuu 10, 2011, 09:28:56 IP

« edellinen - seuraava »

Aportadordelmix

Hola! Estoy tratanto de usar este código en una página PHP en simpleportal. Lo puedo previzualizar bien, pero el tema es que cuando doy click en guardar la página, me sale el siguiente error:

¡Un error ha ocurrido!
Hay un error de sintaxis en el código del bloque. Por favor, revisa el código.


A qué se debe ese error?

<?php 

   
global $txt$scripturl$user_info;
   global 
$context$modSettings$id_member;
   global 
$board_info$settings$db_prefix$smcFunc;

/////////////////////////////////////////////////////////////////  Enter the desired groups
   
$groups_list = array(1,2);
/////////////////////////////////////////////////////////////////
   
$groups_query1 'mem.id_group IN ({array_int:groups1})';
   
$groups_query2 '';
//   $groups_query2 = ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';



          
echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #282828; padding-bottom: 2px; "><h2>Our Team</h2>
      <span class="middletext">These are the people you will run into while visiting bluedevilcustoms.com</span><br /><br />
      </td></tr></table>'
;


   
$loaded_ids = array();
    
$user_profile=array();
    
$memberContext=array();
    
$profile=array();
    
$context['team']=array();

   
// Load the member's data.
      
$request $smcFunc['db_query']('''
         SELECT IFNULL(lo.log_Time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
            mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
            mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
         FROM {db_prefix}members AS mem
            INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
            LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
            LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
            LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = {string:theme_var} AND them.ID_THEME=1)
         WHERE (' 
$groups_query1 $groups_query2 ')
         ORDER BY mem.posts DESC'
,
         array(
             
'groups1' => $groups_list,
             
'theme_var' => 'teamtext',
         )
   );
   
$new_loaded_ids = array();
   while (
$row mysql_fetch_assoc($request))
   {

         
$avatar_width '';
         
$avatar_height '';

      
$context['team'][] = array(
      
'username' => $row['member_name'],
      
'name' => $row['real_name'],
      
'groupname' => $row['group_name'],
      
'posts' => $row['posts'],
      
'location' => $row['location'],
      
'href' => $scripturl '?action=profile;u=' $row['id_member'],
      
'link' => '<a href="' $scripturl '?action=profile;u=' $row['id_member'] . '" title="' $txt['profile_of'] . ' ' $row['real_name'] . '">' $row['real_name'] . '</a>',
      
'blurb' => $row['personal_text'],
      
'avatar' => array(
         
'name' => $row['avatar'],
         
'image' => $row['avatar'] == '' ? ($row['id_attach'] > '<img  src="' . (empty($row['attachment_type']) ? $scripturl '?action=dlattach;attach=' $row['id_attach'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) . '" alt="" class="avatar2" border="0" />' '') : (stristr($row['avatar'], 'http://') ? '<img src="' $row['avatar'] . '"' $avatar_width $avatar_height ' alt="" class="avatar2" border="0" />' '<img src="' $modSettings['avatar_url'] . '/' htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
         
'href' => $row['avatar'] == '' ? ($row['id_attach'] > ? (empty($row['attachmentType']) ? $scripturl '?action=dlattach;attach=' $row['id_attach'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar']),
         
'url' => $row['avatar'] == '' '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar'])
      ),
      
'last_login' => empty($row['last_login']) ? $txt['never'] : timeformat($row['last_login']),
      
'last_login_timestamp' => empty($row['last_login']) ? forum_time(0$row['last_login']),
      
'website' => array(
         
'title' => $row['website_title'],
         
'url' => $row['website_url']),
      
'online' => array(
         
'is_online' => $row['is_online'],
         
'text' => &$txt[$row['is_online'] ? 'online' 'offline'],
         
'image_href' => $settings['images_url'] . '/' . ($row['is_online'] ? 'useron' 'useroff') . '.gif',
      ),
      
'teamtext' => $row['teamtext'],
   );


   }
   
mysql_free_result($request);

   echo 
'<table align="center" width="95%" cellpadding="5" cellspacing="5" style="margin-top: 10px;"><tr>';

    
$newrow=0;
   foreach(
$context['team'] as $team)
        {
            echo 
'
<td valign="top" align="right" width="5%">'
.$team['avatar']['image'].'</td>
<td valign="top" width="45%" class="windowbg3 team" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'
.$team['link'].'</h2>
<b>Position</b>: '
.$team['groupname'].'<br />
<b>Last seen</b>: '
.$team['last_login'].'<br />
<b>Posts</b>: '
.$team['posts'].'<br />
, !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' '' '
, !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' '' '
,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' $team['online']['text'].'<br />' '

, !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' '' '

,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' '' '

    </div></td>'
;
            
$newrow++;
            if(
$newrow>1){
               
$newrow=0;
               echo 
'</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
   echo 
'</tr></table>';
   
   
?>


Esto es compatible solo para 2.0

Mick.

No te haces falta esto:

<?php

?>



Simplemente use esta parte:
   global $txt, $scripturl, $user_info;
   global $context, $modSettings, $id_member;
   global $board_info, $settings, $db_prefix, $smcFunc;

/////////////////////////////////////////////////////////////////  Enter the desired groups
   $groups_list = array(1,2);
/////////////////////////////////////////////////////////////////
   $groups_query1 = 'mem.id_group IN ({array_int:groups1})';
   $groups_query2 = '';
//   $groups_query2 = ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';



          echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #282828; padding-bottom: 2px; "><h2>Our Team</h2>
      <span class="middletext">These are the people you will run into while visiting bluedevilcustoms.com</span><br /><br />
      </td></tr></table>';


   $loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['team']=array();

   // Load the member's data.
      $request = $smcFunc['db_query']('', '
         SELECT IFNULL(lo.log_Time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
            mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
            mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
         FROM {db_prefix}members AS mem
            INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
            LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
            LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
            LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = {string:theme_var} AND them.ID_THEME=1)
         WHERE (' . $groups_query1 . $groups_query2 . ')
         ORDER BY mem.posts DESC',
         array(
             'groups1' => $groups_list,
             'theme_var' => 'teamtext',
         )
   );
   $new_loaded_ids = array();
   while ($row = mysql_fetch_assoc($request))
   {

         $avatar_width = '';
         $avatar_height = '';

      $context['team'][] = array(
      'username' => $row['member_name'],
      'name' => $row['real_name'],
      'groupname' => $row['group_name'],
      'posts' => $row['posts'],
      'location' => $row['location'],
      'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['real_name'] . '">' . $row['real_name'] . '</a>',
      'blurb' => $row['personal_text'],
      'avatar' => array(
         'name' => $row['avatar'],
         'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img  src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
         'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
         'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
      ),
      'last_login' => empty($row['last_login']) ? $txt['never'] : timeformat($row['last_login']),
      'last_login_timestamp' => empty($row['last_login']) ? 0 : forum_time(0, $row['last_login']),
      'website' => array(
         'title' => $row['website_title'],
         'url' => $row['website_url']),
      'online' => array(
         'is_online' => $row['is_online'],
         'text' => &$txt[$row['is_online'] ? 'online' : 'offline'],
         'image_href' => $settings['images_url'] . '/' . ($row['is_online'] ? 'useron' : 'useroff') . '.gif',
      ),
      'teamtext' => $row['teamtext'],
   );


   }
   mysql_free_result($request);

   echo '<table align="center" width="95%" cellpadding="5" cellspacing="5" style="margin-top: 10px;"><tr>';

    $newrow=0;
   foreach($context['team'] as $team)
        {
            echo '
<td valign="top" align="right" width="5%">'.$team['avatar']['image'].'</td>
<td valign="top" width="45%" class="windowbg3 team" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Position</b>: '.$team['groupname'].'<br />
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
   echo '</tr></table>'

Aportadordelmix

Bluedevil, con ese código me devuelve el siguiente error:


Parse error: syntax error, unexpected $end, expecting ',' or ';' in public_html/Sources/Subs-Portal.php(1155) : eval()'d code on line 109

Útilizando el mod Simple Portal

Mick.

El codigo que postee no tenia una coma.  Use este.
   global $txt, $scripturl, $user_info;
   global $context, $modSettings, $id_member;
   global $board_info, $settings, $db_prefix, $smcFunc;

/////////////////////////////////////////////////////////////////  Enter the desired groups
   $groups_list = array(1,2);
/////////////////////////////////////////////////////////////////
   $groups_query1 = 'mem.id_group IN ({array_int:groups1})';
   $groups_query2 = '';
//   $groups_query2 = ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';



          echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #282828; padding-bottom: 2px; "><h2>Our Team</h2>
      <span class="middletext">These are the people you will run into while visiting bluedevilcustoms.com</span><br /><br />
      </td></tr></table>';


   $loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['team']=array();

   // Load the member's data.
      $request = $smcFunc['db_query']('', '
         SELECT IFNULL(lo.log_Time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
            mem.personal_text, mem.avatar, mem.id_member, mem.member_name, mem.real_name , mem.last_login, mem.website_title,
            mem.website_url, mem.location, mem.posts, them.value AS teamtext, g.group_name
         FROM {db_prefix}members AS mem
            INNER JOIN {db_prefix}membergroups AS g ON (mem.id_group = g.id_group)
            LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
            LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
            LEFT JOIN {db_prefix}themes AS them ON (mem.id_member = them.id_member AND them.variable = {string:theme_var} AND them.ID_THEME=1)
         WHERE (' . $groups_query1 . $groups_query2 . ')
         ORDER BY mem.posts DESC',
         array(
             'groups1' => $groups_list,
             'theme_var' => 'teamtext',
         )
   );
   $new_loaded_ids = array();
   while ($row = mysql_fetch_assoc($request))
   {

         $avatar_width = '';
         $avatar_height = '';

      $context['team'][] = array(
      'username' => $row['member_name'],
      'name' => $row['real_name'],
      'groupname' => $row['group_name'],
      'posts' => $row['posts'],
      'location' => $row['location'],
      'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['real_name'] . '">' . $row['real_name'] . '</a>',
      'blurb' => $row['personal_text'],
      'avatar' => array(
         'name' => $row['avatar'],
         'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img  src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
         'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
         'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
      ),
      'last_login' => empty($row['last_login']) ? $txt['never'] : timeformat($row['last_login']),
      'last_login_timestamp' => empty($row['last_login']) ? 0 : forum_time(0, $row['last_login']),
      'website' => array(
         'title' => $row['website_title'],
         'url' => $row['website_url']),
      'online' => array(
         'is_online' => $row['is_online'],
         'text' => &$txt[$row['is_online'] ? 'online' : 'offline'],
         'image_href' => $settings['images_url'] . '/' . ($row['is_online'] ? 'useron' : 'useroff') . '.gif',
      ),
      'teamtext' => $row['teamtext'],
   );


   }
   mysql_free_result($request);

   echo '<table align="center" width="95%" cellpadding="5" cellspacing="5" style="margin-top: 10px;"><tr>';

    $newrow=0;
   foreach($context['team'] as $team)
        {
            echo '
<td valign="top" align="right" width="5%">'.$team['avatar']['image'].'</td>
<td valign="top" width="45%" class="windowbg3 team" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Position</b>: '.$team['groupname'].'<br />
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
   echo '</tr></table>';


Aportadordelmix

Usando una pagina PHP de simpleportal, me pasa lo mismo:

¡Un error ha ocurrido!
Hay un error de sintaxis en el código del bloque. Por favor, revisa el código.


Qué puede ser? También quiero poner una medida a los avatares, cómo se hace?

Advertisement: