| Project: | QDrupal - Drupal Integration with Qcodo |
| Version: | 0.3.24-PREVIEW |
| Component: | User interface |
| Category: | feature |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Hi,
I've added some code in the menu that will generate menus to the pages that are in pages dir from qdrupal.
It goes something like this:
<?php
/** qdrupal_menu */
$items[] = array(
'path' => 'qdrupal/pages',
'title' => t('Pages'),
'callback' => 'qdrupal_pages',
'callback arguments' => array($file),
'access' => user_access('administer qdrupal'),
'type' => MENU_NORMAL_ITEM,
);
if ($handle = opendir(__SUBDIRECTORY__ . '/pages')) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
if (strpos($file, '.php',1)||strpos($file, '.php',1) ) {
$items[] = array(
'path' => 'qdrupal/pages/' . $file,
'title' => t($file),
'callback' => 'qdrupal_pages',
'callback arguments' => array($file),
'access' => user_access('administer qdrupal'),
'type' => MENU_NORMAL_ITEM,
);
}
}
closedir($handle);
}
...
function qdrupal_pages($page) {
if (!$page)
$page = 'index.php';
drupal_set_title("");
_qdrupal_bootstrap();
ob_start();
require_once(__SUBDIRECTORY__ . '/pages/' . $page);
return ob_get_clean();
}
?>Of course, it could be improved, but seems like a nice idea to have. Now whenever I create a new page in qdrupal, I see it there and can access it.


That's great! I'm actually integrating some changes from another QDrupal contributor, so you can expect a new release soon.
Post new comment