Difference between revisions of "Hierarchy: Head Functions"
From Dreamwidth Notes
(→print_head function) |
|||
Line 12: | Line 12: | ||
function print_head [fixed]; | function print_head [fixed]; | ||
</source> | </source> | ||
− | 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. | + | :::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 | ::Structure | ||
− | <source lang="perl"> | + | ::<source lang="perl"> |
function Page::print_head() | function Page::print_head() | ||
{ | { | ||
Line 24: | Line 24: | ||
</source> | </source> | ||
− | <source lang="perl"> | + | ::<source lang="perl"> |
function Page::print_custom_head() | function Page::print_custom_head() | ||
{ | { | ||
Line 30: | Line 30: | ||
} | } | ||
</source> | </source> | ||
− | 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. | + | :::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 | ::Variables | ||
− | <source lang="perl"> | + | ::<source lang="perl"> |
var readonly string head_content; | var readonly string head_content; | ||
</source> | </source> | ||
− | 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. | + | :::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== | ==print_head_title function== |
Revision as of 06:12, 8 May 2009
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";