Hi everyone and thanks in advance for the help you can give me.
I am creating a joomla module to show articles via ajax, I'm almost finished, I have the problem with the url.
The problem is that the module makes a call via ajax to search.php. All returns me well except the url.
The url that returns me is: /www.miste.com/modules/mod_mymodule/index.php?option=com_content&view=article&id=12:mi-title-article&catid=10&Itemid=107
The right thing would be: / www.miste.com/index.php?option=com_content&view=article&id=12:mi-title-article&catid=10&Itemid=107
Part of my code is as follows:
if ( !$_GET ) exit;
if ( !defined( "_JEXEC" ) ) define( "_JEXEC", "\r\n" ) or die('Restricted access');
define( 'DS', DIRECTORY_SEPARATOR );
define('JPATH_BASE', dirname(dirname(dirname(__FILE__))) );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
require_once ( JPATH_BASE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
require_once ( JPATH_BASE.DS.'components'.DS.'com_content'.DS.'router.php');
require_once (dirname(__FILE__).'/helper.php');
/** CREATE THE APPLICATION**/
$mainframe = JFactory::getApplication('site');
/**INITIALISE THE APPLICATION**/
$mainframe->initialise();
if(modFpncrFilterArticlesHelper::validaSelect($selectDestino) && modFpncrFilterArticlesHelper::validaOpcion($opcionSeleccionada))
{
$tabla=$listadoSelects[$selectDestino];
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('id, title, alias, catid')
->from('#__content')
->where('catid="'.$opcionSeleccionada.'"')
->where('state=1');
$db->setQuery($query);
$allarticles = $db->loadObjectList('id');
// Comienzo a imprimir el select
$InputsArticles = '';
foreach ($allarticles as $article){
$catslug = $article->catid;
$slug = $article->id.':'.$article->alias;
$link = JRoute::_(ContentHelperRoute::getArticleRoute($slug, $catslug));
$UrlArticle = JRoute::_( ContentHelperRoute::getArticleRoute($article->id.":".$article->alias, $article->catid), true);
$InputsArticles .= "<option value='". $link ."'>".$article->title."</option>";
}
$InputsArticles = $InputsArticles;
}
?>
<select name="<?php echo $selectDestino; ?>" id="<?php echo $selectDestino; ?>" onChange='cargaContenido(this.id)'>
<option value="0"><?php echo $article_label_active; ?></option>
<?php echo $InputsArticles; ?>
</select>
<input type="button" name="go" value="<?php echo $button_label; ?>" onclick="check_send();" class="btn btn-success" id="send">
Thanks in advance for the help you can give me