PEAK XOOPS - Extending features of pico by smarty plugins(1) in englishin japanese

Archive | RSS |
XOOPS
XOOPS : Extending features of pico by smarty plugins(1)
Poster : GIJOE on 2007-09-23 15:41:58 (16091 reads)

in englishin japanese
Now, I show a practical examples how to use pico's formmail system.

Case 1:
"Implant forms after product presentation pages"

You can easily achive it using pico's smarty plugisn "pico" and "formmail".

Make a content like this. (Turn "Smarty" filter on)


(products introducing section)

<{capture}>
<{pico id="(content ID describing the form)"}>
<{/capture}>
<{formmail4fleamarket mail_body_pre="A query from visitor exists\nContact him/her soon as possible\n\n" from_name="Product manager" cc_field_name="youremail" cc_mail_subject="A confirmation for your query" cc_mail_body_pre="Thank you for querying us.\nThis is the content you have queried\n"}>


Also, you have to make a content like this.

<form>
  name: <input type="text" name="name" class="required" /><br />
  email: <input type="text" name="youremail" class="email" />
  <input type="submit" />
</form>

This content ID(number) will be specified the former content.
You can make a variety of forms, and specify their numbers as you like.

Of course, you can make form contents into the other pico module instance.
You can specify the form content by "dirname" parameter.h
<{pico id="(conent ID)" dirname="(dirname)"}>

Now we look long parameters of <{formmail}>.
Their parameters controls "mail actions".

legend)
mail_body_pre: specifying body part before the query content. (from XOOPS to adminmail)
from_name: specifying sender name
cc_field_name: specifying a field name for sending "confirming mail" to form poster.
cc_mail_subject: specifying Subject of "confirming mail"
cc_mail_body_pre: specifying body part before the query content of "confirming mail"


Related articles
Printer friendly page Send this story to a friend

Comments list

gigamaster  Posted on 2007/9/30 6:43 | Last modified
Hi Gijoe,

My fault. I was waiting to finish modules translation and start to play with Pico.
So, I did not read the "README" file and i put myself in troubles with my smarty bug

I promise. Next time i will try to calm and start with README - that is also why that file exist !

GIJOE  Posted on 2007/9/30 6:11 | Last modified
hi gigamaster.

Quote:

And as usual i start to put my self in troubles
changing "formmail4fleamarket" to "formvalidation"
I had to go through phpmyadmin to fix smarty bug..
If you copy the smarty plugin like "formmail" with different name, you have to change the code of the plugin.

function smarty_function_formmail( $params , &$smarty )
{
	$controller =& new PicoFormProcessBySmartyFormmail() ;
	$controller->parseParameters( $params ) ;

	// toEmails from 'adminmail'
	if( empty( $controller->toEmails ) ) {
		if( trim( $GLOBALS['xoopsConfig']['adminmail'] ) != '' ) {
			$controller->toEmails[] = $GLOBALS['xoopsConfig']['adminmail'] ;
		}
	}

	$controller->execute( $params , $smarty ) ;
}


class PicoFormProcessBySmartyFormmail extends PicoFormProcessBySmartyBase
{
	function __construct()
	{
		$this->mypluginname = 'formmail' ;
	}

	function executeLast()
	{
		$this->sendMail() ;
	}

}
gigamaster  Posted on 2007/9/29 7:41 | Last modified
After translation, i start to play with Pico,
as you all know now, my favorite module

And as usual i start to put my self in troubles
changing "formmail4fleamarket" to "formvalidation"
I had to go through phpmyadmin to fix smarty bug..

Finally I reset everything and start with a new form.
Please, check the following : example.
Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!