Home « Server software «
Documentation: skins/skin_skeleton.php
Class Skin_Skeleton - Static functions used to produce HTML code.
Declare here all things used to build some HTML, but only HTML-related things.This script is a reference file of this system.
Voir aussi:
Licence: GNU Lesser General Public License
Auteurs:
- Bernard Paques bernard.paques@bigfoot.com
Testeurs:
- Olivier
- Nuxwin
- ClaireFormatrice
- José
- Mordread Wallas
- Ghjmora
Reste à faire:
- potential bug on creating a link out of a flag [ca ?
build_block() - Decorate some text
function &build_block($text, $variant='', $id='')
- $text - string the text
- $variant='' - the variant, if any
- $id='' - string a unique object id, if any
- returns string the rendered text
Accepted variants:
- 'center' some centered text
- 'code' a snippet of code
- 'decorated' to add on beauty
- 'error' an error message
- 'indent' an indented block
- 'introduction' some decorated text at the beginning of the page
- 'login' a form to login (to be used in menus)
- 'note' get reader attention
- 'page_title' the single page title
- 'question' as a title
- 'quote' some quoted text
- 'right' some right-centered text
- 'search' a form to search some text
- 'subtitle' a second-level title
- 'title' a first-level title
- 'warning' get reader attention
- default make a <span class=...>
Example to build a title:
echo Skin::build_block($title, 'title');
Example to build a subtitle:
echo Skin::build_block($title', 'subtitle');
The access key 4 for the search box has been suggested by Mark Pilgrim.
Voir aussi:
build_block_quote() - Build some quote block
function &build_block_quote($text)
- $text - string the block content
- returns the HTML to display
build_box() - Build a box
function &build_box($title, $content, $variant='', $id='', $url='', $popup='')
- $title - string the box title, if any
- $content - string the box content
- $variant='' - string the box variant, if any
- $id='' - string a unique object id, if any
- $url='' - string a link to add to the title, if any
- $popup='' - string the popup to display while hovering the link, if any
- returns the HTML to display
- 'extra' for a flashy box on page side
- 'folder' for a folded box with content
- 'gadget' for additional content in the main part of the page
- 'navigation' for additional navigational information on page side
- 'section' to structure main content of the page
- 'sidebar' for some extra information in the main part of the page
- 'toc' for a table of content
- 'toq' for a table of questions
build_box_title() - Append a link to a title
function &build_box_title($title, $url, $popup='')
- $title - string the box title
- $url - string a link to add to the title
- $popup='' -
- returns the HTML to display
build_contextual_menu() - Build a contextual menu for this page
function &build_contextual_menu($anchors)
- $anchors - array path of anchors to the current page
- returns string to be inserted in the returned web page
Voir aussi:
build_date() - Format a date
function &build_date($stamp, $variant='with_hour', $language=NULL, $gmt_offset=0)
- $stamp - int or string the date to be displayed
- $variant='with_hour' - string the variant can be either 'no_hour', 'full', 'standalone', or 'iso8601'
- $language=NULL - string the language to express this stamp
- $gmt_offset=0 - int offset to GMT of the provided date, if any
- returns the HTML to be used
- YYYY-MM-DD HH:MM:SS
- YYMMDD HH:MM:SS GMT
The date provided is considered to be GMT-based. It is adjusted to the time zone of the surfer, if applicable.
The variant is processed as follows:
- 'day' - only day, month and year --no time information
- 'with_hour' - adapts to time scale, and mention hours for today and yesterday
- 'no_hour' - adapts to time scale, but don't mention hours
- 'full' - display the full date
- 'month' - only month and year
- 'standalone' - like full, but without the 'on ' prefix
- 'iso8601' - the special format applies
Voir aussi:
build_default_box() - Build a default box
function &build_default_box($title, &$content, $id)
- $title - string the box title, if any
- &$content - string the box content
- $id - string an optional unique id for this box
- returns the HTML to display
build_extra_box() - Build an extra box
function &build_extra_box($title, &$content, $id='')
- $title - string the box title, if any
- &$content - string the box content
- $id='' - string an optional unique id for this box
- returns the HTML to display
build_folder_box() - Build a folder box
function &build_folder_box($title, &$content, $id='')
- $title - string the box title, if any
- &$content - string the box content
- $id='' - string an optional unique id for this box
- returns the HTML to display
toggle_folder()
code
is inserted at the bottom of the page in shared/global.phpVoir aussi:
build_flag() - Build a flag
function &build_flag($variant)
- $variant - string the variant: 'updated', 'new', etc.
- returns string the rendered text
Voir aussi:
build_form() - Build a form
function &build_form(&$fields, $variant='2-columns')
- &$fields - an array of ($label, $input, $hint)
- $variant='2-columns' - the visual variant
- returns an HTML string to be displayed
- '1-column'
- '2-columns'
Reste à faire:
- use fieldset and legend http://www.webcredible.co.uk/u...css-forms.shtml
build_gadget_box() - Build a gadget box
function &build_gadget_box($title, &$content, $id='')
- $title - string the box title, if any
- &$content - string the box content
- $id='' - string an optional unique id for this box
- returns the HTML to display
build_image() - Build tags for an image
function &build_image($variant, $href, $title, $link='')
- $variant - string the image variant
- $href - string the image href
- $title - string the image title
- $link='' - string a link to make a clickable image, if any
- returns the HTML to display
Accept following variants:
- 'center' for an image with a centered label
- 'inline' for in-line images; caption is only displayed in hovering pop-up
- 'left' for a left-aligned image
- 'right' for a right-aligned image
- 'thumbnail' for aligned thumbnail images
- any other value is translated to css style
Any of previous variants can be prefixed with the keyword 'large', like in 'large inline'. This may be used by web designers to trigger specific features, such as frames around large images.
If a title has been given to the image, it is provided as a hovering label. It is also added as caption in following situations:
- variant does not have the keyword 'thumbnail'
- or global parameter 'thumbnails_without_caption' has not been set to 'Y'
Voir aussi:
build_link() - Build a link
function &build_link($url, $label=NULL, $variant=NULL, $href_title=NULL)
- $url - string the url, if any
- $label=NULL - string a label, if any
- $variant=NULL - string an optional variant, as described above
- $href_title=NULL - string an optional title to add to the link
- returns string the rendered text, or the bare url if $variant = 'raw'
- 'article' - jump to an article page
- 'basic' - a very basic link - also the default
- 'button' - a link that looks like a button
- 'category' - jump to a category page
- 'comment' - jump to a comment page
- 'day' - a one day calendar
- 'email' - a mailto: link
- 'external' - jump to the outside world
- 'file' - see file details
- 'internal' - jump to the outside world, but stay in this window
- 'help' - open a separate window to display some help
- 'menu_1' - one top level link ([menu]...[/menu])
- 'menu_2' - one secondary level link ([submenu]...[/submenu])
- 'month' - a one month calendar
- 'more' - a follow-up link
- 'raw' - return only the url
- 'xml' - this has to be processed by a specialized software
- 'script' - see some phpDoc page
- 'section' - jump to a section page
- 'server' - jump to a server profile (news, ftp, etc.)
- 'shortcut' - stay within the site
- 'user' - see a member profile
- 'year' - a full year calendar
Voir aussi:
build_list() - Build a list of links
function &build_list(&$items, $variant='unordered', $default_icon=NULL)
- &$items - an array of $url => $label or or $url => array($prefix, $label, $suffix, $link_type, $icon_url, $link_title)
- $variant='unordered' - a variant (e.g., 'bullets', 'numbers', 'compact', ...)
- $default_icon=NULL - absolute path to an image, if any; useful with variants 'decorated' and '2-columns'
Skin::build_link()
to actually build links, depending on the variant provided.Items provided should at list have links and labels. For advanced lists, each label is replaced by an array of strings.
Accept following variants:
- '1-column' links are stacked vertically
- '2-columns' two stacks of links
- 'comma' - a trivial 'xxx, yyy, zzz' list
- 'compact' - a
- list
- 'crumbs' a list of containers -- should be called once per page
- 'decorated' to prefix each item with an icon
- 'menu' an in-line set of commands (e.g., edit, delete, etc.)
- 'menu_bar' an horizontal bar of commands
- 'news' a vertical stack of articles
- 'numbers' a numbered list
- 'page_menu' the main list of commands for the page -- should be called once per page
- 'rows' a vertical stack of links, also suitable for scrolling text
- 'tabs' the horizontal bar of links repeated everywhere -- should be called once per page
- 'unordered' a standard list - also the default
- $title - string the box title, if any
- &$content - string the box content
- $id='' - string an optional unique id for this box
- returns the HTML to display
- $value - the number to format
- $variant='' - the variant, if any
- returns a printable string
- $text - string the contact identification string
- $variant - string the kind of contact
- returns a string with a web link to page the contact
- &$user - array one user profile
- $variant='prefix' - string a profiling option, including 'prefix', 'suffix', and 'extra'
- returns a string to be returned to the browser
- $rating - int the rating (1, 2, 3, 4, or 5)
- returns the HTML to display
- $title - string the box title, if any
- &$content - string the box content
- $id='' - string an optional unique id for this box
- returns the HTML to display
- $title - string the box title, if any
- &$content - string the box content
- $id - string an optional unique id for this box
- returns the HTML to display
- $stamp - int or string the time to be displayed
- $variant=NULL - string the variant -- reserved for future use
- $language=NULL - string the language to express this stamp
- returns the HTML to be used
- YYYY-MM-DD HH:MM:SS
- YYMMDD HH:MM:SS GMT
- $title - string the box title, if any
- &$content - string the box content
- $id - string an optional unique id for this box
- returns the HTML to display
- $title - string the box title, if any
- &$content - string the box content
- $id - string an optional unique id for this box
- returns the HTML to display
- $data - an array of array($url, $prefix, $label, $suffix, $link_type, $icon_url, $link_title, $sub_items)
- $level=0 - int depth level
- $current_id='' -
- returns string
- $type = 'submenu' - string the type of each link
- returns a list of $url => array($prefix, $label, $suffix, $type, $icon, $title) to be used with Skin::build_list()
- $input - string the string to abbreviate
- $count=300 - int the maximum number of words
- $url=NULL - string the link to get the full version
- $label = '' - string a label for the follow-up link, if any
- returns the HTML to display
- $name - string constant name, in upper case
- $file - string file name for this image
- $default='' - string to be used if the file does not exists
- $alternate='' - string to be displayed in textual browsers
- $text - string some text to check
- $length=66 - int the maximum number of chars per code string
- returns a suitable string
- $matches -
- POWERED_BY_YACS_FLAG features a label, or image in sub-directory icons/powered_by_yacs.gif
- &$item - array article attributes
- returns some HTML to be inserted into the front page
- $back - string the url to go back to the main page (e.g., '/sections/view.php/23')
- $prefix - string the prefix for page links (e.g., '/sections/view.php/23/articles/')
- $range - the items, or the count of items in the current page
- $page_size - int the page size
- $page_index - int current page index, starting at 1 (e.g., 3)
- $zooming = FALSE - boolean TRUE to add a link to page 1
- returns an array of ( $url => $label )
- back: /sections/view.php/23 (the main page, which also displays some articles)
- to page 2: /sections/view.php/23/articles/2 (another page of links to articles)
- to page 3: /sections/view.php/23/articles/3 (a third set of links to articles)
- to next page: /sections/view.php/23/articles/3 (a fourth set of links to articles)
- back: /articles/view.php/23 (the main page, which displays some 'packed' comments)
- to page 1: /articles/view.php/23/comments/1 (Some full-sized comments)
- to page 2: /articles/view.php/23/comments/2 (another page of links to comments)
- to page 3: /articles/view.php/23/comments/3 (a third set of links to comments)
- to next page: /articles/view.php/23/comments/4 (a fourth set of links to comments)
- actions/index.php
- actions/list.php
- articles/index.php
- articles/view.php
- categories/index.php
- categories/view.php
- comments/index.php
- files/index.php
- images/index.php
- links/index.php
- locations/index.php
- sections/index.php
- sections/view.php
- servers/index.php
- tables/index.php
- users/index.php
- users/view.php
- &$data - an array of (previous_url, previous_label, next_url, next_label, option_url, option_label)
- $layout='sidebar' - string describing the intended layout (ie, 'sidebar', 'manual', 'slideshow')
- actions/view.php
- articles/view.php
- comments/view.php
- files/view.php
- images/view.php
- locations/view.php
- shared/anchor.php
- $text - string, the set of news to animate
- returns text to be returned to the browser
- $content - string the set of news to animate
- $direction='vertical' - string either 'vertical' or 'horizontal'
- $class='scroller' -
- returns text to be returned to the browser
- $text - string the text to abbreviate
- $count=20 - int the maximum number of words in the output
- $url=NULL - an optional url to go to the full version, if any
- $allowed_html='
- $render_codes=FALSE - boolean set to TRUE if YACS codes should be rendered, else codes will be removed
- returns the HTML to display
For variant 'tabs', $link_type actually conveys unique ids.
$return the HTML code
build_navigation_box() - Build a navigation box
function &build_navigation_box($title, &$content, $id='')
build_number() - Format a number
function &build_number($value, $variant='')
build_presence() - Show presence information
function &build_presence($text, $variant)
Voir aussi:
build_profile() - Build a user profile
function &build_profile(&$user, $variant='prefix')
Voir aussi:
build_rating_img() - Display some rating
function &build_rating_img($rating)
build_section_box() - Build a section box
function &build_section_box($title, &$content, $id='')
build_sidebar_box() - Build a sidebar box
function &build_sidebar_box($title, &$content, $id)
build_time() - Format a time stamp
function &build_time($stamp, $variant=NULL, $language=NULL)
build_toc_box() - Build a table of content
function &build_toc_box($title, &$content, $id)
build_toq_box() - Build a table of questions
function &build_toq_box($title, &$content, $id)
build_tree() - Build a tree of links
function &build_tree($data, $level=0, $current_id='')
build_user_menu() - Build the navigation menu for this surfer
function &build_user_menu($type = 'submenu')
Surfer::build_user_menu()
.
You can overload this function in your own skin to change this behaviour.Voir aussi:
cap() - Cap the number of words in an HTML string
function &cap($input, $count=300, $url=NULL, $label = '')
define_img() - Define a constant img tag
function define_img($name, $file, $default='', $alternate='')
fold() - Fold long lines of code
function &fold($text, $length=66)
fold_match() - Called from within a preg_replace_callback() in skin_skeleton::fold()
function fold_match($matches)
initialize() - Define constants used with this skin
function initialize()
Some constants may refer to existing images. Normally such images are in the sub-directory 'icons' and below. Other directories, including 'images', are reserved to inclusion from the template itself, or through CSS.Following constants can be initialized simply by putting some image at the right place, as per the following:
layout_cover_article() - Layout the cover article
function &layout_cover_article(&$item)
Voir aussi:
navigate() - Build a navigation bar for pages
function &navigate($back, $prefix, $range, $page_size, $page_index, $zooming = FALSE)
For example, if you are at page 3, and if the count of items equals the page size, this function will produce a list of url as follows:
In some cases (e.g., to display lists of comments) we would like to display the first page of links twice. To achieve that just set $zooming to TRUE.
For example, if you are at page 3, and if the count of items equals the page size, this function will produce a list of url as follows:
Voir aussi:
neighbours() - Build a navigation bar to neighbours
function &neighbours(&$data, $layout='sidebar')
$anchor->get_neighbours()
)@result some text to be inserted in the page
Voir aussi:
load() - Load a skin, and initialize everything
function load()
rotate() - Rotate some news through Javascript executed on client side
function &rotate($text)
If Javascript is disabled, all items will be shown statically, as usual.
Voir aussi:
scroll() - Scroll some text, through Javascript code executed on client side
function &scroll($content, $direction='vertical', $class='scroller')
setTimeout()
changed to setInterval()
, like in DOMnewsVoir aussi:
strip() - Strip some text, by suppressing codes, html and limiting words
function &strip($text, $count=20, $url=NULL, $allowed_html='', $render_codes=FALSE)
' - the list of allowed HTML tags, if any
cap()
.A stripped string is a short set of words aiming to introduce a longer page. It is usually followed by a link to jump to the full text.
Alternatively, this function may also be used to limit the number of words for a plain text string.
In both cases the calling script should be able to use the resulting directly, without any additional processing.
Most HTML tags are suppressed by
Skin::strip()
, except <a>, <br>, <img> and <span>.
You can provide the full list of allowed tags.This function will strip YACS codes as well, except if you explicitly ask for codes to be processed.
Example:
Skin::strip('This is my very interesting page', 3);
will return:
'This is my...'
table() - Build a complete table
function &table($headers, &$rows, $variant='')
- $headers - array headers
- &$rows - array rows of cells
- $variant='' - string a variant, if any, as decribed for table_prefix()
- returns a string to be sent to the browser
table_prefix() - Open a table
function &table_prefix($variant='')
- $variant='' - string the table variant, if any
- returns the HTML to display
- 'grid' force a grid to be drawn
- '100%' force to max width
table_row() - Build one row of a table
function &table_row($cells, $variant=0)
- $cells - array the content of cells
- $variant=0 - string the variant, if any; 'header' for the header row, if %2, use one color set, if !%2, use another set
- returns the HTML to display
- 'header' for a heading row
- 'sortable' for a heading row
- the row number, to distinguish odd and even backgrounds
table_suffix() - Close a table
function &table_suffix()
- returns the HTML to display