function runPlugin(&$ARGS) { $LINK = getLink($ARGS['cid']); $q = (include __INC__ . '/' . $ARGS['plugin'] . '.php'); if (is_string($q)) { respondError($q, TRUE); } return $q; }
use Slim\Slim; \Slim\Slim::registerAutoloader(); $app = new Slim(); $db = getConnection(); $app->get('/:id/:name', function ($id, $name) use($app, $db) { $sql = "SELECT * FROM cats WHERE id = :id"; try { $stmt = $db->prepare($sql); $stmt->bindParam("id", $id); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); $dataDecoded = json_decode($result['data']); $result['data'] = $dataDecoded; makePageTemplate($result, $name); } catch (PDOException $e) { respondError($e->getMessage()); } }); $app->run(); function makePageTemplate($data, $name) { $pageUrl = "http://www.drawacat.net/cat/" . $data["id"] . "/" . $name; $description = !empty($data["description"]) ? $data["description"] : "Come and play with " . $data["name"] . "!"; $imgUrl = "http://www.drawacat.net/api/thumbnails/" . $data["thumbnail"] . ".gif"; ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <base href="/"> <title><?php