607

Product support

Get help in the plugin support forum.

Categories

TemplateTokens offers the user the ability to manage tokens, also known as variables, that can be used inside any page or layout within OctoberCMS. The main focus of this plug-in is to offer the user an easy to manage interface for static links and repeatable pieces of text.

Features:

  • easily add, change or remove tokens by using the management page
  • tokens are defined based on scopes, giving you the ability to use the same token name for page, layout and even application scopes
  • tokens are available using the same Twig dot notation used in OctoberCMS

Installation

Either download the plug-in from the OctoberCMS market or use the Github repository to download the code and install it into your application.

*Note: If you are using the Github repo, please download or unpack the source into a folder called 'koderhut/templatetokens' inside your 'plugins/' folder of your installation. After unpacking/downloading run the following command from the root folder of your installation:

$ php artisan plugin:refresh KoderHut:TemplateTokens

This will run the installation scripts and create the necessary database tables.

Configuration

To manage the tokens access the Settings > KoderHut > TemplateTokens configuration page.

Using this page you can add a new token by selecting the 'Add New Token' button and filling in all the fields in the pop-up form.

To edit a token simply click/tap on it in the tokens list and a pop-up will be displayed with the information already stored. Change the fields you need and select Save.

To remove one or more tokens simply check the check-box next to the token name and click/tap the 'Remove Token(s)' button'

Usage

You can access the tokens inside each scope using the 'tk' namespace, like :

Global scope:  {{ this.tk.global_scope_var }}
Page scope:    {{ this.page.tk.page_scope_var }}
Layout scope:  {{ this.layout.tk.layout_scope_var }}
  • Found the plugin useful on 5 Apr, 2016

    Man, you should set this to use CMS Category instead of create another setting category.

  • author

    Replied on 5 Apr, 2016

    Thanks for the input, Wilson! If you can give me a more descriptive use case I will make sure to review it and update the code as needed.

1.0.5

Fix issue with not token not being displayed properly for other scopes after upgrade to OctoberCMS v1.0.420

Aug 08, 2017

1.0.4

!!! DO NOT UPDATE UNLESS YOU ARE USING OCTOBERCMS BUILD 420+. Fix bug with token tag name not being displayed on versions 420 and upwards. These versions upgraded Laravel to 5.5 which introduces a new property on the model resulting in the bug fixed here.

Aug 06, 2017

1.0.3

Fix class naming change

Jan 11, 2017

1.0.2

Add some default tokens

Oct 12, 2015

1.0.1

First version of TemplateTokens

Oct 12, 2015