kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

k1-ifyed print_profile(Page p) with a couple extra options. yay.

###################################
#       EDITING THE PROFILE       #
# kunzite1, component-help/641924 #
# overrides print_profile(Page p) #
###################################
function print_profile(Page p) {
  var string one   = "<div><b>";
  var string two   = "</b> ";
  var string three = "</div>";

  var string text_profile_user          = "User:";
  var string text_profile_name          = "Name:";
  var string text_profile_website       = "Website:";
  var string text_profile_age           = "Age:";
  var string text_profile_age_text      = ""; # age, ex: 21
  var string text_profile_location      = "Location:";
  var string text_profile_location_text = ""; # location goes here, ex: San Francisco, CA
  var string text_profile_email         = "Email:";
  var string text_profile_email_text    = ""; # email addy goes here, ex: exampleusername@livejournal.com

  print_comp_header($*profile_text);
  """
  <table cellspacing="0" cellpadding="0" border="0">
  """;

# if default pic, print it
  if($p.journal.default_pic){
  """
    <tr>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
      <td align="center"><a href="$p.journal.userpic_listing_url"><img src="$p.journal.default_pic.url" width="$p.journal.default_pic.width" height="$p.journal.default_pic.height" alt="$p.journal.name" title="$p.journal.name" border="1" vspace="4" class="userPic" /></a></td>
      <td width="50%" align="center">
        <div class="shortLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
        <div class="shortLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
    </tr>
  """;
  }

# username and real name
  """
    <tr>
      <td colspan="3" class="compContent">
        $one$text_profile_user$two$p.journal$three
        $one$text_profile_name$two$p.journal.name$three
  """;

# if website, print it
  if($p.journal.website_url != ""){
    var string website_name = $p.journal.website_name != "" ? $p.journal.website_name : $*text_website_default_name;
  """        $one$text_profile_website$two<a href="$p.journal.website_url">$website_name</a>$three""";
  }

# if age, print it
  if($text_profile_age_text != ""){
    """$one$text_profile_age$two$text_profile_age_text$three""";
  }

# if location, print it
  if($text_profile_location_text != ""){
    """$one$text_profile_location$two$text_profile_location_text$three""";
  }

# if email, print it
  if($text_profile_email_text != ""){
    """$one$text_profile_email$two<a href="mailto:$text_profile_email_text">$text_profile_email_text</a>$three""";
  }
  """
      </td>
    </tr>
  </table>
  """;
  print_comp_footer();
}
Tags: !tutorial, *account level: paid/perm, function: print_profile, user: kunzite1
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic
  • 66 comments