Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

redirection with anchor 10 May 2016 08:33 #13938

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 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 following user(s) said Thank You: krasy

Please Log in or Create an account to join the conversation.

redirection with anchor 10 May 2016 12:03 #13940

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

redirection with anchor 10 May 2016 13:16 #13944

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 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

Please Log in or Create an account to join the conversation.

redirection with anchor 11 May 2016 10:39 #13953

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

redirection with anchor 11 May 2016 10:50 #13954

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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
The following user(s) said Thank You: albert, krasy

Please Log in or Create an account to join the conversation.

Last edit: by admin.

redirection with anchor 11 May 2016 16:30 #13958

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.

Please Log in or Create an account to join the conversation.

Last edit: by krasy.

redirection with anchor 11 May 2016 20:02 #13961

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 2
P E R F E C T !!!!!!!!!!!!!!!!!!!!!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.110 seconds

I must say that I'm leaps and bounds ahead of where I would have other been with J2.5 with full thanks to the folks on this forum and specifically to Cook so you'll never hear me complaining.
gdpodesta (Forum)  

Get Started