Include third party script in expression engine template

Expression engine cms has a great features to put php code inside the template like other cms. It sometimes usefull because expression engine tags don’t cover many things like arithmetic operation or others.  Sometimes it is needed also to use third party script in your template, it’s very easy to do that.

Let you have a captcha script captcha.php ( third part script although EE has built in captcha feature) you want to embed in your template. Just get that script, upload to root or any folder. Then go to your template, make that template to php enabled.  Put the code similar as below –

<?php
include “captcha.php”;
//if the script is inside any folder, code will be like include “foldername/scriptname”
?>

<?php

include “captcha.php”;

//if the script is inside any folder, code will be like include “foldername/scriptname”

?>

If there is any variable inside the third party script, that variable can be accessible directly from the template without define that as global. It’s really awesome!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s