{init_sites}

Saurus CMS allows managing multiple websites within one installation. These can be language versions of one logical websites or completely different sites with unique structure and templates. Function {init_sites} is available since version 4.6.4.

Usage

{init_sites [name = "value"]}

Returns

Array of objects stored in variable which is defined by parameter "name".

Parameters

name

Defines the variable which stores the list of section objects returned. Default value is "sites".

string

Attributes

id

Language identifier.

int
hrefLink to the site.string
nameName of the site.string
extensionShort name for the site which is used in URL. For example, for multilingual websites, usually "en" is used for English version. In this case you switch the site by providing ?lang=en or /en in URL.string
is_defaultEquals 1 if this is the default site ie the site which opens by default for visitors.boolean
home_idID of the home or root section of given site.int
localeLocale value.string
glossary_idIdentifier of glossary used by the site.int
glossaryName of glossary used by the site.string

 

Example

Display list of all sites:

{init_sites name="sites"}
{foreach from=$sites item="site"}
    <a href="{$site->href}">{$site->name}</a>
{/foreach}

Make use of {$site_extension} variable to add CSS class "selected" for current site:

{init_sites name="sites"}
{foreach from=$sites item="site"}
    <a href="{$site->href}"{if $site_extension == $site->extension} class="active"{/if}>{$site->name}</a>
{/foreach}