active language check

{% if activeLocale == ‘de’ %} {% component ‘staticMenuDE’ class=”nav navbar-nav navbar-right” %} {% else %} {% component ‘staticMenuEN’ class=”nav navbar-nav navbar-right” %} {% endif %} https://octobercms.com/plugin/rainlab-translate

october cms – page url

<a href=”{{ ”| page }}”>Current page with current filter slugs</a> <a href=”{{ ”| page(false) }}”>Current page without any filter slugs (except default value)</a> <a href=”{{ ”| page({ filter_slug:slug_var, filter_id:id_var }) }}”>Current page with needle filter slugs</a>  

octobercms: bootstrap carousel

{% set id = random(999999) %} <div class=”carousel carousel-{{id}} slide ock-carousel” data-ride=”carousel” {% if interval is defined %}data-interval=”{{interval}}”{% endif %}> {% if indicator is not defined or indicator == true %} <ol class=”carousel-indicators”> {% for bild in bilder %} <li Read more…

october cms: basic seo

within the layout/theme: <title>{{ this.page.title }}</title> <meta name=”title” content=”{{ this.page.meta_title|default(this.page.title) }}”> <meta name=”description” content=”{{ this.page.meta_description}}”> <meta name=”keywords” content=”{{ this.page.meta_keywords}}”> inside the component: $this->page->title = “abc”; $this->page->meta_description = “abc”; $this->page->meta_keywords = “abc”;  

maplace.js – simple map with markers

Maplace.js is a library for google maps. This snippet creates a map creates 2 marker applies some “style” to this map https://github.com/danielemoraschi/maplace.js <div id=”map” style=”height: 300px”></div> <script src=”https://code.jquery.com/jquery-2.2.4.min.js” integrity=”sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=” crossorigin=”anonymous”></script> <script src=”https://maps.googleapis.com/maps/api/js?key=AIzaSyAMgZvDq9HAESOi_JbgZdA5RPYxKBgNYTg&callback=initMap” async defer></script> <script src=”maplace.min.js”></script> <script> function initMap() { Read more…

october cms: relations

Resources: https://octobercms.com/docs/database/relations https://octobercms.com/docs/backend/relations Example: This is a (hopefully correct) working example of a 1 to n relation. // product model public $hasMany = [ ‘variants’ => [‘\Acme\Namespace\Variant’], ]; // variant model public $belongsTo = [ ‘product’ => [‘\Acme\Namespace\Product’], ]; public Read more…

october cms themes

Resources: https://octobercms.com/docs/themes/development#theme-information https://octobercms.com/docs/cms/themes Basic Layout: Here is a sample structure of a october theme. the layout file combines the header and the footer into a working layout, which can be used for pages. layout_header.htm <!doctype html> <html class=”no-js” lang=”de”> <head> Read more…