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.201 seconds

Freakin' Awesome!!! J-Cook is simply awesome - whether you're a highly experienced developer or complete novice whether you're building a small inventory component or a complete community solution! The beauty comes from a fast slick and reliable platform that readily provides developers with everything they'll need to build the backbone of a solid and secure component with wizards for authoring access publishing aliasing created/modified by dates... you name it COOK provides it! J-Cook really surpasses all of the 'competition' as far as MVC tools are concerned! Try love it and get cooking!
learnthrusong (JED)
          

Get Started