1. Core Layer 1

LiveJournal's only core layer, at present.

1.1. Properties

$*IMGDIR : string

The base URL of the current LiveJournal site's image directory, without a trailing slash. Example: "http://www.livejournal.com/img".

$*PALIMGROOT : string

The base URL of palimg files, without a trailing slash. Example: "http://www.livejournal.com/palimg".

$*SITENAME : string

Name of the current LiveJournal site. Example: "LiveJournal.com".

$*SITENAMEABBREV : string

Abbreviation of the current LiveJournal site. Example: "LJ".

$*SITENAMESHORT : string

Shorter name of the current LiveJournal site. Example: "LiveJournal".

$*SITEROOT : string

The base URL of the current LiveJournal site, without a trailing slash. Example: "http://www.livejournal.com".

$*STATDIR : string

The base URL of the current LiveJournal site's static files directory, without a trailing slash. Example: "http://www.livejournal.com/stc".

$*color_comment_bar : Color

Color of comment bar header

Base value: #d0d0ff

$*comment_userpic_style : string

Userpic display style for comments. Either '' for full, 'small' for small, or 'off' for none.

Base value:

$*control_strip_bgcolor : Color

Background color of navigation strip

$*control_strip_bordercolor : Color

Border color of navigation strip

$*control_strip_fgcolor : Color

Text color of navigation strip

$*control_strip_linkcolor : Color

Link color of navigation strip

$*custom_control_strip_colors : string

Navigation strip colors

Base value: off

$*custom_css : string

Custom stylesheet

Base value:

$*external_stylesheet : bool

Use linked stylesheet

Base value: 0

$*font_base : string

Preferred Font

Base value:

$*font_fallback : string

Alternative font style

Base value: none

$*include_default_stylesheet : bool

Use layout's stylesheet(s)

Base value: 1

$*lang_current : string

Current language code. So layouts can change date/time formats more safely if they want.

Base value: en

$*lang_dayname_long : string[]

Days of the week. Indexed from 1 (Sunday) to 7 (Saturday).

Base value: List: (, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday)

$*lang_dayname_short : string[]

Days of the week, in their short forms. Indexed from 1 (Sun) to 7 (Sat).

Base value: List: (, Sun, Mon, Tue, Wed, Thu, Fri, Sat)

$*lang_dayname_shorter : string[]

Days of the week, in their one letter forms. Indexed from 1 (S) to 7 (S).

Base value: List: (, S, M, T, W, T, F, S)

$*lang_fmt_date_long : string

Long date format. With full month name, but no day of the week.

Base value: %%month%% %%dayord%%, %%yyyy%%

$*lang_fmt_date_long_day : string

Long date format. With full month name and full day of the week.

Base value: %%day%%, %%month%% %%dayord%%, %%yyyy%%

$*lang_fmt_date_med : string

Medium date format. Abbreviated month name, no day of the week.

Base value: %%mon%%. %%dayord%%, %%yyyy%%

$*lang_fmt_date_med_day : string

Medium date format with day of week. Abbreviated month name and abbreviated day of the week.

Base value: %%da%%, %%mon%%. %%dayord%%, %%yyyy%%

$*lang_fmt_date_short : string

Short date format. All numeric.

Base value: %%m%%/%%d%%/%%yy%%

$*lang_fmt_month_long : string

Long month format.

Base value: %%month%% %%yyyy%%

$*lang_fmt_month_med : string

Medium month format.

Base value: %%mon%% %%yyyy%%

$*lang_fmt_month_short : string

Short month format.

Base value: %%m%%/%%yy%%

$*lang_fmt_time_short : string

Time format.

Base value: %%hh%%:%%min%% %%a%%m

$*lang_monthname_long : string[]

Months of the year. Indexed from 1 (January) to 12 (December).

Base value: List: (, January, February, March, April, May, June, July, August, September, October, November, December)

$*lang_monthname_short : string[]

Months of the year, in their short forms. Indexed from 1 (Jan) to 12 (Dec).

Base value: List: (, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)

$*linked_stylesheet : string

Custom external stylesheet URL

Base value:

$*linklist_support : bool

Display link list

Base value: 1

$*page_day_sortorder : string

Order of entries shown on a day page

Base value: forward

$*page_friends_items : int

Number of journal entries to show on friends page

Base value: 20

$*page_month_textsubjects : bool

If set, subjects will be provided for the MonthPage in plain text only, with HTML removed.

Base value: 1

$*page_recent_items : int

Number of journal entries to show on recent entries page

Base value: 20

$*page_year_sortorder : string

Order of months shown on the year archive page

Base value: forward

$*reg_firstdayofweek : string

The day of the week the calendar weeks starts on. Either 'sunday' or 'monday'.

Base value: sunday

$*tags_aware : bool

When enabled, style is responsible for handling tags. When disabled, tags are automatically inserted into entry bodies.

Base value: 0

$*text_comment_date : string

Text of the 'date' header in comments

Base value: Date:

$*text_comment_edittime : string

Text of the 'Edited at' string at the bottom of edited comments

Base value: Edited at

$*text_comment_expand : string

Text to expand a collapsed comment thread

Base value: Expand

$*text_comment_from : string

Text of the 'from' header in comments

Base value: From:

$*text_comment_frozen : string

Text to replace reply link with if comment is frozen

Base value: Frozen

$*text_comment_ipaddr : string

Text of the 'IP Address' header in comments

Base value: IP Address:

$*text_comment_parent : string

Text to link to parent comment of current comment

Base value: Parent

$*text_comment_posted : string

Text to display when a comment has just been posted by the user

Base value: Comment successfully posted.

$*text_comment_reply : string

Text to link to reply for comment

Base value: Reply

$*text_comment_thread : string

Text to link to the thread stemming from the comment

Base value: Thread

$*text_day_next : string

Text to link to the next day

Base value: Next Day

$*text_day_prev : string

Text to link to the previous day

Base value: Previous Day

$*text_edit_entry : string

Text to edit an entry

Base value: Edit Entry

$*text_edit_tags : string

Text to edit tags for an entry

Base value: Edit Tags

$*text_entry_next : string

Text to link to the next entry

Base value: Next Entry

$*text_entry_prev : string

Text to link to the previous entry

Base value: Previous Entry

$*text_flag : string

Text to flag an entry

Base value: Flag

$*text_icon_alt_groups : string

Alternative text for icons of custom friends group entries

Base value: [custom friends groups post]

$*text_icon_alt_private : string

Alternative text for icons of private entries

Base value: [private post]

$*text_icon_alt_protected : string

Alternative text for icons of friends-only entries

Base value: [protected post]

$*text_links : string

Text used for the heading of the links list

Base value: Links

$*text_max_comments : string

Text when entry has reached a comment maximum

Base value: Maximum comments reached

$*text_mem_add : string

Text to add an entry into memories

Base value: Add to Memories

$*text_meta_groups : string

Text for 'Custom Friends Groups'

Base value: Custom Friends Groups

$*text_meta_location : string

Text for 'Current Location'

Base value: Current Location

$*text_meta_mood : string

Text for 'Current Mood'

Base value: Current Mood

$*text_meta_music : string

Text for 'Current Music'

Base value: Current Music

$*text_month_form_btn : string

Text used for Submit button in MonthPage selector

Base value: View

$*text_month_screened_comments : string

Text to indicate there are screened comments

Base value: w/ Screened

$*text_multiform_btn : string

Text on the multiform action button.

Base value: Perform Action

$*text_multiform_check : string

Text beside a comment multi-action checkbox

Base value: Select:

$*text_multiform_conf_delete : string

Text for the confirming mass-delete action

Base value: Delete selected comments?

$*text_multiform_des : string

Text on the multiform action line.

Base value: Mass action on selected comments:

$*text_multiform_opt_delete : string

Text for the comment delete action

Base value: Delete

$*text_multiform_opt_deletespam : string

Text for the comment delete and mark as spam action

Base value: Delete as Spam

$*text_multiform_opt_edit : string

Text for the comment editing action

Base value: Edit

$*text_multiform_opt_freeze : string

Text for the comment freezing action

Base value: Freeze

$*text_multiform_opt_screen : string

Text for the comment screening action

Base value: Screen

$*text_multiform_opt_track : string

Text for the comment tracking action

Base value: Track This

$*text_multiform_opt_unfreeze : string

Text for the comment unfreezing action

Base value: Unfreeze

$*text_multiform_opt_unscreen : string

Text for the comment unscreening action

Base value: Unscreen

$*text_multiform_opt_untrack : string

Text for the comment untracking action

Base value: Untrack This

$*text_noentries_day : string

Text to display when there are no entries on the day view

Base value: There were no entries on this day.

$*text_noentries_recent : string

Text to display when there are no entries on the recent or friends views

Base value: There are no entries to display.

$*text_nosubject : string

Text to replace a subject line when no subject is specified

Base value: (no subject)

$*text_page_summary : string

Text used for the heading for the Page Summary navigation section

Base value: Page Summary

$*text_permalink : string

Text for an entry's permanent link

Base value: Link

$*text_post_comment : string

Link text to leave a comment

Base value: Leave a comment

$*text_post_comment_friends : string

Link text to leave a comment on friends view entry

Base value: Leave a comment

$*text_poster_anonymous : string

The placeholder used when something is posted by an anonymous user

Base value: (Anonymous)

$*text_read_comments : string

Link text to read comments

Base value: 1 comment // # comments

$*text_read_comments_friends : string

Link text to read comments on a friends view entry

Base value: 1 comment // # comments

$*text_reply_back : string

Text to link back to the single entry view from the read comments page

Base value: Read Comments

$*text_reply_nocomments : string

Text that explains that comments are not allowed for this post.

Base value: Comments have been disabled for this post.

$*text_reply_nocomments_header : string

Heading text that explains that comments are disabled

Base value: Comments Disabled:

$*text_replyform_header : string

Text for the heading above the form on the reply page

Base value: Comment Form

$*text_skiplinks_back : string

Text to show in a link to skip back through entries

Base value: Previous #

$*text_skiplinks_forward : string

Text to show in a link to skip forward through entries

Base value: Next #

$*text_skiplinks_forward_words : string

Text to show in a link to skip forward through entries

$*text_syndicate : string

Text used for the heading for the Syndication navigation section

Base value: Syndicate

$*text_tag_uses : string

Text to show how many times a tag has been used

Base value: 1 use // # uses

$*text_tags : string

Text for 'Tags' header for an entry

Base value: Tags: #

$*text_tags_page_header : string

Text for the header of the Tags page

Base value: Visible Tags

$*text_tags_section_header : string

Text for the 'Tags' heading in the navigation area

Base value: Tags

$*text_tell_friend : string

Text to tell a friend about an entry

Base value: Tell a Friend

$*text_unwatch_comments : string

Text to stop tracking events on an entry

Base value: Untrack This

$*text_view_archive : string

Text used to link to the 'Archive' view

Base value: Archive

$*text_view_friends : string

Text used to link to the 'Friends' view

Base value: Friends

$*text_view_friends_comm : string

Text used to link to the 'Friends' view for a community

Base value: Members

$*text_view_friends_filter : string

Title of a Friends page with an unnamed filter in effect

Base value: Friends (Custom filter)

$*text_view_friendsfriends : string

Title of the 'Friends of Friends' view

Base value: Friends of Friends

$*text_view_friendsfriends_filter : string

Title of a Friends of Friends page with an unnamed filter in effect

Base value: Friends of Friends (Custom filter)

$*text_view_memories : string

Text used to link to the 'Memories' view

Base value: Memories

$*text_view_month : string

Text used to link to a list of subjects for a month

Base value: View Subjects

$*text_view_recent : string

Text used to link to the 'Recent Entries' view

Base value: Recent Entries

$*text_view_userinfo : string

Text used to link to the 'User Information' view

Base value: User Info

$*text_watch_comments : string

Text to track events on an entry

Base value: Track This

$*text_website_default_name : string

If an account's website is specified, but there's no website name, use this text instead

Base value: My Website

$*theme_bgcolor : Color

Background color set by theme

$*theme_bordercolor : Color

Border color set by theme

$*theme_fgcolor : Color

Text color set by theme

$*theme_linkcolor : Color

Link color set by theme

$*use_shared_pic : bool

Use community userpics instead of poster's userpic.

Base value: 0

$*view_entry_disabled : bool

Disable customized comment pages for your journal

Base value: 0

1.2. Functions

PalItem(int index, Color c) : PalItem

Convenience constructor to make populating an array of PalItems (like in palimg_modify(string,PalItem[])) easy.

UserLite(string username) : UserLite

Constructor for making a UserLite object from a username

alternate(string a, string b) : string

With each call, this function will alternate between the two values and return one of them. Useful for making tables whose rows alternate in background color.

clean_url(string s) : string

Returns the given URL back if it's a valid URL.

control_strip_logged_out_full_userpic_css() : string

Returns CSS for the loggedout_userpic div in the logged out version of the control strip.

control_strip_logged_out_userpic_css() : string

Returns CSS for the userpic div in the logged out version of the control strip.

ehtml(string s) : string

Escapes all HTML tags and entities from the text

end_css() : void

Declare that you're done printing CSS and the output thus buffered should be cleaned and printed.

etags(string s) : string

Escapes all HTML tags (but not entities) from text

eurl(string s) : string

URL escape

get_page() : Page

Gets the top-level Page instance that LiveJournal ran the Page.print() method on.

get_plural_phrase(int n, string prop) : string

Picks the phrase with the proper plural form from those in the property $prop, passing $n to lang_map_plural(int) to get the proper form for the current language, and then substituting the # character with $n. Also, returned string is HTML-escaped.

get_url(UserLite user, string view) : string

Returns a URL to the specified view for the specified user. Views use the same names as elsewhere. (recent, friends, archive, month, userinfo)

get_url(string user, string view) : string

Returns a URL to the specified view for the specified user. Views use the same names as elsewhere. (recent, friends, archive, month, userinfo)

htmlattr(string name, int value) : string

If the value isn't blank, return in HTML attribute format with a leading space. HTML of name is not escaped.

htmlattr(string name, string value) : string

If the value isn't blank, return in HTML attribute format with a leading space. HTML of name is not escaped.

int(string s) : int

Convert the string to an integer and return

journal_current_datetime() : DateTime

Returns the current datetime in the timezone of the journal being viewed.

lang_at_datetime(DateTime d) : string

Returns a string saying "at {the data and time given}". Used in the core implementation of EntryPage and ReplyPage. i18nc layers should override this.

lang_map_plural(int n) : int

lang_metadata_title(string which) : string

Get a human-readable caption for a metadata key. Layers shouldn't override this, but should instead set the relevant string properties.

lang_ordinal(int num) : string

Make an ordinal number from a cardinal number

lang_ordinal(string num) : string

Make an ordinal number from a cardinal number. Don't override this, since the core layer implementation just calls lang_ordinal(int), which i18nc layers should override.

lang_page_of_pages(int pg, int pgs) : string

lang_user_wrote(UserLite u) : string

Returns text describing that the user wrote something. i18nc layers should override this.

lang_viewname(string viewid) : string

Get some words representing a view

pageview_unique_string() : string

Returns a unique string for the remote user.

palimg_gradient(string filename, PalItem start, PalItem end) : string

Return a URL to the specified filename (relative to the palimg root) with its palette table made into a gradient. All palette entries between the inclusive indexes of $start and $end will fade from the colors in $start and $end. The palette indexes for the start and end can be between 0 and 255.

palimg_modify(string filename, PalItem[] items) : string

Return a URL to the specified filename (relative to the palimg root) with its palette table altered, once for each provided PalItem. Restrictions: only 7 palette entries may be modified, and the PalItem indexes must be 0-15.

palimg_tint(string filename, Color bright) : string

Return a URL to the specified filename (relative to the palimg root) with its palette table tinted. The given 'bright' color will be the new white, and darkest color remains black.

palimg_tint(string filename, Color bright, Color dark) : string

Return a URL to the specified filename (relative to the palimg root) with its palette table tinted. The given 'bright' color will be the new white, and the given 'dark' color is the new black.

print_custom_control_strip_css() : void

Prints the CSS for custom control strip colors, if the option is enabled. This should be called by print_stylesheet().

print_stylesheet() : void

Prints a stylesheet, the URL of which can be referenced by Page.stylesheet_url. This is another S2 entry point, in addition to Page.print().

prop_init() : void

This function is the first thing called and is the place to set properties based on the values of other properties. It's called before the style system looks at its builtin properties, so if you need to conditionally setup something based on your own custom properties, do it here. You can't print from this function.

rand(int high) : int

Returns a random integer between 1 and $high, inclusive.

rand(int low, int high) : int

Returns a random integer between $low and $high, inclusive.

secs_to_string(int sec) : string

server_sig() : void

set_content_type(string text) : void

Set the HTTP Content-type response header (for example, if outputting XML). Must be called before printing any data.

set_handler(string eventname, string[][] commands) : void

start_css() : void

Declare that you're about to start printing out CSS that should be buffered, then later cleaned when you call end_css(). WARNING: this is not re-entrant. You can't call start_css recursively.

string(int i) : string

Return the given integer as a string

striphtml(string s) : string

Similar to ehtml, but the HTML tags are stripped rather than escaped.

style_is_active() : bool

Returns if the style (layout and theme) calling it is active based on a hook. If hook isn't defined, returns true always.

userinfoicon(UserLite user) : Image

userlite_as_string(UserLite ul) : string

Deprecated function. Use ljuser() from now on.

userlite_base_url(UserLite ul) : string

viewer_is_friend() : bool

Returns true if the user viewing the page is both logged in, and is a friend of the journal being viewed. Always returns false for communities, since they cannot have friends.

viewer_is_member() : bool

Returns true if the user viewing the page is both logged in, and is a member of the community being viewed. Always returns false for personal journals, since they cannot have members.

viewer_is_owner() : bool

Returns true if the user viewing the page is both logged in, and is the owner of the content in question. Useful for returning links to manage information, or edit entries.

viewer_logged_in() : bool

Returns true if the user viewing the page is logged in. It's recommended that your page links to the site login page if the user isn't logged in.

viewer_sees_ads() : bool

Deprecated function. Use viewer_sees_hbox_(top|bottom) or viewer_sees_vbox from now on.

viewer_sees_control_strip() : bool

Returns true if reader will see the built in control strip.

viewer_sees_ebox() : bool

True if the user has selected to see opaque content boxes between entries.

viewer_sees_hbox_bottom() : bool

True if opaque horizontal site-specific content box should be displayed to the user at the bottom of the page.

viewer_sees_hbox_top() : bool

True if opaque horizontal site-specific content box should be displayed to the user at the top of the page.

viewer_sees_vbox() : bool

True if opaque vertical site-specific content box should be displayed to the user.

weekdays() : int[]

Integers representing the days of the week. This will start on Monday (2) or Sunday (1) depending on the property setting for start-of-week and go to Sunday (1) or Saturday (7)

zeropad(int n, int digits) : string

Returns the number padded with zeroes so it has the amount of digits indicated.

zeropad(string n, int digits) : string

Returns the number padded with zeroes so it has the amount of digits indicated.

1.3. Classes

Table of Contents

Color Class — Represents a color.
Comment Class — A comment to a journal entry, or to another comment.
CommentInfo Class — Information about comments attached to something.
Date Class — Represents a date.
DateTime Class — Represents both a date and time.
DayPage Class — View entries by specific day
Entry Class — A journal entry
EntryLite Class — Base class for both journal entries and comments.
EntryPage Class — A page with a single journal entry and associated comments.
Friend Class — Represents a friends or friendof list
FriendsPage Class — Friends most recent entries
Image Class — Represents an image.
int Class — An integer number. This isn't really a class, as suggested by its lower-case name. Parameters of type int pass by value, unlike all variables of real object types, which pass by reference. Instead, this is just a pseudo-class which provides convenience methods on instances of integers. The other pseudo-class is string.
ItemRange Class — Represents a range of items which optionally contain items.
Link Class — A link or button
MessagePage Class — A page showing an error or confirmation message.
MonthDay Class — Summaries of posts on a given day on the MonthPage.
MonthEntryInfo Class — A month the user has journal entries, along with information to link to it.
MonthPage Class — A page which contains a list of posts made in that month
Page Class — Base template for all views
PalItem Class — A specification for a numbered palette index in a GIF or PNG to be changed to a certain color
RecentNav Class — Navigation position within a RecentPage or FriendsPage and URLs to move about.
RecentPage Class — Most recent entries page, formerly known as the LASTN view in the previous style system
Redirector Class — A redirector makes either a GET URL which redirects to a pretty URL or an HTML form which posts to a URL that redirects to a pretty URL. This class exists because it's often desirable to use a form to end up at a URL, instead of doing a GET request. It's also used in cases where finding the previous or next URL would incur database overhead which would be wasteful, considering most people don't click previous/next links. Instead, the system will give you a Redirector object which has a URL that'll do the lookup for you later, followed by a redirect.
ReplyForm Class — This class will be used more in the future to set options on the reply form before it's printed out by the system. The system has to print it since it contains sensitive information which can't be made available to S2.
ReplyPage Class — A page to reply to a journal entry or comment
string Class — A series of characters. This isn't really a class, as suggested by its lower-case name. Parameters of type string pass by value, unlike all variables of real object types, which pass by reference. Instead, this is just a pseudo-class which provides convenience methods on instances of strings. The other pseudo-class is int.
Tag Class — Represents a tag in its most basic form.
TagDetail Class — A rich structure with lots of information about a Tag.
TagsPage Class — A detail page listing a user's tags.
User Class — A more information-rich userinfo structure
UserLink Class — A user-defined link to an outside resource.
UserLite Class — A 'lite' version of a User which the system often has more readily-available than a full version.
YearDay Class — Information on how to link to a day in the year archive
YearMonth Class — A month on the YearPage.
YearPage Class — Entire calendar page for a single year.
YearWeek Class — Represents a week on the YearMonth on the YearPage.
YearYear Class — Information on how to link to a year in the year archive

1.4. Date Formats

The Date class has a method date_format() and its subclass DateTime adds the method time_format(). There's also a month_format() on objects dealing with only a month. All these methods take an optional format string which can be either a named format or a custom format string. If no format is provided, a default sensible version is used. The default is indicated in the table below.

1.4.1. Named Date Formats

The following named date formats are supported and localized for internationalization. The English representation is shown only as an example.

Method Named Format Default? English Format English Result
date_format short X %%m%%/%%d%%/%%yy%% 2/5/80
date_format med %%mon%%. %%dayord%%, %%yyyy%% Feb. 5th, 1980
date_format med_day %%da%%, %%mon%%. %%dayord%%, %%yyyy%% Tue, Feb. 5th, 1980
date_format long %%month%% %%dayord%%, %%yyyy%% February 5th, 1980
date_format long_day %%day%%, %%month%% %%dayord%%, %%yyyy%% Tuesday, February 5th, 1980
time_format short X %%hh%%:%%min%% %%a%%m 12:34 am
month_format short %%m%%/%%yy%% 04/03
month_format med %%mon%% %%yyyy%% Apr 2003
month_format long X %%month%% %%yyyy%% April 2003

1.4.2. Custom Date Formats

If you're making a style for yourself and don't care about keeping the date formats generic for internationalization, you can construct your own date format string with interpolated variables which you surround in double percent signs.

Variable Description
m Month, 1-12.
mm Month, 01-12.
d Day, 1-31.
dd Day, 01-31.
yy Year, two digits.
yyyy Year, four digits.
mon Short month name, translated. (English: Jan, Feb, …)
month Long month name, translated. (English: January, February, …)
da Short day of week, translated. (English: Sun, Mon, …)
day Long day of week, translated. (English: Sunday, Monday, …)
dayord Ordinal day of month, translated. (English: 1st, 2nd, 3rd, …)
H Hour, 0-23.
HH Hour, 00-23.
h Hour, 1-12.
hh Hour, 01-12.
min Minute, 00-59.
sec Second, 00-59.
a "a" for am, "p" for pm.
A "A" for am, "P" for pm.