This topic is locked
[SOLVED]

 Working with additional pages

7/19/2019 4:47:11 PM
PHPRunner General questions
E
elephant author

I am using a variation of Calendar within 10.2 and have created an additional page (list1).
in Before Display I have the following event, the aim of which is, if there are no records to display, show list1.

if ($xt->getvar("records_found")<1)
header("Location: calcalendar_list.php?page=list1");

exit();


If the result is false, the user is presented with list.
However, if the result is true, I get a 'too many redirects' error.
I would appreciate any advice

admin 7/19/2019

I don't know if you have other code there or what $xt->getvar("records_found") returns but there is something that needs to be fixed no matter what - missing curly braces.
Another thing - this event also runs on a new list1 page meaning that you will keep redirecting user even if you are already on this page.
So this is what I think you need to use:

if ($xt->getvar("records_found")<1 && $_GET["page"]!="list1") {

header("Location: calcalendar_list.php?page=list1");

exit();

}
E
elephant author 7/20/2019

Thanks Sergey