Welcome, Guest
Username: Password: Remember me

TOPIC: Coding example quest...

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

  • e-struct
  • e-struct's Avatar
  • Offline
  • Senior Member
  • Posts: 76
  • Thank you received: 4
  • Karma: 5
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.
Last Edit: 06 Aug 2012 12:45 by admin.
The administrator has disabled public write access.

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

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
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');
  }
Last Edit: 05 Aug 2012 18:35 by VeCrea.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

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

  • e-struct
  • e-struct's Avatar
  • Offline
  • Senior Member
  • Posts: 76
  • Thank you received: 4
  • Karma: 5
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...
Last Edit: 05 Aug 2012 18:56 by e-struct.
The administrator has disabled public write access.

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

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Yeah i saw you had the same problem on other posts ;)
Still needing help on the mail thing, or are you cool now ?
The administrator has disabled public write access.
The following user(s) said Thank You: admin
Time to create page: 0.064 seconds

Get Started