Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Improvements to grammar and formatting
Source Link
mickmackusa
  • 4.8k
  • 4
  • 18
  • 48

Joomla 3.x rountingrouting and slug problem

Hi All

I have a doubt that I don't know how to solve and I can't find a solution.

the problem: I have 1 component with 2 views - default is view1 - secondary is view2. When

When I associate it with the menu, from backofficethe backend, joomlaJoomla creates me the correct url for SEO, with alias for SEO. Example: www.sitename.com/view1

Example: www.sitename.com/view1

When from view1, I click the content and it goes to view 2 to view2. To link it I use: ?option=com_myname&view=view2?option=com_myname&view=view2

The complete url will be: www.sitename.com/?option=com_myname&view=view2www.sitename.com/?option=com_myname&view=view2

Everything works, but I would like to make the url be www.sitename.com/view2www.sitename.com/view2 and not www.sitename.com/?option=com_myname&view=view2www.sitename.com/?option=com_myname&view=view2

I wrote the router.php inside the component and register the name view.

$view1 = new JComponentRouterViewconfiguration('view1');
$view1 ->setKey('id');
$this->registerView($view1);

$view2 = new JComponentRouterViewconfiguration('view2');
$view2 ->setKey('id');
$this->registerView($view2);

and I created a legacyrouter file inside the helphelper folder, but when inside function build I print the view highlight_string(print_r($item->query['view'] ,true));

highlight_string(print_r($item->query['view'] ,true));

it always gives me view1view1 even if in the url I wrote view2 .... iview2

I am not sure if the procedure is correct, in. In any case, how do iI change the slug  / aliasalias?

thereThere is no function like example RegisterViewAndAlias('?option=com_myname&view=view2', 'view2');: RegisterViewAndAlias('?option=com_myname&view=view2', 'view2');

howHow do iI change SLUGthe slug?

Joomla 3.x rounting and slug problem

Hi All

I have a doubt that I don't know how to solve and I can't find a solution.

the problem: I have 1 component with 2 views - default is view1 - secondary is view2. When I associate it with the menu, from backoffice, joomla creates me the correct url for SEO, with alias. Example: www.sitename.com/view1

When from view1 I click the content and it goes to view 2 to link it I use: ?option=com_myname&view=view2

The complete url will be: www.sitename.com/?option=com_myname&view=view2

Everything works but I would like to make the url be www.sitename.com/view2 and not www.sitename.com/?option=com_myname&view=view2

I wrote the router.php inside the component and register the name view

$view1 = new JComponentRouterViewconfiguration('view1');
$view1 ->setKey('id');
$this->registerView($view1);

$view2 = new JComponentRouterViewconfiguration('view2');
$view2 ->setKey('id');
$this->registerView($view2);

and I created a legacyrouter file inside the help folder, but when inside function build I print the view

highlight_string(print_r($item->query['view'] ,true));

it always gives me view1 even if in the url I wrote view2 .... i am not sure if the procedure is correct, in any case how do i change slug  / alias?

there is no function like example RegisterViewAndAlias('?option=com_myname&view=view2', 'view2');

how do i change SLUG?

Joomla 3.x routing and slug problem

I have 1 component with 2 views - default is view1 - secondary is view2.

When I associate it with the menu from the backend, Joomla creates the correct url with alias for SEO.

Example: www.sitename.com/view1

When from view1, I click the content and it goes to view2. To link it I use: ?option=com_myname&view=view2

The complete url will be: www.sitename.com/?option=com_myname&view=view2

Everything works, but I would like to make the url www.sitename.com/view2 and not www.sitename.com/?option=com_myname&view=view2

I wrote the router.php inside the component and register the name view.

$view1 = new JComponentRouterViewconfiguration('view1');
$view1 ->setKey('id');
$this->registerView($view1);

$view2 = new JComponentRouterViewconfiguration('view2');
$view2 ->setKey('id');
$this->registerView($view2);

I created a legacyrouter file inside the helper folder, but when inside function build I print the view highlight_string(print_r($item->query['view'] ,true));

it always gives me view1 even if in the url I wrote view2

I am not sure if the procedure is correct. In any case, how do I change the slug/alias?

There is no function like: RegisterViewAndAlias('?option=com_myname&view=view2', 'view2');

How do I change the slug?

edited tags
Link
pe7er
  • 2.1k
  • 1
  • 8
  • 25
Source Link

Joomla 3.x rounting and slug problem

Hi All

I have a doubt that I don't know how to solve and I can't find a solution.

the problem: I have 1 component with 2 views - default is view1 - secondary is view2. When I associate it with the menu, from backoffice, joomla creates me the correct url for SEO, with alias. Example: www.sitename.com/view1

When from view1 I click the content and it goes to view 2 to link it I use: ?option=com_myname&view=view2

The complete url will be: www.sitename.com/?option=com_myname&view=view2

Everything works but I would like to make the url be www.sitename.com/view2 and not www.sitename.com/?option=com_myname&view=view2

I wrote the router.php inside the component and register the name view

$view1 = new JComponentRouterViewconfiguration('view1');
$view1 ->setKey('id');
$this->registerView($view1);

$view2 = new JComponentRouterViewconfiguration('view2');
$view2 ->setKey('id');
$this->registerView($view2);

and I created a legacyrouter file inside the help folder, but when inside function build I print the view

highlight_string(print_r($item->query['view'] ,true));

it always gives me view1 even if in the url I wrote view2 .... i am not sure if the procedure is correct, in any case how do i change slug / alias?

there is no function like example RegisterViewAndAlias('?option=com_myname&view=view2', 'view2');

how do i change SLUG?