Welcome, Guest
Username: Password: Remember me

TOPIC: [ADDED] redirection with anchor

redirection with anchor 10 May 2016 08:33 #13938

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
Hi, I would like to apply an anchor to a redirection, i mean site.com/namecomponent/service/#id250

I do correctly the redirection with no code (because i am on the view) or i can do via applyRedirection

$this->applyRedirection($result, array(
'stay',
'com_namecomponent.service.default'
), array(
'cid[]' => null
));

how could i add an anchor here ???

thanks in advance
The administrator has disabled public write access.
The following user(s) said Thank You: krasy

redirection with anchor 10 May 2016 12:03 #13940

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
What does 'anchor' means for you ?

This redirection will be applied AFTER a task execution.
First array of parameters
[0] => if the result is FALSE
[1] => if the result is TRUE

Second array of parameters
Define the vars you want in the url.

If you want to use this redirector, you must create a function in the controller catching a task.
Are you really sure to do that ?

If you need a simple link using SEO, you can do it with JDom: html.link
using 'route' parameter containing associatives values :
'route' => array(
 'option' => 'mycomponent',
 'view' => 'myview',
 '..' => '..'
);

Hope it helps.
Coding is now a piece of cake
The administrator has disabled public write access.

redirection with anchor 10 May 2016 13:16 #13944

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
I have a view where i have a list of small forms
<div id="form1"><form ....
</form>
</div>
...
..

So i can change a value inside this form, it goes to the controller and then it come back to this view.
That's fine
The problem is that everytime i save a form, when reload the page it display the top of the page, i would like to display the page at the level of the modified form, so i would like to add at the end of the returning path #form8 for instance
The administrator has disabled public write access.

redirection with anchor 11 May 2016 10:39 #13953

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Ok. I understand.
No it is not possible at the moment.

Wait... I can have a look, this is pretty easy to add..
Hold on.
Coding is now a piece of cake
The administrator has disabled public write access.

redirection with anchor 11 May 2016 10:50 #13954

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Et voilà...

Job done.

Now, you can set up your anchor in the vars array.
Simply use the '#' char to define it as follow :
$this->applyRedirection($result, array(
	'stay',
	'com_xxxxxx.cities.default'
), array(
	'cid[]' => null,
	'#' => 'myAnchor'
));

Simple feature, but simple, efficient and usefull.
Coding is now a piece of cake
Last Edit: 11 May 2016 10:52 by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: albert, krasy

redirection with anchor 11 May 2016 16:30 #13958

  • krasy
  • krasy's Avatar
  • Offline
  • Premium Member
  • Posts: 90
  • Thank you received: 8
  • Karma: 5
heh ;)
great I ll use that too!
if you hit toggle button on collection the page reloads and goes to top,

now its fixed only have to change
controller
and toggle() function

had some strange issues but
i ve changed
case 'default.toggle'
to
case 'default.toggle_open'
and make it work.
Last Edit: 11 May 2016 16:38 by krasy.
The administrator has disabled public write access.

redirection with anchor 11 May 2016 20:02 #13961

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
P E R F E C T !!!!!!!!!!!!!!!!!!!!!
The administrator has disabled public write access.
Time to create page: 0.079 seconds

Get Started