Hierarchy: Head Functions

From Dreamwidth Notes
Revision as of 06:11, 8 May 2009 by Seperis (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Documentation here.

print_head function

Associated Classes

class Page
Functions
function print_head [fixed];

Print server side supplied head content. This is a fixed function, so you can't override it. See [method[Page.print_custom_head()]] if you want to supply custom head content.

Structure
 
function Page::print_head() 
{
    print $.head_content;
    $this->print_custom_head();
}
function Page::print_custom_head() 
{
    # blank
}

Layers can override this to add extra HTML to the head section of the HTML document. Note that layouts are not intended to override this method.


Variables
var readonly string head_content;

Extra tags supplied by the server to go in the <head> section of the output HTML document. Layouts should include this in the head section if they are writing HTML.

print_head_title function

Class Page
Functions
function print_head_title;

Print the title for this particular page, as in print_title, formatted with title and the journal username

Structure
function Page::print_head_title() 
{
    if ($this.journal.journal_type == "I") 
    {
    print """<title>""" + $this.journal.name + $*text_default_separator + $this->view_title() + """</title>\n""";
    }
    else 
    {
    print """<title>""" + $this.journal.username + $*text_default_separator + $this->view_title() + """</title>\n""";
    }
}
function Page::view_title() [notags] : string 
{
    return lang_viewname($.view);
}

Return a title for this particular page, such as \"Friends' Recent Entries\" for the friends view, or a date for the day view. Should be overridden in i18n layers. Ideally, layout layers should never override this. See [method[Page.title()


function lang_viewname(string viewid) [notags] : string
{
    if ($viewid == "recent") { return $*text_view_recent; }
    if ($viewid == "archive") { return $*text_view_archive; }
    if ($viewid == "read") { return $*text_view_friends; }
    if ($viewid == "day") { return "Day"; }
    if ($viewid == "month") { return "Month"; }
    if ($viewid == "userinfo") { return $*text_view_userinfo; }
    if ($viewid == "entry") { return "Read Comments"; }
    if ($viewid == "reply") { return "Post Comment"; }
    if ($viewid == "tags") { return "Tags"; }
    if ($viewid == "memories") { return $*text_view_memories; }
    return "Unknown View";
}

Overriding this function is NOT RECOMMENDED. Overriding this function could prevent sitewide improvements to styles, accessibility, or other functionality from operating in your layout. Sets strings according to layer or wizard supplied string properties.

Properties:
property string text_default_separator 
{
    des = "Text used to separate items";
    maxlength = 5;
    "size" = 5;
    example = " | ";
}
 
property string text_view_recent 
{
    des = "Text used to link to the 'Recent Entries' view";
    maxlength = 20;
    "size" = 15;
    example = "Recent Posts";
}
property string text_view_friends 
{
    des = "Text used to link to the 'Reading' view";
    maxlength = 20;
    "size" = 15;
    example = "My Reading Page";
}
 
property string text_view_archive 
{
    des = "Text used to link to the 'Archive' view";
    maxlength = 20;
    "size" = 15;
    example = "Journal Archive";
}
property string text_view_userinfo 
{
    des = "Text used to link to the 'User Information' view";
    maxlength = 20;
    "size" = 15;
    example = "My Profile";
}
property string text_view_memories 
{
    des = "Text used to link to the 'Memories' view";
    maxlength = 20;
    "size" = 15;
    example = "My Memories";
}
 
set text_default_separator  = " | ";
set text_view_recent = "Recent Entries";
set text_view_friends = "Reading";
set text_view_archive = "Archive";
set text_view_userinfo = "Profile";
set text_view_memories = "Memories";