Created
October 29, 2015 08:40
-
-
Save maximal/a515535b9c4e0b82d754 to your computer and use it in GitHub Desktop.
Используем MODx, как фреймворк; например, для создания API у сайта на этой CMS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Пишем API для сайта на MODx. | |
* Используем Модекс как фреймворк. | |
* | |
* @example | |
* // В этом классе реализуем логику | |
* // В сниппете Модекса пишем: | |
* require 'path/to/ApiController'; | |
* (new ApiController($modx))->processRequest(); | |
* | |
* @author MaximAL | |
* @since 2015-10-29 | |
*/ | |
namespace maximal\vizitka\api; | |
class ApiController | |
{ | |
protected $modx; | |
public function __construct($modx) | |
{ | |
$this->modx = $modx; | |
} | |
public function processRequest() | |
{ | |
// Доступен Модекс и все действия с базой данных сайта | |
// $this->modx->… | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment