views:

37

answers:

2

Hey,

We have a geeklog managed site running at

http://bhaa.ie

We recently setup a zend application on a subdomain that manages this page

http://bhaa.ie/members/public/index.php/event/list

We're hoping to better integrate the two domain, so that we can call this url

http://bhaa.ie/event/list

and have zend handle the request, while geeklog handles all other requests.

As i see it - we have 2 options

1: Update the .htaccess file to filter url requests between the geeklog and zend instances. or 2: Update the geeklog index.php to include the basic zend code

I'm just wondering has anybody any experience doing this, or could recommend which path to follow?

+1  A: 

If you only have a couple of URL in your ZF-based application (i.e. event/list and only a couple of others), I would go with your first solution : add a couple of RewriteRules to the .htaccess file of the geeklog website, to redirect specific URLs to the ZF-based application.

This way, your two applications remain quite separated : you don't have any code that's mixed between the two applications -- like your second solution would imply.

Pascal MARTIN
A: 

GeekLog allows you to enable an external page, but you need to call a geeklog custom method in your default Zend ./public/index.php.

In the example below, i had to

  1. Include the geeklog php library in the set_include_path()
  2. Call the EXP_externalAccess() method before calling the Zend app.

The full code for the '/public/index.php' is

<?php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    realpath(APPLICATION_PATH),
    '/home/bhaa1/public_html/lib-common.php',
    get_include_path()
)));

/** Zend_Application */
require_once '/home/bhaa1/public_html/lib-common.php';

$page_name = substr($_SERVER['SCRIPT_NAME'], 1);

if (!EXP_externalAccess($page_name)) {
    $display = COM_siteHeader('menu');
    $display .= COM_startBlock($LANG_EX00['access_denied']);
    $display .= '<div align="center"><b>' . 
                $LANG_EX00['access_msg'] . 
                '</b></div>';
    $display .= COM_endBlock();
    $display .= COM_siteFooter(yes);
    echo $display;
    exit;
}

require_once 'Zend/Application.php';  

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV, 
    APPLICATION_PATH . '/configs/dashboard.ini'
);

$application->bootstrap()->run();
?>

This ensures the page will only be called when a user has correct permissions.

The final step is to update my layout.phtml to have the geek-log 'menu' and 'footer' wrapping the html rendered by the zend app.

<?php echo COM_siteHeader('menu');?>

// .. ZEND LAYOUT STUFF

<?php echo COM_siteHeader('end');?>
emeraldjava