2

i have a problem with my joomla component seo url building.

i have links like:

$link = JRoute::_( 'index.php?option=com_expose$view=expose&id='.$result->id );
$link2 = JRoute::_( 'index.php?option=com_expose$view=search' );

The seo url looks like:

www.domain.com/component/expose/123 www.domain.com/component/search

How can i now make my own alias for the url ? I want somethink like this:

www.domain.com/expose/the-beautiful-page

Without the component and with a title for the id.

by router.php looks like:

function ExposeBuildRoute( &$query )
{
       $segments = array();
       if(isset($query['view']))
       {
                $segments[] = $query['view'];
                unset( $query['view'] );
       }
       if(isset($query['id']))
       {
                $segments[] = $query['id'];
                unset( $query['id'] );
       };
       return $segments;
}

function ExposeParseRoute( $segments )
{       
       $vars = array();
       switch($segments[0])
       {
               case 'search':
                       $vars['view'] = 'search';
                       $id = explode( ':', $segments[1] );
                       $vars['id'] = (int) $id[0];
                       break;
               case 'expose':
                       $vars['view'] = 'expose';
                       $id = explode( ':', $segments[1] );
                       $vars['id'] = (int) $id[0];
                       break;
       }
       return $vars;
}

What must be done, to remove the /component/ alias and replace the id with the right title.

Big thanks.

Mafi
  • 31
  • 3

1 Answers1

0

The problem is that there is no menu item for it to lookup the component. Because of that Joomla needs the component parameter in the url. I think there is no way to remove the component part in the url. Perhaps you should ask in the dev mailing list https://groups.google.com/forum/#!forum/joomla-dev-general. But I don't think so this is possible.

There is a way to modify the router with a system plugin http://docs.joomla.org/J2.5:Creating_a_System_Plugin_to_augment_JRouter. But I don't think so this would help in your case.

Laoneo
  • 1,546
  • 1
  • 18
  • 25