Skip to content

Instantly share code, notes, and snippets.

@addorange
Created July 3, 2013 10:15
Show Gist options
  • Save addorange/5916846 to your computer and use it in GitHub Desktop.
Save addorange/5916846 to your computer and use it in GitHub Desktop.
run external class connected to contao (e. g. for AJAX calls)
<?php
require('../system/initialize.php');
class MyClass extends Frontend
{
public function __construct()
{
// Example: Load user object before calling the parent constructor
$this->import('FrontendUser', 'User');
parent::__construct();
}
public function run()
{
// run my functions
}
}
/**
* Instantiate controller
*/
$objMyClass = new MyClass();
// Run code within MyClass()
$objMyClass->run();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment