קורסים ופעילות, בשיטת גואנקה
טלפון 03-6123822
/** * Implements hook_menu(). */ function recent_retreat_talks_menu() { $items = array(); // Listing page (what you currently have at /recent-retreat-talks) $items['recent-retreat-talks'] = array( 'title' => 'Recent retreat talks', 'page callback' => 'recent_retreat_talks_index_page', 'access arguments' => array('access content'), 'type' => MENU_NORMAL_ITEM, ); // Single retreat page: /recent-retreat-talks/retreat/27900 $items['recent-retreat-talks/retreat/%'] = array( 'title callback' => 'recent_retreat_talks_retreat_title', 'title arguments' => array(3), 'page callback' => 'recent_retreat_talks_retreat_page', 'page arguments' => array(3), 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); return $items; } /** * Attach CSS/JS your pages need. */ function recent_retreat_talks_attach_assets() { $module_path = drupal_get_path('module', 'recent_retreat_talks'); // Your styles & player JS drupal_add_css($module_path . '/code/styles.css'); drupal_add_js($module_path . '/code/audio-player.js'); // If you rely on Bootstrap glyphicons, include Bootstrap CSS too: drupal_add_css('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', array('type' => 'external')); } /** * Helper: include your existing PHP file and return only the body content. */ function recent_retreat_talks_render_from_file($file, $args = array()) { $module_path = drupal_get_path('module', 'recent_retreat_talks'); $filepath = DRUPAL_ROOT . '/' . $module_path . '/code/' . $file; // Make $_GET params available to the included file if needed. if (!empty($args)) { foreach ($args as $k => $v) { $_GET[$k] = $v; } } // If your code expects ROOT_PATH/ROOT_URL constants, define them here: if (!defined('ROOT_PATH')) define('ROOT_PATH', DRUPAL_ROOT . '/' . $module_path . '/code'); if (!defined('ROOT_URL')) define('ROOT_URL', base_path() . $module_path . '/code'); ob_start(); include $filepath; // This will echo a full HTML page today $html = ob_get_clean(); // Strip the outer
so we can return markup inside Drupal's theme. if (preg_match('/]*>(.*)<\/body>/is', $html, $m)) { $html = $m[1]; } return $html; } /** * Page callbacks. */ function recent_retreat_talks_index_page() { recent_retreat_talks_attach_assets(); $markup = recent_retreat_talks_render_from_file('index.php'); return array('#type' => 'markup', '#markup' => $markup); } function recent_retreat_talks_retreat_title($rid) { // Optional: compute a dynamic title from DB if you like; // or just return a generic title: return t('Retreat recordings'); } function recent_retreat_talks_retreat_page($rid) { recent_retreat_talks_attach_assets(); $markup = recent_retreat_talks_render_from_file('retreat.php', array('id' => (int) $rid)); return array('#type' => 'markup', '#markup' => $markup); }