2010-09-05 84 views
0

我不是一个程序员。我试图找出如何得到这个代码插入profile.php需要帮助,插入代码

$author_id = get_query_var('author'); 

if($author_id){ 
echo do_shortcode("[photosmash gallery_type='contributor' author=" . $author_id . " no_form=true]"); 
} 

下面是profile.php代码:

<?php global $mngl_user, $mngl_friend, $mngl_options; ?> 
<?php $display_profile = ($user->privacy == 'public' or 
          MnglUser::is_logged_in_and_an_admin() or 
          MnglUser::is_logged_in_and_visible()); ?> 

<table class="mngl-profile-table"> 
    <tr> 
    <td valign="top" class="mngl-profile-table-col-1 mngl-valign-top"> 
     <table> 
     <tr> 
      <td> 
      <?php echo $avatar; ?> 
      <?php echo $mngl_friends_controller->display_add_friend_button($mngl_user->id, $user->id); ?> 
      <?php echo do_action('mngl-profile-display',$user->id); ?> 
      </td> 
     </tr> 
     <tr> 
      <td valign="top" class="mngl-valign-top"> 
      <?php if($display_profile) { ?> 

       <?php if(isset($mngl_options->field_visibilities['profile_front']['bio']) and !empty($user->bio)) { ?> 
       <p class="mngl-profile-bio"><?php echo MnglBoardsHelper::format_message($user->bio); ?></p> 
       <?php } ?> 
       <div class="mngl-profile-information"> 
       <?php if(isset($mngl_options->field_visibilities['profile_front']['name']) and !empty($user->first_name) and ($user->first_name != $user->screenname)) { ?> 
       <p class="mngl-profile-field"><strong><?php _e('Name', 'mingle'); ?>:</strong><br/><?php echo wptexturize(stripslashes($user->first_name)); ?> 
       <?php if(!empty($user->last_name)){ ?> 
       <?php echo " " . wptexturize(stripslashes($user->last_name)); ?> 
       <?php } ?> 
       </p> 
       <?php } ?> 
       <?php if(isset($mngl_options->field_visibilities['profile_front']['sex']) and !empty($user->sex)) { ?> 
       <p class="mngl-profile-sex"><strong><?php _e('Gender', 'mingle'); ?>:</strong><br/><?php echo $user->sex_display; ?></p> 
       <?php } ?> 

       <?php if(isset($mngl_options->field_visibilities['profile_front']['location']) and !empty($user->location)) { ?> 
       <p class="mngl-profile-location"><strong><?php _e('Location', 'mingle'); ?>:</strong><br/><?php echo wptexturize($user->location); ?></p> 
       <?php } ?> 
       <?php if(isset($mngl_options->field_visibilities['profile_front']['birthday']) and !empty($user->birthday)) { ?> 
       <p class="mngl-profile-location"><strong><?php _e('Birthday', 'mingle'); ?>:</strong><br/><?php echo wptexturize($user->birthday); ?></p> 
       <?php } ?> 
       <?php if(isset($mngl_options->field_visibilities['profile_front']['url']) and !empty($user->url)) { ?> 
       <p class="mngl-profile-url"><strong><?php _e('Website', 'mingle'); ?>:</strong><br/><?php echo make_clickable($user->url); ?></p> 
       <?php } ?> 
       </div> 
      <?php } ?> 
      <p><strong><?php _e('Friends', 'mingle'); ?>:</strong><div class="mngl-profile-friend-grid-wrap"><?php echo $mngl_friends_controller->display_friends_grid($user->id); ?></div></p> 
      </td> 
     </tr> 
     </table> 
    </td> 
    <td valign="top" class="mngl-profile-table-col-2"> 
     <table class="mngl-profile-body"> 
     <tr> 
      <td> 
      <div class="mngl-profile-name"><?php echo $user->screenname; ?></div> 
      <?php 
       if(!$display_profile) 
       require(MNGL_VIEWS_PATH . '/mngl-boards/private.php'); 
      ?> 
      </td> 
     </tr> 
     <tr> 
      <td> 
      </td> 
     </tr> 
     <tr> 
      <?php if($display_profile) { ?> 
      <td valign="top" width="100%"><div class="mngl-board"><?php echo $mngl_boards_controller->display($user->id); ?></div></td> 
      <?php } ?> 
     </tr> 
     </table> 
    </td> 
</table> 

回答

2

需要被封闭在<?php?>新的代码。然后将其插入任意空白的HTML区域,例如底部的空<td></td>之间。如果在其他地方看起来更好,请移动它。对于非程序员来说,这是一个试验结束错误的方法。请注意不要将其插入任何<?php if(...<?php } ?>区域。