James Wright James Wright - 1 month ago 13
PHP Question

PHP action inside PHP already running

Good Day

I am not sure if this is possible but any advice would be greatly be appreciated.

I have a code in PHP as below and would like to add additional PHP code Not sure how to explain it but maybe if I show code it would make some sence.

<?php
//Clickatell login
$user = "##";
$password = "##";
$api_id = "##";
$baseurl ="http://api.clickatell.com";

$text = urlencode("Recovery Assist Panic Activated (BETA TEST VERSION");

$to = "'0827910119'";

?>


The above is the current code I have with some additional extra's not required here. I want to add the following to this code as part of Sitelok page manager

<?php
//Clickatell login
$user = "##";
$password = "##";
$api_id = "##";
$baseurl ="http://api.clickatell.com";

$text = urlencode("Recovery Assist Panic Activated (BETA TEST VERSION");

<?php if (sl_ismemberof("RecAssist")){ ?>
$to = "'0827911119'";
<?php } ?>
<?php if (sl_ismemberof("Gold")){ ?>
$to = "'0827952558'";
<?php } ?>
?>


The "is a member of" is part of the sitelok code to exclude on HTML where a person does not have access to. I am not sure if I can run another inside the one running already. I know this can be done with IF and ELS most prob but the coding for the amount of groups will just be too much so hoped that somehow I can use the Sitelok section

Answer

Why not just use an if statement?

e.g.

<?php
//Clickatell login
$user     = "##";
$password = "##";
$api_id   = "##";
$baseurl  = "http://api.clickatell.com";
$text     = urlencode("Recovery Assist Panic Activated (BETA TEST VERSION");

if (sl_ismemberof("RecAssist")){
    $to = "'0827911119'";
} elseif (sl_ismemberof("Gold")) {
    $to = "'0827952558'";
}
?>