if neither are met
Posted: Fri Apr 09, 2010 2:47 pm
first off the dreaded noob strikes again, I am a designer moving his way into php.
I am currently working with the modx cms platform and I am creating an area for clients. when I have client A logged in it shows a custom chunk of html for them, when I have client B logged in it shows a custom chunk for them, that I have resolved, the problem I am finding is if the client is NEITHER A or B, how do I show another chunk of html?
Yes, I have gone to modx forums, but it's time I get my proverbial cr*p together and really get educated on how to properly use and implement PHP by asking the big boys. (hope you guys won't be too brutal like the Linux forums back in the day)
the {{chunks}} shown above are custom html for those two clients in two languages, but let's say a new client logs on, i would like them to see a chunk for a new user in both languages.
any help would be enormously appreciated.
I am currently working with the modx cms platform and I am creating an area for clients. when I have client A logged in it shows a custom chunk of html for them, when I have client B logged in it shows a custom chunk for them, that I have resolved, the problem I am finding is if the client is NEITHER A or B, how do I show another chunk of html?
Yes, I have gone to modx forums, but it's time I get my proverbial cr*p together and really get educated on how to properly use and implement PHP by asking the big boys. (hope you guys won't be too brutal like the Linux forums back in the day)
Code: Select all
<?php
$output ='';
$doc_id = $modx->documentIdentifier;
$doc_array_1 = array('54');
$doc_array_2 = array('107');
$username = isset($_SESSION['webShortname']) ? $_SESSION['webShortname'] : '';
if($username =='dave'){
if(in_array($doc_id, $doc_array_1)){
$output .='{{dave}}';
}elseif(in_array($doc_id, $doc_array_2)){
$output .='{{davespanish}}';
}else{
$output .='{{dave}}';
if($username =='bill'){
if(in_array($doc_id, $doc_array_1)){
$output .='{{pablo}}';
}elseif(in_array($doc_id, $doc_array_2)){
$output .='{{pablospanish}}';
}else{
$output .='{{pablo}}';
?>
any help would be enormously appreciated.