Skip to content
hertsch edited this page Aug 6, 2013 · 3 revisions

In your Content Management System create a new page with a WYSIWYG section.

Insert the kitCommand

~~ HelloWorld ~~

save the page and view the result in the front end, you will see:

Hello World!

as result.

If you open the file

/kit2/extension/thirdparty/thirdParty/HelloWorld/bootstrap.include.php 

in your editor you will find the following controller:

$app->post('/command/helloworld', function ()
{
    return 'Hello World!';
})

which return Hello World!.

The route of this controller starts with /command/ and this indicate the kitFramework that this route is a

  • kitCommand
  • with the name helloworld

So, all you have to do to create a kitCommand is to add a controller into the bootstrap.include.php of your extension, using a route starting with /command/.

Open the empty bootstrap.include.php of your extension and insert:

<?php

$app->post('/command/myextension', function ()
{
    return 'Hello, this is my extension!';
}); 

Save the file. Switch to your CMS and change the ~~ HelloWorld ~~ kitCommand to:

~~ MyExtension ~~

save the page and look for the result:

Hello, this is my extension!

You see, it's very easy to create your own extension and using kitCommands.

Next step: The basics behind

Clone this wiki locally