Modifying the Page Header

Aug 08, 2005 17:04

This tutorial will allow you to modify the Page Header by adding a header image, blocking the title/subtitle from appearing, or modifying the header links. Because this requires overriding functions in theme layers, it is for paid users only.

If you have not already made a custom theme layer for your layout, please see the Intro to Layers and follow steps 1, 2 and 4. Otherwise just edit your layer and add the following to the end of it.

Part 1: Changing what appears in the header

If you want to add an image header or remove the title/subtitle, copy the following function and place it in your layer:
function Page::lay_print_header() {
var string headerimageurl = "PutImageUrlHereOrLeaveEmpty";
var string title = $.global_title;
var string subtitle = $.global_subtitle;
"""

""";
if ($headerimageurl!="") {"""

"""; }
if ($*layout_header_usericon=="show") {"""
$this.journal.default_pic"""; }
if ($title!="") { """
$title"""; }
if ($subtitle!="") { """
$subtitle"""; }
$this->lay_print_header_links();
"""

""";
}Put the Internet URL for your image (eg. http://www.somewhere.com/image.jpg) in between the quotation marks as shown in red. If you do not have a header image, leave it blank (ie. nothing between the two quotation marks). The code above will center the image on your header because of the and tags. If you want it left aligned, just remove those tags.

If you want to remove the journal title or subtitle because you don't want them to appear, say if you have them built into your image, then remove the necessary lines in the code shown in blue.

If you what a border above the header to match with the borders around they menu, you will need to go into the Wizard, and under the Layout tab, in the "Custom Stylesheet Information" box, enter the following:
.pageheaderblock { border-top: 2px solid #FFFFFF; }You will also need to replace the colour code in blue with the colour that is used for the "Headerbar Borders" property under the Colour tab of the Wizard.

Part 2: Changing/Adding Header Links

If you want to change the links that appear in your header or add new links, copy the following function and place it in your layer:
function Page::lay_print_header_links() {
# Menu start - do not modify
"""
    """;

    # Journal Navigation (Previous page, Next Page) - modify through the wizard
    var string prev_link = $this->lay_get_previous_url();
    var string prev_title = $this->lay_get_previous_title();
    var string next_link = $this->lay_get_next_url();
    var string next_title = $this->lay_get_next_title();
    print ($prev_link==""?"":"
  • $prev_title
  • ");
    print ($next_link==""?"":"
  • $next_title
  • ");

    # Standard Journal Pages (Recent, Archive, Friends, Userinfo) - modify link names through wizard.
    # The order is defined by the system, and uses an array as more links could be added in the future.
    foreach var string v ($.views_order) {
    if (lang_viewname($v)!="") {
    print "
  • "+lang_viewname($v)+"
  • ";
    }
    }

    # Memories - modify through the wizard
    if ($*layout_menubar_memories) {
    """
  • $*text_view_memories
  • """;
    }

    # Guestbook - modify through the wizard
    if (int($*layout_guestbook_entryid)!=0) {
    var string guestbook_url = "$*SITEROOT/users/$.journal.username/"+$*layout_guestbook_entryid+".html";
    """
  • $*text_view_guestbook
  • """;
    }

    # Website from Userinfo page - modify through the userinfo page
    if ($*layout_menubar_website) { """
  • $.journal.website_name
  • """; }

    # Sample line for a new link at the end of the menu bar. Remove the # mark in front to make it active and
    # set the values for NEW_LINK_URL and NEW_LINK_TEXT in the line below to be the url and link text
    # to appear in the header. You can repeat this line as many times as you want.
    # """
  • NEW_LINK_URL">NEW_LINK_TEXT
  • """;

    # Menu end - do not modify
    """
""";
}Lines in green are comments that say what each portion of this function is. At the end of the function is a sample line that you can use to add new lines onto the end of your menu bar, or if you wish, move the sample line around in the function to place new links where you would like them to appear.

Someone asked once how to split the Friends Page single link into a pair of links for users and communities, so I'm going to repeat it here since it is related. To change that system link, replace the three lines in blue above, with the following lines and modify the text in red below to be what you want to appear in the menu:
if (lang_viewname($v)=="friends") {
print "
  • Friends
  • ";

    print "
  • Communities
  • ";
    } elseif (lang_viewname($v)!="") {
    print "
  • "+lang_viewname($v)+"
  • ";
    }Note that you can change those two lines to be any number/combination of links you would like, in case you have more than just two groups you would like to show, by modifying the blue sections as well. ?show=Y would give you Syndicated feeds or if you had a friends group named "trustedpeople", trustedpeople/ would give you the the friends page for that named group. The possibilities are endless.

    Enjoy!

    header, tutorial

    Previous post Next post
    Up