Inserting Code

Inserting Javascript/PHP code into your template:

Just add it as you would add to any other normal html page. The code will work in the php/html generated pages. Javascript will work from within LightNEasy itself, but PHP code won't, but will work in the generated pages.

Inserting Javascript/PHP code into the content of your page:

For javascript, just place it wherever you want inside the content of the page, the same way you would insert it into a normal HTML page (better to put the editor in non-WYSIWYG mode).

LightNEasy recognises special markers for inserting PHP code within the content of your pages.

Just like you have special markers to insert code contents in your template, like $#title#$ for instance, LightNEasy recognizes the following (in both cases, remove the spaces between the characters to make the markers work):

- % !$include filename.php$! % for including a php file, that will be executed.

This is the best way to include a php script into your pages. You make a separate file with your code, and then insert a command to include your file, and the script will work both in CMS mode or from the generated php pages.

- % !$function functionname$! % for calling a function in a php file you previously included. You can pass values to it using % !$function functionname 1 2 3$! %. This is the equivalent of calling functionname(1,2,3).

This is also the way to make many small applications work as LightNEasy plugins.

Inserting code literaly:

Although the previous examples cover most situations, you might want to insert just a code snippet inside your content.

- % !$ ........ $! % . The content between the opening and closing marker will be inserted literaly into the content of your page. This will work for javascript. This will not work or create strange results while under LightNEasy, but the code will work in the php pages LightNEasy generates.