views:

135

answers:

2

I have added a new directory in my joomla website:

http://sitedomain.tld/xxx/

then I have added index.php in that directory

here is the code

    define( '_JEXEC', 1 );

define('JPATH_BASE', '..' );

define( 'DS', DIRECTORY_SEPARATOR );

require_once ( '../includes/defines.php' );
require_once ( '../includes/framework.php' );




//JDEBUG ? $_PROFILER->mark( 'afterLoad' ) : null;

/**
 * CREATE THE APPLICATION
 *
 * NOTE :
 */



$mainframe =& JFactory::getApplication('site');
$template_name = $mainframe->getTemplate();;

$mainframe->initialise();

JPluginHelper::importPlugin('system');


/**
 * ROUTE THE APPLICATION
 *
 * NOTE :
 */
$mainframe->route();

// authorization
$Itemid = JRequest::getInt( 'Itemid');
$mainframe->authorize($Itemid);

// trigger the onAfterRoute events
//JDEBUG ? $_PROFILER->mark('afterRoute') : null;
//$mainframe->triggerEvent('onAfterRoute');

/**
 * DISPATCH THE APPLICATION
 *
 * NOTE :
 */
$option = JRequest::getCmd('option');
//$mainframe->dispatch($option);

// trigger the onAfterDispatch events
//JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
//$mainframe->triggerEvent('onAfterDispatch');

/**
 * RENDER  THE APPLICATION
 *
 * NOTE :
 */

$mainframe->render();    


/**
 * RETURN THE RESPONSE
 */

var_dump($document->getHeadData());
echo JResponse::toString($mainframe->getCfg('gzip'));

sdwdwd wdwd

When I view this page in the browser, all the dynamic links like CSS, JS and images were suffixed by the /xxx/ path which make them broken !

How can I drop this suffix or how do I change this suffix from /xxx to / to it points to the original files location?

I have tried setting the JDocument::setBase and also tried to play with the JURI object and changed its _path and _uri without any change

Thanks

A: 

Shouldn't JPATH_BASE be an absolute path (eg. realpath('..'))?

Also, you can try setting in template.

GDR
A: 

I don't recommend circumventing the Joomla rendering process like this. You would be much better off creating a component rather than trying to do whatever you're goals are here.

Essentially I think the issue is you're actually creating a new instance and too many things expect resources to be located in certain paths. You're asking for a lot of trouble here, I can't even being to think of all the settings that would be affected by this move. That is why I would not do this, and make a component.

gnomeontherun