0

i am newer to joomla component please help me.

i create one small joomla component as per user requirement. and its run perfect. now i have one issue in this component i am trying to provide sef support in this component but i have no idea how to do.

i read this link - http://docs.joomla.org/Supporting_SEF_URLs_in_your_component#Routing_URL.27s

and i create one router file in my component. in router.php file.

<?php
function joomBuildRoute( &$query )
{
       $segments = array();
       if(isset($query['view']))
       {
                $segments[] = $query['view'];
                unset( $query['view'] );
       }
       if(isset($query['id']))
       {
                $segments[] = $query['id'];
                unset( $query['id'] );
       };
       if(isset($query['layout']))
       {
                $segments[] = $query['layout'];
                unset( $query['layout'] );
       };

       return $segments;
}

function joomParseRoute($segments)
{
       $vars = array();
      $app =& JFactory::getApplication();
       $menu =& $app->getMenu();
       $item =& $menu->getActive();
       // Count segments
       $count = count( $segments );
       //Handle View and Identifier
       switch( $item->query['view'] )
       {

             case 'message':
                   $id   = explode( ':', $segments[$count-1] );
                   $vars['id']   = (int) $id[0];
                   $vars['view'] = 'message';
                   break;
       }
       return $vars;
}
?>
BenMorel
  • 34,448
  • 50
  • 182
  • 322
Mayur
  • 31
  • 5
  • Is there any error? Is Joomla .htaccess file active on your host and URL rewriting activated on your backend? – Arnaud Feb 09 '12 at 14:52
  • Thanks for replay. it's not shown any error. my url rewrite successfuly. but its not redirect into this page. when i click on button its rewrite this url but not redirect on to that page. its display first page all time. how to redirect on that page? Thanks. – Mayur Feb 10 '12 at 04:25
  • Does you component requires layout set? If yes, set layout variable in case 'message'. – di3sel Feb 10 '12 at 07:11
  • we need a bit more info about your component. what do your current urls look like and how you want your sef urls too look like? – Kristian Hildebrandt Feb 10 '12 at 16:34

1 Answers1

0

thanks,

its not done.

some other problem here.

page url rewite but its not redirect on that.

suppose here url when i click on message button is JOOMLA/joom/index.php/component/joom/message/default

means its rewrite but not display message page.

thanks.

Mayur
  • 31
  • 5