added views api
This commit is contained in:
parent
33d9181865
commit
0ca08deffd
15
include/controllers/default/crunchbutton/api/views/index.php
Normal file
15
include/controllers/default/crunchbutton/api/views/index.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class Controller_api_views extends Crunchbutton_Controller_Rest {
|
||||
public function init() {
|
||||
|
||||
foreach (new DirectoryIterator(c::config()->dirs->view.'default/crunchbutton/frontend') as $fileInfo) {
|
||||
if (!$fileInfo->isDot()) {
|
||||
$files[] = $fileInfo->getBasename('.phtml');
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($files);
|
||||
|
||||
}
|
||||
}
|
||||
14
include/controllers/default/crunchbutton/view/index.php
Normal file
14
include/controllers/default/crunchbutton/view/index.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class Controller_view extends Cana_Controller {
|
||||
public function init() {
|
||||
$file = preg_replace('/\.html/','',c::getPagePiece(1));
|
||||
$file = preg_replace('/[^a-z]/','',$file);
|
||||
$file = c::config()->dirs->view.'default/crunchbutton/frontend/'.$file.'.phtml';
|
||||
|
||||
if (file_exists($file)) {
|
||||
echo file_get_contents($file);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user