View Full Version : php script help needed.

01-15-2012, 02:01 PM
hi! friends,

I am working on a php script and this is below


require_once('EmailTemplates.php' );

$oEmailTemplates = new EmailTemplates();
$aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed');

sendMail($site['email_notify'], 'test mail', $aTemplate['Body']);
so when i visit example.com/send.php this script send a mail and that is okay but i am trying this

function sendAdminMail() {
$oEmailTemplates = new EmailTemplates();
$aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed');
sendMail($site['email_notify'], 'test mail', $aTemplate['Body']);
this is the function but i want this to execute from another file something like this.

return $this -> oModule -> sendAdminMail();

so, when i visit example.com/visit.php the same thing should happened and a mail should be sent.
but nothing happeneds i am not an advance coder of php so i am making some mistake can you all tell me what is the mistake and what to do?

any help will be very appreciated.

01-15-2012, 02:07 PM
What are you returning from in that last block?

As for sendAdminMail, is this function a procedural definition, or has it been added to the class represented under $this->oModule?

01-15-2012, 02:16 PM
if( false != bx_get('survey') && false != bx_get('page_uid') ) {
return $this -> oModule
-> sendAdminMail();
else {
return $this -> oModule -> getSurveyDecorationForm($this -> aSurveyInfo);
this is the nearby code and it in a class its a method.

01-15-2012, 02:32 PM
Nearby code does not help.
How is this function being called? Any errors generated by the run (check your error logs).

01-15-2012, 02:38 PM
here i have attached the two files which is unmodified and i want these function in it and its error free just not work :).
basically i want to call that function from the other file.

01-15-2012, 02:46 PM
Neither of these files contains the relevant code you are talking about.

01-15-2012, 02:54 PM
yes i have modified it and added the code i posted before. The thing i want is
a mail send where this "//-- process recived answers --//" is in the file SasSurveyView.php at line 128 replacing
return $this -> oModule
-> processAnswers( $this -> aSurveyInfo, bx_get('survey'), bx_get('page_uid') );
with the correct code.