This should be done within the modules template class. The very first thing you were trying to do should be the proper way. You have only posted 1 line from the modules template class.
var $_iPageIndex = 500
I would need to see more of that code above and below that line to figure out a solution.
Attached is the original BxTravelerTemplate.php file, however I have quoted the pertinent below in blue where I have made my mods in red text.
class BxTravelerTemplate extends BxDolTwigTemplate {
check_logged();
if (isLogged(){
var $_iPageIndex = 500;
}else{
var $_iPageIndex = 501;
}
var $oDb;
function BxTravelerTemplate(&$oConfig, &$oDb) {
...
}
Please note that when I place the if-then-else statement for the "var" statement (see above in red), I get the following error message. This happens whether I have isLogged or isMember.
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /home/user/public_html/modules/modder/traveler/classes/BxTravelerTemplate.php on line 32
It's as though it won't accept any "if" statements between the "class" and "function" statements. So I removed the mod, and I instead went to /inc/classes/BxDolTemplate.php where $iPageIndex is considered. and I added the following below "function processInjection".
function processInjection($iPageIndex, $sKey, $sValue = "") {
if($iPageIndex == 500){
check_logged();
if(!isLogged()){
$iPageIndex = 501; }
}
if($iPageIndex != 0 && ...
Still no success! This time, although I echo the $iPageIndex and verify that it is 500 or 501 depending on when I am logged in or not, it still shows the default 500 page!
The only reason it would not work is if the page index is getting changed back further in code, or if page 501 is the same as page 500.
This should easily be able to be done.
Yes, somehow the page index is getting changed or something. No, page 500 is not the same as 501 page...guaranteed.
Please help if you can.