Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Coding example quest... 02 Aug 2012 15:59 #2963

I am looking for some coding example inside the component to implement a button that will send a form.
Any other coding example is for sure welcome... !
Any suggestion ? Thanks.

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Re: Coding example quest... 05 Aug 2012 18:34 #3003

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
Should have asked that in the "coding inside your component" section...
Send a mail on saving a form ?
Then you have to implement it in the controller, in the function save()
  $mailer =& JFactory::getMailer();
  $config =& JFactory::getConfig();
  $sender = array(
	  $config->getValue( 'config.mailfrom' ),
	  $config->getValue( 'config.fromname' ));
  $mailer->setSender($sender);
  $mailer->Encoding = 'base64';
  $body = "blabla <br />";
  $body .= "blabla <span style = 'font-weight:bold; color:red;'>\"" . $variable . "\"</span><br />
  $mailer->setSubject('Your Subject');
  $mailer->setBody($body);

  $send =& $mailer->Send();
  if ( $send !== true ) {
	  echo 'Error sending email: ' . $send->message;
  } else {
	  $app = JFactory::getApplication();
	  $app->enqueueMessage('Mail Sent');
  }
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Last edit: by VeCrea.

Re: Coding example quest... 05 Aug 2012 18:56 #3009

So greatful... many thanks thats' a very good point.

About the category: :silly:
Yes I fact I agree but in fact I miss to set it up right at the first post
and afterward there is no way to move from forum category to another...

Please Log in or Create an account to join the conversation.

Last edit: by e-struct.

Re: Coding example quest... 05 Aug 2012 19:01 #3011

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
Yeah i saw you had the same problem on other posts ;)
Still needing help on the mail thing, or are you cool now ?
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.082 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started