Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
899 views
in Q2A Core by

1 Answer

0 votes
by

If you want to use the Joomla Framework within Question2Answer I think you will want to add something like this to your Q2A code.

Please note that this is not my code, so I probably won't be able to answer any questions about it.

I believe the code below was intended for external PHP that would be used with Joomla 1.5.

<?php

define( '_JEXEC', 1 );
 
// real path depending on the type of server
// change the number of returns/level needed in your path relative to the position of your script in your directory
if (stristr( $_SERVER['SERVER_SOFTWARE'], 'win32' )) {
define( 'JPATH_BASE', realpath(dirname(__FILE__).'\..\..\..\..' ));
} else define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../../../..' ));
 
define( 'DS', DIRECTORY_SEPARATOR );
 
// loading framework of Joomla!
require_once ( JPATH_BASE.DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE.DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
 
// if need a specific language component, you can load it here
 
jimport( 'joomla.plugin.plugin' );
 
JPlugin::loadLanguage( 'com_xxxxxxxxx' );
 
// original code here or your code continue here ...
2?>
 
 
by
edited by
I should say that this doesn't synchronise users it just allows you to use some of the Joomla functionality in Q2A.
If you want your Q2A to work using your Joomla database I think you will need to take a look at http://www.question2answer.org/single-sign-on.php
...