HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: Site control

» Return to Contents



The site file is for general page and zone management, but primarily it exists to provide the top level functionality for the process of generating site pages! It's like the waiter who asks for your order.

sources/site.php

Global_functions_site.php

Function summary

void init__site ()
string attach_message (mixed message, ID_TEXT type)
URLPATH get_logo_url (?ID_TEXT zone_name)
tempcode breadcrumbs ()
tempcode breadcrumbs_get_default_stub (boolean link_to_self_entrypoint)
void breadcrumb_add_segment (tempcode segment, ?mixed final_title)
void breadcrumb_set_parents (array parents)
void breadcrumb_set_self (tempcode title)
tempcode do_header (boolean skip_top)
tempcode do_footer (boolean bail_out)
void do_site ()
?tempcode request_page (ID_TEXT codename, boolean required, ?ID_TEXT zone, ?ID_TEXT page_type, boolean being_included, boolean no_redirect_check)
~array _request_page (ID_TEXT codename, ID_TEXT zone, ?ID_TEXT page_type, ?LANGUAGE_NAME lang, boolean no_redirect_check)
tempcode load_comcode_page (PATH string, ID_TEXT zone, ID_TEXT codename, ?PATH file_base, boolean being_included)
tempcode comcode_breadcrumbs (ID_TEXT the_page, ID_TEXT the_zone, ID_TEXT root, boolean no_link_for_me_sir, integer jumps)
void log_stats (string string, integer pg_time)

void init__site()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

string attach_message(mixed message, ID_TEXT type)

Attach a message to the page output.

Parameters…

Name message
Description The type of special message
Type mixed

Name type
Description The template to use
Default value inform
Type ID_TEXT
Values restricted to inform warn

Returns…

Description Blank string so it can be chained in the Tempcode compiler. You will rarely want to use this return value. It's kind of a failsafe.
Type string

Return to the function index for this class Expand: View the source code to this function

URLPATH get_logo_url(?ID_TEXT zone_name)

Get the relative URL to the logo for the current zone.

Parameters…

Name zone_name
Description The zone being operated within (NULL: auto-detect)
Default value
Type ?ID_TEXT

Returns…

Description The relative URL to the logo for the current zone
Type URLPATH

Return to the function index for this class Expand: View the source code to this function

tempcode breadcrumbs()

Get the tempcode for the breadcrumbs.

Parameters…

Returns…

Description The breadcrumbs
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode breadcrumbs_get_default_stub(boolean link_to_self_entrypoint)

Get the tempcode for the default breadcrumbs stub. This isn't entirely a default, because it does work with breadcrumb_set_parents. We refer to it as a default as it is possible to override the whole breadcrumbs environment via the special BREADCRUMBS global variable.

Parameters…

Name link_to_self_entrypoint
Description Whether we'll be providing a link to where we are currently at
Default value boolean-true
Type boolean

Returns…

Description The default breadcrumb stub
Type tempcode

Return to the function index for this class Expand: View the source code to this function

void breadcrumb_add_segment(tempcode segment, ?mixed final_title)

Add a segment to the breadcrumbs (if this isn't used, a default will be used for the stub).

Parameters…

Name segment
Description The segment
Type tempcode

Name final_title
Description The title of the follower of the segment OR an array as for breadcrumb_set_parents (NULL: implicit in $segment)
Default value
Type ?mixed

(No return value)


Return to the function index for this class Expand: View the source code to this function

void breadcrumb_set_parents(array parents)

Put a list of parents in for the breadcrumbs.

Parameters…

Name parents
Description The list of parent entry points (pairs: entry point, title)
Type array

(No return value)


Return to the function index for this class Expand: View the source code to this function

void breadcrumb_set_self(tempcode title)

Set the current title.

Parameters…

Name title
Description The title
Type tempcode

(No return value)


Return to the function index for this class Expand: View the source code to this function

tempcode do_header(boolean skip_top)

Get the tempcode for the header. You will not normally need to use this function, as this is called as part of the website engine.

Parameters…

Name skip_top
Description Whether to skip showing the top (logo/zone-navigation/banner)
Default value boolean-false
Type boolean

Returns…

Description The site header
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode do_footer(boolean bail_out)

Get the tempcode for the footer. You will not normally need to use this function, as this is called as part of the website engine.

Parameters…

Name bail_out
Description Whether we are forcibly handling a bail-out (an error occurred during output and our XHTML is likely corrupted)
Default value boolean-false
Type boolean

Returns…

Description The site footer
Type tempcode

Return to the function index for this class Expand: View the source code to this function

void do_site()

This is it - the start of rendering of a website page.Take in all inputs, sends them to the correct functions to process, gathers up all the outputs, sticks them together and echoes them.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

?tempcode request_page(ID_TEXT codename, boolean required, ?ID_TEXT zone, ?ID_TEXT page_type, boolean being_included, boolean no_redirect_check)

Take the specified parameters, and try to find the corresponding page, then execute a function to load the page (load_html_page/load_comcode_page).

Parameters…

Name codename
Description The codename of the page to load
Type ID_TEXT

Name required
Description Whether it is required for this page to exist (shows an error if it doesn't) – otherwise, it will just return NULL
Type boolean

Name zone
Description The zone the page is being loaded in (NULL: as shown by access URL)
Default value
Type ?ID_TEXT

Name page_type
Description The type of page - for if you know it (NULL: don't know it)
Default value
Type ?ID_TEXT

Name being_included
Description Whether the page is being included from another
Default value boolean-false
Type boolean

Name no_redirect_check
Description Whether to not check for redirects (normally you would)
Default value boolean-false
Type boolean

Returns…

Description The page (NULL: no page)
Type ?tempcode

Return to the function index for this class Expand: View the source code to this function

~array _request_page(ID_TEXT codename, ID_TEXT zone, ?ID_TEXT page_type, ?LANGUAGE_NAME lang, boolean no_redirect_check)

Take the specified parameters, and try to find the corresponding page

Parameters…

Name codename
Description The codename of the page to load
Type ID_TEXT

Name zone
Description The zone the page is being loaded in
Type ID_TEXT

Name page_type
Description The type of page - for if you know it (NULL: don't know it)
Default value
Type ?ID_TEXT

Name lang
Description Language name (NULL: users language)
Default value
Type ?LANGUAGE_NAME

Name no_redirect_check
Description Whether to not check for redirects (normally you would)
Default value boolean-false
Type boolean

Returns…

Description A list of details (false: page not found)
Type ~array

Return to the function index for this class Expand: View the source code to this function

tempcode load_comcode_page(PATH string, ID_TEXT zone, ID_TEXT codename, ?PATH file_base, boolean being_included)

Get the parsed contents of a comcode page.

Parameters…

Name string
Description The relative (to ocPortal's base directory) path to the page (e.g. pages/comcode/EN/start.txt)
Type PATH

Name zone
Description The zone the page is being loaded from
Type ID_TEXT

Name codename
Description The codename of the page
Type ID_TEXT

Name file_base
Description The file base to load from (NULL: standard)
Default value
Type ?PATH

Name being_included
Description Whether the page is being included from another
Default value boolean-false
Type boolean

Returns…

Description The page
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode comcode_breadcrumbs(ID_TEXT the_page, ID_TEXT the_zone, ID_TEXT root, boolean no_link_for_me_sir, integer jumps)

Get a UI element of a route from a known Comcode page back to the declared root of the tree.

Parameters…

Name the_page
Description The Comcode page name
Type ID_TEXT

Name the_zone
Description The Comcode page zone
Type ID_TEXT

Name root
Description The virtual root
Default value
Type ID_TEXT

Name no_link_for_me_sir
Description Whether not to put a link at this point in the navigation tree (usually, because the viewer is already at it)
Default value boolean-true
Type boolean

Name jumps
Description The number of jumps we have gone through so far (cuts out after 10 as a failsafe)
Default value 0
Type integer

Returns…

Description The navigation element
Type tempcode

Return to the function index for this class Expand: View the source code to this function

void log_stats(string string, integer pg_time)

Log statistics for the page view.

Parameters…

Name string
Description The string to the page file
Type string

Name pg_time
Description The time taken for page loading in milliseconds
Type integer

(No return value)


Return to the function index for this class Expand: View the source code to this function

sources/site_tree.php

Global_functions_site_tree.php

Function summary


void site_tree_script()

AJAX script for dynamically extended sitetree.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function