"""; $this->print_body(); """
Hierarchy
There are three components to core2 styles: classes, properties, and functions. This will be a short overview of the hierarchy of class and functions and how they associate with each other.
Below are the tables of core2 classes and functions associated with view. Each child is listed below and to the right of the parent.
Contents
Table of Classes
- Date
- DateTime
- Image
- Link
- ItemRange
- CommentInfo
- UserLink
- UserLite
- User
- Friend
- EntryLite
- Entry
- Comment
- Tag
- TagDetail
- Redirector
- Page
- TagsPage
- MessagePage
- RecentPage
- FriendsPage
- DayPage
- YearPage
- MonthPage
- EntryPage
- ReplyPage
- RecentNav
- YearYear
- YearDay
- MonthDay
- YearWeek
- YearMonth
- MonthEntryInfo
- ReplyForm
- PalItem
Explanation of Classes
Table of View-Related Functions
- Page
- TagsPage
- MessagePage
- RecentPage
- FriendsPage
- DayPage
- YearPage
- MonthPage
- EntryPage
- ReplyPage
- MonthDay
- YearWeek
- Comment
- CommentInfo
- Entry
Explanation of View-Related Functions
Function: Page
Page is the center of core2 design. Changes to anything in a Page function affects all layouts unless they are edited separately. Below is a list of all functions associated with Page.
In each function associated with View, there's a function Name::xfunction. This is to tell xfunction what View it is affecting.
CSS Functions
This adds CSS to all layouts in your theme.
function Page::print_default_stylesheet() { """<style type="text/css">"""; start_css(); end_css(); """</style>\n"""; }
If you have specific CSS to code onto all themes using this layout, override print_default_stylesheet. If you have specific CSS to code into this theme, set the external_stylesheet property or override the print_stylesheet function. An end user can choose to link to an off-site stylesheet using the linked_stylesheet property and/or use the custom_css property. Overriding this function is NOT RECOMMENDED. Overriding this function could prevent sitewide improvements to styles, accessibility, or other functionality from operating in your layout.
function Page::print_stylesheets() { if ($*include_default_stylesheet) { $this->print_default_stylesheet(); if ($*external_stylesheet) { println safe """<link rel="stylesheet" href="$.stylesheet_url" type="text/css" />"""; } else { println """<style type="text/css">"""; start_css(); print_stylesheet(); end_css(); println """</style>"""; } }
if ($*linked_stylesheet != "") { println safe """<link rel="stylesheet" href="$*linked_stylesheet" type="text/css" />"""; }
if ($*custom_css != "") { println """<style type="text/css">"""; start_css(); println safe $*custom_css; end_css(); println """</style>"""; } }
Title Functions
Using standard CSS, print the journal title. If you want to change the way this looks, modify the CSS.
Note: Holy God, why is global doing that? Gah.
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::print_global_title() { if ($.global_title){"""
""" + $.global_title + """
""";} }
function Page::print_global_subtitle() { if ($.global_subtitle){"""
""" + $.global_subtitle + """
""";} }
function Page::view_title() [notags] : string { return lang_viewname($.view); }
function Page::title() [notags] : string { return $this->view_title(); }
Wrapper Functions
function Page::print_wrapper_start() { $this->print_wrapper_start( { "" => "" } ); }
function Page::print_wrapper_start(string{} opts) {
var string class = $opts{"class"} ? """class="$opts{"class"}" """ : ""; """<body class="page-$.view $*layout_type $class">\n"""; }
"This function concludes the wrapper to the page. Overriding this function is NOT RECOMMENDED. Overriding this function could prevent sitewide improvements to styles, accessibility, or other functionality from operating in your layout."
function Page::print_wrapper_end() { """</body>"""; }
Layout Functions
This is the layout of your entire dw journal.
function Page::print() { """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n<head profile="http://www.w3.org/2006/03/hcard http://purl.org/uF/hAtom/0.1/ http://gmpg.org/xfn/11">\n"""; $this->print_head(); $this->print_stylesheets(); $this->print_head_title(); """</head>"""; $this->print_wrapper_start(); $this->print_control_strip(); """
"""; $this->print_global_title(); $this->print_global_subtitle(); $this->print_title(); """
"""; $this->print_module_section("one"); """
"""; $this->print_module_section("two"); """
"""; """
"""; $this->print_wrapper_end(); """</html>"""; }
function Page::print_body() {"""
No Default Renderer
There is no body renderer for viewtype $.view defined.
""";}
function Page::print_module_section ( string section_name ) {"""
handle_module_group_array( $*module_sections{$section_name} );"""
}
Date Functions
function Page::print_time() { $this->print_time("",""); }
function Page::print_time(string datefmt, string timefmt) { if ($datefmt == "") { $datefmt = "med"; } if ($timefmt == "") { $timefmt = "short"; }
var string ret; if ($datefmt != "none") { $ret = $ret + $this.local_time->date_format($datefmt); } if ($datefmt != "none" and $timefmt != "none") { $ret = $ret + " "; } if ($timefmt != "none") { $ret = $ret + $this.local_time->time_format($timefmt); }
print safe """$*text_generated_on $ret""";
}
function Page::print_navigation() {}
Head Functions
function Page::print_head() { print $.head_content; $this->print_custom_head(); }
function Page::print_custom_head() { # blank }
function Page::print_linklist() {
if (size $.linklist <= 0) { return; } elseif (not $*linklist_support) { return; }
foreach var UserLink l ($.linklist) { if ($l.title) { if ($l.is_heading) { "$l.title"; } else { "<a href='$l.url'>$l.title</a>"; } } "
"; } }
Print Entry
This is how all the functions used for a basic layout fit together. This function will affect how you see your Recent Entries, your Reading Page, and your individual entry page.
function Page::print_entry(Entry e) { $e->print_wrapper_start();"""
$e->print_subject(); $e->print_metatypes(); $e->print_time();"""
$e->print_userpic(); $e->print_poster(); $e->print_text(); $e->print_metadata();"""
$e->print_wrapper_end();
}