Skip to main content

DekiScript 101

Screen Shot 2014-06-16 at 10.42.37 AM.png
Written by Miller Saltzman
Former Documentation Editor, Customer Success at MindTouch
This page applies to:MindTouch Responsive

New to MindTouch and have no idea how to use DekiScript? This article introduces the basics of DekiScript, the MindTouch programming language.

 

Why DekiScript?


  • Provides an easier, more controlled experience for writing HTML than using the source view mode.
  • Allows you to personalize your site by showing different content depending on who is using your site.
  • Offers opportunities to dynamically display content.

     

How to add DekiScript to a page


There are two ways to add DekiScript to your pages, depending on your experience level with programming languages:

Less experienced coders
  1. Open the page in Edit mode.
  2. Add a DekiScript code block and write your code.
  3. Save your page.
More experienced coders
  1. Open the page in Edit mode.
  2. From the MindTouch editor, select View > Source.
  3. Write your code and enclose with two double braces:
{{"this is text"}}
  1. Save your page.
     


What can I write with DekiScript?


Just like with other programming languages, you can use the following with DekiScript to define your content:

Receiving an error message?


If the computer cannot understand your DekiScript, a bright red message let's you know the location of the invalid code:

"}" expected: /content/body/pre[2], line 5, column 1  


This is the DekiScript that led to the above error:

var x =25;
if (user.title != "How to Use DekiScript for Programmers")
{
"If you are a programmer look at this link instead:"
let x = 75;
}
<br/>
<br/>
x;

The error message states that error is in the fifth line of DekiScript. The number column states how many symbols into the line (count from left to right) the error occurs.

When the column number is 1,  the mistake usually occured at the end of the previous line.


Can you figure out what the issue is in the above example? Yes, you are right. I forgot a semicolon at the end of line 4!

 

Check your code


  • Did you remember to type a semicolon at the end of every line?
  • Did you remember to put quotation marks around every line of text?

 

What's next


Learn how to work with the most common DekiScript definitions and operators