Hi Bob,
Well I tried it, but it is not working where I need it to.. But after rereading your response (below) I just wonder if I am doing it wrong.
I am working in the PayPal Redirect event and in the Return URL field... This is my contents...
<?php echo JURI::root().'index.php?option=com_content&view=article&id=8' ?>
does the Return URL field accept PHP?
OR
should I be using the curly brackets and put that string in custom code like?
//custom code//
$form->data['return_url'] =JURI::root().'index.php?option=com_content&view=article&id=8';
//end custom////
AND
//Paypal redirect Return URL field////
{return_url}
//end paypal redirect///
Thanks
Tom
Hi Tom,
There are two different groups of Joomla! PHP values that you can use here.
A) There are some Defined terms for Paths (that is folder paths not URLs) like JPATH_SITE, JPATH_ROOT, JPATH_BASE, JPATH_COMPONENT and JPATH_ADMINISTRATOR
Usually JPATH_SITE is the one to use if you are in the front-end.
Note that this doesn't include a final / separator so you need to add that. In Joomla! 1.5 you needed to specify the path separator using DS to handle both Windows and Linux servers. In Joomla! 2.5 I think this is supposed to be automated but I still add it.
So a path might look like JPATH_SITE.DS.'components.DS.'com_chronoforms'.DS.'includes'.DS.'some_file_name'
Here's an extract from the Joomla! Forums with a little more explanation:
JPATH_SITE is meant to represent the root path of the JSite application, just as JPATH_ADMINISTRATOR is mean to represent the root path of the JAdministrator application.
JPATH_BASE is the root path for the current requested application.... so if you are in the administrator application, JPATH_BASE == JPATH_ADMINISTRATOR... if you are in the site application JPATH_BASE == JPATH_SITE... if you are in the installation application JPATH_BASE == JPATH_INSTALLATION.
JPATH_ROOT is the root path for the Joomla install and does not depend upon any application.
B) If you want the URL - for the Notify URLs then use the JURI object which lets you access the current URL. Again there are several different methods. JURI::base(), JURI::root(), JURI::current()
You probably want to use JURI::root() for your URLs in the front-end.
Note JURI::root() does include the final \ separator so you don't need to include this and you don't need to use the DS in URLs so an example would be
JURI::root().'index.php?option=com_chronoforms&chronoform=order_card&event=ipn'There are a lot more JURI methods that you can use to work with URLs if you need to, check the Joomla! docs if you need them.
There is one more piece of generalisation that you might find useful. The current form name is available in
$form->form_details->name so you could use
JURI::root()."index.php?option=com_chronoforms&chronoform={$form->form_details->name}&event=ipn" to share code across different forms and sites.
Bob