/stash_templates/layouts/page.html (wrapper)
<!doctype html>
<html>
<head>
{snippet:html-head}
</head>
<body>
<div class="body-container">
/stash_templates/layouts/page.html (wrapper)
<!doctype html>
<html>
<head>
{snippet:html-head}
</head>
<body>
<div class="body-container">
{!-- set a list of expertise --}
{exp:stash:set_list name="global:expertise" parse_tags="yes" save="yes" scope="site" replace="no" refresh="0"}
{exp:channel:entries
channel="services|sectors"
disable="member_data|pagination|categories|custom_fields"
dynamic="no"
}
{stash:title}{title}{/stash:title}
{stash:id}{entry_id}{/stash:id}
{stash:url_title}{url_title}{/stash:url_title}
The idea is to set up ISO 639-1 language code prefixes for urls (e.g. en/, de/, fr/), and set global variables {global:lang}
and {global:lang_dir}
for use in your templates.
In the control panel create a category group "languages" and populate it with your languages, setting the category url title to the appropriate 2-letter language code. Assign the category group to the channels you want to translate.
For example:
Category Name | Category URL Title |
---|
{!-- ============================================================================ --} | |
{!-- CONTENTS OF pages/index --} | |
{!-- ============================================================================ --} | |
{exp:stash:cache context="{global:env}" bundle="pages" replace="{global:stash_cache_replace}"} | |
{!-- embed the base layout --} | |
{stash:embed:view} | |
{!-- extend the content block in the 'view' template with a custom layout --} |
{!-- ============================================================================ --} | |
{!-- CONTENTS OF pages/index --} | |
{!-- ============================================================================ --} | |
{exp:stash:cache context="{global:env}" bundle="pages" replace="{global:stash_cache_replace}"} | |
{!-- embed the base layout --} | |
{stash:embed:view} | |
{!-- capture data --} |
{stash:nocache}{exp:edit_this:entry entry_id="{entry_id}" channel_id="{channel_id}"}<a href="{edit_this_url}">Edit</a>{/exp:edit_this:entry}{/stash:nocache} |
{exp:channel:entries channel="explore" disable="categories|category_fields|member_data|pagination" } | |
<header class="wrapper"> | |
<div class="row"> | |
<div class="large-24 columns"> | |
<h1> | |
{title} | |
</h1> | |
</div> | |
</div> | |
</header> |
With Stash you have always been able to create global variables and evaluate them in the same template using if/else conditionals:
{exp:stash:set_value name="var" value="cheese" type="snippet"}
{if var == "cheese"}
We have cheese!
{if:else}
Where's the cheese, gromit?
{/if}
Stash embeds with the process="start"
parameter can be used to include pre-parsed or unparsed template tags in your template before any other tags or variables are parsed. This can be a more flexible alternative to EE's built-in snippet functionality.
It makes sense to combine snippets that are used globally into a single file so that they are included with the minimum of overhead. Call it somewhere in your template:
{!-- template at /stash_templates/snip/global.html --}
{stash:embed:snip:global process="start"}
Inside the stash embed:
{!-- unparsed snippets --}
"Medium traffic" = able to handle around 50 concurrent users on average.
If you want to handle 100+ concurrent users with the same modest hardware see the Varnish section below.