Forums

Redirection doesn't work

sesami444 11 Aug, 2016
Hi,

I've just upgraded Joomla to 3.6.2 which is the latest version. However, "custom code" doesn't work after this.
I mean, "redirect" function doesn't work after clicking on "submit". After clicking on submit button, then it is supposed to be redirected to top page in 4 seconds. It worked before upgrading. Do you have any ideas?

Here is the script.

<?php
$doc = JFactory::getDocument();
$doc->setMetaData('refresh', '4;url=http://www.photo-life.net/index.php', 'true');
?>
GreyHead 11 Aug, 2016
Hi sesami444,

Please replace $doc in the Custom Code with $jdoc - Max used $doc for something else in the later versions of ChronoForms and so the old code breaks :-(
<?php
$jdoc = \JFactory::getDocument();
$jdoc->setMetaData('refresh', '4;url=http://www.photo-life.net/index.php', true);
?>

Bob
FloB 11 Aug, 2016
Hi Bob,

After trying the modified code, it doesn't redirect neither.
Is there something that changed between Joomla 3.5 and Joomla 3.6 in the fonction setMetaData?
I've got the latest version of CC and CF.

Florence
sesami444 11 Aug, 2016
Hi, Bod

Thank you for your feedback and quick response. I always appreciate for your kind support 😀

BTW, I tried to change the script with yours, but I still have no luck....

Regards,
GreyHead 12 Aug, 2016
Hi sesami444,

Please remove the quotes '' round true - then it works OK. I've updated the code I posted earlier.

Bob
sesami444 12 Aug, 2016
Hi, Bob

Thanks for your feedback again. Sorry, I don't get your point. What is the correct script? I need to delete ' ' mark?
<?php
$jdoc = \JFactory::getDocument();
$jdoc->setMetaData('refresh', '4;url=http://www.photo-life.net/index.php', true);
?>

Regards,
GreyHead 12 Aug, 2016
Hi sesami444,

That is correct, please test.

Bob
FloB 12 Aug, 2016
Hi Bob,

It's working this time without the quotes around true.
Thank you for the quick and efficient support.

Florence
sesami444 12 Aug, 2016
Hi, Bob and Florence,

Yes, it is working without any changes now. Why? This script is supposed to be referred to the server or systems??

Please let me know.

Regards,
GreyHead 12 Aug, 2016
Hi sesami444,

Sorry, I don't understand your question. What this code does is to add a 'Meta' tag in the page header.

Bob
This topic is locked and no more replies can be posted.