Skip to content

Instantly share code, notes, and snippets.

@hertsch
Last active December 16, 2015 20:39
Show Gist options
  • Save hertsch/5493623 to your computer and use it in GitHub Desktop.
Save hertsch/5493623 to your computer and use it in GitHub Desktop.

##~~ help ~~

###Introduction

###General Parameters

###How to use kitCommands You can place kitCommands in each WYSIWYG section or within a template of the content management system. Just before a page is shown in the browser, the kitCommands will be replaced with the executed code behind them.

kitCommands can execute small code snippets or complete interactive applications.

A kitCommand has always the same structure - two swung dashes followed by a space, then the name of the command and at the end a space and again two swung dashes:

~~ sample ~~

In addition it is possible to pass one or multiple parameters to the kitCommand. Parameters are used to route information to the kitCommand or to change the behaviour of the command. A parameter can be added inserting a space, followed by the name of the parameter and then always a opening and a closing squared bracket:

~~ sample ... parameter[] ~~

You can also add multiple parameters:

~~ sample ... parameter[] parameter_two[] parameter_three[] ~~

Each Parameter can contain values, they are placed between the square brackets. The values can contain different data and formatted in any way. Please check the help of the particular kitCommand to get informations about the available parameters and the possible values:

~~ sample ... parameter[Value 1,Value 2] parameter_two[{15|2|33|"abc"}] ~~

The name of the kitCommand must always placed at the first position, followed by the additional parameters. Name and parameters are always case insensitive, they will be converted to lowercase in general. The sequence of parameters is not important. Attention: values may be case sensitive!

###General parameters

The kitCommands support some general parameters which can be used with any command.

cache[]

This parameter enable to clear the cache files of the Twig template engine and force Twig to render all templates again.

~~ sample ... cache[false] ~~

or

~~ sample ... cache[0] ~~

clear the cache files at each execution of the kitCommand.

Using this option will slow down the execution time, use it only for testing and developing!

canonical[]

If you are executing kitCommands multiple times it may happen that this will create duplicate content at your website.

Use canonical[] and add as variable the URL of the origin content, i.e.:

~~ sample ... canonical[http://example.com/example.php] ~~

this will set this canonical link header:

<link rel="canonical" url="http://example.com/example.php">

If the used kitFramework extension support the setting of canonical links you can force the kitCommand to create the correct canonical link for the actual content. Use canonical[] and submit the ID of the process which should create the link.

Example for usage with flexContent:

~~ flexContent action[view] content_id[12] canonical[12] ~~

this will set a canonical link header like this example:

<link rel="canonical" url="http://example.com/de/anycontent/id/12">

css[]

kitCommands which are not using inline frames to return their results can be forced to load a CSS file for formatting the content.

~~ sample ... css[] ~~

Without any value the parser will try to load a screen.css from the directory ../sample/Template/default/screen.css. This will work, if the name of the kitCommand is identical with the namespace of the parent extension.

~~ sample ... css[Basic] ~~

Will try to load a screen.css from the directory ../Basic/Template/default/screen.css

~~ sample ... css[Basic,sample.css] ~~

Will try to load a sample.css from the directory ../Basic/Template/default/sample.css

~~ sample ... css[Basic,special.css,extra] ~~

Will try to load a special.css from the directory ../Basic/Template/extra/special.css

The sequence of the given values must be always directory, name of the css file and the preferred template.

debug[]

Whenever a problem occur, the kitCommand will prompt only a small hint, but no further information. That is because the visitors of your website are not interested in any error descriptions.

To get debugging information just add the parameter debug[] to the kitCommand:

~~ sample ... debug[] ~~

This parameter does not need any additional values. If the problem is resolved remove the debug[] parameter again.

frame_add[]

If the kitCommand is using a inline frame you can add extra space to the frame height using frame_add[]:

~~ sample ... frame_add[80] ~~

will add 80 pixels to the height of the inline frame.

frame_auto[]

If the kitCommand is using a inline frame it will automatically resize the height of the frame, depending on the displayed content. Use the parameter frame_auto[]:

~~ sample ... frame_auto[false] ~~

or

~~ sample ... frame_auto[0] ~~

will switch off the auto resize function.

frame_cache[]

By default the caching of the inline frame content is disabled and the following headers are set:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

this is best practice to prevent problems if the user is using the browser back button. If you want to enable the caching set

~~ sample ... frame_cache[1] ~~

or

~~ sample ... frame_cache[true] ~~

in this case the headers above will not set.

frame_charset[]

The charset of the page, executed within the kitCommand inline frame will be normally UTF-8.

~~ sample ... frame_charset[ISO-8859-1] ~~

will set ISO-8859-1 charset to every page which is executed within the iframe.

frame_class[]

By default the kitCommand inline frame use the class kitcommand defined in Basic/Template/default/css/kitcommand.css for formatting the iframe itself. You can specify another class:

~~ sample ... frame_css[use_me] ~~

will use the class use_me instead.

frame_description[]

The description tag of the page, executed within the kitCommand inline frame will be set by the command itself.

~~ sample ... frame_description[This is my description] ~~

will set This is my description to every page which is executed within the iframe.

frame_height[]

If the kitCommand is using a inline frame and the auto resize function is off you can specify the frame height in pixel:

~~ sample ... frame_height[200] ~~

will display a inline frame with a height of 200 pixels.

frame_id[]

If the kitCommand is using a inline frame the ID of the frame will be set to kitframework_iframe by default. Use the parameter frame_id[] to set another ID:

~~ sample ... frame_id[my_frame] ~~

will set the ID of the inline frame to my_frame.

frame_keywords[]

The keywords tag of the page, executed within the kitCommand inline frame will be set by the command itself.

~~ sample ... frame_keywords[keyword_1,keyword_2,keyword_3] ~~

will set keyword_1,keyword_2,keyword_3 to every page which is executed within the iframe.

frame_name[]

If the kitCommand is using a inline frame the name of the frame will be set to kitframework_iframe by default. Use the parameter frame_name[] to set another name:

~~ sample ... frame_name[my_frame] ~~

will set the name of the inline frame to my_frame.

frame_redirect[]

By default an URL which belongs to an kitCommand inline frame will redirect automatically to the parent CMS and inbound the external executed URL to the kitCommand iframe.

~~ sample ... frame_redirect[false] ~~

or

~~ sample ... frame_redirect[0] ~~

will switch off the automatic redirect and enable that the iframe URL can be executed as separate page.

frame_robots[]

The robots meta tag of the page, executed within the kitCommand inline frame will be set by the command itself, i.e. with the value index,follow.

~~ sample frame_robots[noindex,follow] ~~

will set the meta tag to noindex,follow to every page which is executed within the iframe.

frame_scroll_to_id[]

If you want to jump directly to a tag with a specified ID within the iFrame, you can use frame_scroll_to_id[]:

~~ sample ... frame_scroll_to_id[kf_submit] ~~

will scroll the page to the ID kf_submit.

This parameter can also set as GET parameter with the URL, use frame_scroll_to_id or fsti in this case:

http://localhost/page/sample.php?frame_scroll_to_id=kf_submit

or, to shorten the parameter, use

http://localhost/page/sample.php?fsti=kf_submit

both variants will scroll the page to the ID kf_submit.

frame_source[]

The inline frame, executed by the kitCommand will load a program file which is determined by the developer. In special cases, i.e. for debugging or testing new features, it may be necessary to load another file into the iframe.

~~ sample ... frame_source[http://sample.com/something/loadme.php] ~~

will load the file loadme.php into the iframe.

frame_title[]

The title tag of the page, executed within the kitCommand inline frame will be set by the command itself.

~~ sample ... frame_title[My title] ~~

will set My title to every page which is executed within the iframe.

frame_tracking[]

If a tracking code is specified in /config/tracking.htt this analytics code will be executed with each inline frame page. If you don't want to execute the tracking you can stop it with:

~~ sample ... frame_tracking[false] ~~

or

~~ sample ... frame_tracking[0] ~~

frame_width[]

If the kitCommand is using a inline frame the width of the frame is set to 100% by default. Use the parameter param_width[] to set another width:

~~ sample ... frame_width[80%] ~~ 

will set the width to 80% of the available space

~~ sample ... frame_width[300px] ~~

will set the width to 300px.

generator[]

By default the kitFramework will add the meta tag

<meta name="generator" content="kitFramework (https://kit2.phpmanufaktur.de">

to each page of the Content Management System where a kitCommand is executed. You can switch off this meta tag using the parameter generator[]:

~~ sample generator[0] ~~

or

~~ sample generator[false] ~~

help[]

If you need any help to a kitCommand use the parameter help[] without any further values:

~~ sample ... help[] ~~

js[]

kitCommands which are not using inline frames to return their results can be forced to load JavaScript or jQuery files.

~~ sample ... js[Basic,script.js] ~~

The first value specify the directory and the second the JavaScript file. The sample above will try to load a script.js from the directory ../Basic/Template/default/script.js

~~ sample ... js[Basic,script.js,extra] ~~

Will try to load a script.js from the directory ../Basic/Template/extra/script.js

library[]

Enable the kitCommand to load multiple .js or .css files from the kitFramework BASIC Library into the header of the active CMS page.

~~ sample ... library[jquery/jquery/1.10.2/jquery.min.js] ~~

will load jQuery 1.10.2. Use the relative path within the library and separate multiple files by comma!

Have a look into the path /kit2/extension/phpmanufaktur/phpManufaktur/Basic/Library to see which libraries are actual supported. You can load any JavaScript and CSS file.

load_css[]

You can suppress the autoloading of CSS files outside of iframes:

~~ sample ... load_css[false] ~~

will suppress the autoloading of the kitcommand.min.css and other CSS files.

parent_title[]

By default the kitFramework will set the title of iFrame also as title of the parent document (your CMS page). If you want to disable this dynamic setting use:

~~ sample ... parent_title[false] ~~

or

~~ sample ... parent_title[0] ~~

Please be aware that the dynamic setting of the parent page title will be ignored by the search engine robots.

robots[]

You can force the kitCommand to create or update the meta tag for search engine robots:

~~ sample robots[noindex,follow] ~~

will create or update the meta tag:

<meta name="robots" content="noindex,follow">

search[]

kitCommands will be executed at run time, therefore their contents are are only available for the search function of the Content Management System if the kitCommand support this (most kitCommands will do that).

If you don't want that a kitCommand connect itself to the CMS search function you can use the parameter search[] to disable the connection:

~~ sample ... search[false] ~~

or

~~ sample ... search[0] ~~

will disconnect the kitCommand from the CMS search function.

set_header[]

kitCommands can change the head information of the currently shown page of the Content Management System. The OutputFilter will retrieve the contents of title, description and keywords from the executing kitCommand in case the parameter set_header[] is set. In some cases the parameter set_header[] will be set automatically by the process, i.e. if a permanent link redirect to a CMS URL.

The set_header parameter expect a integer value which identify the context to set the head information. Check the documentation of the kitCommand, which is executing the set_header[] parameter - in most cases this value will be identical with the identifier of the context, example for flexContent:

~~ flexContent action[view] content_id[39] set_header[39] ~~

flexContent will show the content of the article with the ID 39. The same ID will be used to set the header information: set_header[39].

simulate[]

If you want that the kitCommand expression will be shown but not executed, for example if want to show a kitCommand as example within an article at your website, just add the parameter simulate[] to the kitCommand:

~~ sample foo[bar] simulate[] ~~

In this case the kitCommand will not be executed, but the parameter simulate[] will be removed and the resulting output will be:

~~ sample foo[bar] ~~

template[]

kitCommands can use different template styles, so you can switch between different outfits and behaviours of the command. Each kitCommand will have a template named default which will be used if no other is specified.

~~ sample ... template[second] ~~

will use the template second instead. If the template file, requested by the kitCommand, exists in second it will be used, otherwise the kitCommand will use the template file with the same name from default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment