{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 |
| href | Link to the site. | string |
| name | Name of the site. | string |
| extension | Short 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_default | Equals 1 if this is the default site ie the site which opens by default for visitors. | boolean |
| home_id | ID of the home or root section of given site. | int |
| locale | Locale value. | string |
| glossary_id | Identifier of glossary used by the site. | int |
| glossary | Name 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}
