dinoslikeroar Posted October 13, 2016 Share Posted October 13, 2016 How can I go about adding a verbiage to a landing page to display for a certain group? Landing page is index.html. Need to do a php call. Not sure what other information I need to provide to get help. tia. Quote Link to comment https://forums.phpfreaks.com/topic/302325-php-call-to-display-a-verbiage/ Share on other sites More sharing options...
cyberRobot Posted October 13, 2016 Share Posted October 13, 2016 Do you have a way to determine if the certain group is online, such as a login? Quote Link to comment https://forums.phpfreaks.com/topic/302325-php-call-to-display-a-verbiage/#findComment-1538247 Share on other sites More sharing options...
dinoslikeroar Posted October 13, 2016 Author Share Posted October 13, 2016 Do you have a way to determine if the certain group is online, such as a login? This below is what's being used to pull that information. $special_group = $account_info['account']['screeningGroup']; $scrn_grp_no_spaces = preg_replace('/[\s]+/', '', ucwords(strtolower($special_group))); Quote Link to comment https://forums.phpfreaks.com/topic/302325-php-call-to-display-a-verbiage/#findComment-1538249 Share on other sites More sharing options...
cyberRobot Posted October 13, 2016 Share Posted October 13, 2016 Have you tried using the if construct? Basically, you would enclose the extra verbiage with the if construct. <?php if($special_group == 'group name goes here') { //extra verbiage goes here } ?> If multiple groups need to see the extra verbiage, you could use the in_array() function. More information can be found here: http://php.net/manual/en/function.in-array.php Quote Link to comment https://forums.phpfreaks.com/topic/302325-php-call-to-display-a-verbiage/#findComment-1538254 Share on other sites More sharing options...
cyberRobot Posted October 13, 2016 Share Posted October 13, 2016 Landing page is index.html. I just noticed the above text. Does your page need to be named with a .html extension? You typically need to use a .php extension to run PHP. Of course, servers can be configured to run PHP code in .html files. Quote Link to comment https://forums.phpfreaks.com/topic/302325-php-call-to-display-a-verbiage/#findComment-1538255 Share on other sites More sharing options...
dinoslikeroar Posted October 14, 2016 Author Share Posted October 14, 2016 Have you tried using the if construct? Basically, you would enclose the extra verbiage with the if construct. <?php if($special_group == 'group name goes here') { //extra verbiage goes here } ?> If multiple groups need to see the extra verbiage, you could use the in_array() function. More information can be found here: http://php.net/manual/en/function.in-array.php There will be a list of six groups that need to see this. The file is .html but has php and is config to run. Would it be something like this? If I need it to display above the Heading info $special_group = $client_info['account']['screeningGroup']; $spc_grp_no_spaces = preg_replace('/[\s]+/', '', ucwords(strtolower($special_group))); $special_group = array('Student', 'Medical', 'Testers', 'Contractor', 'Volunteers'); if (in_array(($special_group)){ //veribage text } array( 'text' => <<<APHtml <div> <p> <b><u>Heading</u></b> </p> <p> Display text here. </p> </div> APHtml Quote Link to comment https://forums.phpfreaks.com/topic/302325-php-call-to-display-a-verbiage/#findComment-1538285 Share on other sites More sharing options...
cyberRobot Posted October 14, 2016 Share Posted October 14, 2016 The $special_group variable contains the visitor's group information, so you don't want to overwrite that. You could try something like this <?php $special_group = $client_info['account']['screeningGroup']; $spc_grp_no_spaces = preg_replace('/[\s]+/', '', ucwords(strtolower($special_group))); $groups_with_access = array('Student', 'Medical', 'Testers', 'Contractor', 'Volunteers'); if (in_array($special_group, $groups_with_access)){ //veribage text } ?> Quote Link to comment https://forums.phpfreaks.com/topic/302325-php-call-to-display-a-verbiage/#findComment-1538286 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.