How to write a Back Button?

297 views
Skip to first unread message

reansey

unread,
Oct 25, 2010, 2:14:07 AM10/25/10
to Joomla! General Development
Hello all!

I need to write a back button in one joomla component. Example, when
create new file and then I want to back to the main component page no
need to back to page that I was create. So how do i? Please give some
clue. Thank

Andy Tolle

unread,
Oct 25, 2010, 2:35:18 AM10/25/10
to Joomla! General Development
In your view(template) you include the following code:
<input type="hidden" name="referer" value="<?php echo base64_encode(@
$_SERVER['HTTP_REFERER']); ?>" />

In your controller, you add:
$referer = JRequest::getString('referer', JURI::base(), 'post');
$referer = base64_decode($referer);
$this->setRedirect($referer);

reansey seng

unread,
Oct 25, 2010, 2:39:36 AM10/25/10
to joomla-de...@googlegroups.com
But I use in component only. I want to it with JToolBarHelper::back();
   

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.




--
--------------------------------
Best Wish
Seng Rean Sey
IT Teacher at Asia HRDC
Tel:099930056
website:http://www.khmertechno.com

Andy Tolle

unread,
Oct 25, 2010, 3:13:04 AM10/25/10
to Joomla! General Development
As far as I know, unless you specify otherwise a
"JToolBarHelper::back();"-button will add javascript
"javascript:history.back();".

Differently said: if you just add "JToolBarHelper::back();" to your
component admin side and leave all parameters blank, the button should
work, returning to the previous page.

If it doesn't or if it redirects to a page you don't want, just fill
in the parameters: "JToolBarHelper::back('My alternative text to
display', 'index.php?option=com_mycomponent&view=my_view');"...
differently said: give as parameter the URL you want to redirect to.




On Oct 25, 8:39 am, reansey seng <rean...@gmail.com> wrote:
> But I use in component only. I want to it with JToolBarHelper::back();
>
>
>
> On Mon, Oct 25, 2010 at 1:35 PM, Andy Tolle <andy.to...@gmail.com> wrote:
> > In your view(template) you include the following code:
> > <input type="hidden" name="referer" value="<?php echo base64_encode(@
> > $_SERVER['HTTP_REFERER']); ?>" />
>
> > In your controller, you add:
> > $referer = JRequest::getString('referer', JURI::base(), 'post');
> > $referer = base64_decode($referer);
> > $this->setRedirect($referer);
>
> > On Oct 25, 8:14 am, reansey <rean...@gmail.com> wrote:
> > > Hello all!
>
> > > I need to write a back button in one joomla component. Example, when
> > > create new file and then I want to back to the main component page no
> > > need to back to page that I was create. So how do i? Please give some
> > > clue. Thank
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Joomla! General Development" group.
> > To post to this group, send an email to
> > joomla-de...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > joomla-dev-gene...@googlegroups.com<joomla-dev-general%2Bunsu...@googlegroups.com>
> > .

reansey seng

unread,
Oct 25, 2010, 3:15:39 AM10/25/10
to joomla-de...@googlegroups.com
Ok thank, I test it first. If I have more problem i will groups more.

To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Reply all
Reply to author
Forward
0 new messages