I am trying to validate the $argument variable but am not sure if the validation ever happens.Following is the code i have for testing this... Is there something wrong...

if ( $argument[0] =="A")
return TRUE;
else
return FALSE;

Comments

nevets’s picture

What is the context for this code? What do you expect $argument to be?

rbalji’s picture

Thanks for taking a look at it...

I am using domain access module and calendar events. I want to filter out all the events based on the subdomain. I have included a custom field which stores the current subdomain. So while an user clicks on this view, he should be able to view only the calendar events of that particular subdomain.

Is there a easy and better of doing this without this php validate code? The following is what i am trying to acheive. Please let me know your thioughts

$domainarray = explode('.', $_SERVER['HTTP_HOST']);

if ( $argument[0] == $domainarray[0] )
return TRUE;
else
return FALSE;

uufsm’s picture

I would simply use the existing VIEWS filter on the calendar displays to exclude any events not belonging to the current domain.
- Filter > Domain Source > select "is one of" and then pick "current domain"