Closed francescoagati closed 12 years ago
I'm not a Drupal expert. I encourage you to ask this question on the Slim Framework support forums. Closing this out.
Hello: Please see my answer at Stack Overflow https://stackoverflow.com/questions/50504074/how-can-i-use-slim-micro-framework-inside-drupal/54674133#54674133
A load function can be used
require 'vendor/autoload.php';
function my_modulename_menu() { $items['my/page/%my_modulename_somefunction'] = array( 'page arguments' => array(2), 'access arguments' => array('access content'),
return $items;
}
function my_modulename_somefunction_load($var) {
$app = new \Slim\App; $request = request_path(); // set the Drupal request object here
if ($_SERVER['REQUEST_URI'] == "my/page/" . $var) {
$app->get('/my/page/{passed}', function ($request, $response, array $args) {
$stuff = $args['passed']
// do something with your data here
return $response->withJson($stuff);
});
$app->run();
exit;
}
}
Hi, is possible integrate slim as a router inside a menu hook of drupal?
In lithium is possible using the normal hooks of drupal. see this file for an example of integration:
https://github.com/cliftonc/li3_drupal/blob/master/li3_drupal.module
First they define a hook menu
and after use the function li3_drupal_index for linkt the drupal url system with the router of li3