I’ll do my best not to go on a rant and just list what problems I’m having.
I’m trying to develop a Module for EE, I already have a lot of the app built in CI but since it’s not completely finished I’ve decided to give extending EE a try. I’m not happy with the process so far.
I need to: - add database tables (done) - build extension and act on specific hooks (done) - insert forms into template so users can interact with app (TOTALLY SCREWED) - CP backend (so-so, not too concerned yet)
All the regular CI stuff is no problem, creating my Models and doing validation/db/etc… no problem. But I’m totally stumped on the user interaction side. I do not want users to publish content to channels (I know how to set that up with safecracker), but instead, I want them to submit forms that my Module will capture, process and save the data to custom DB tables.
I have tried very hard to dig up some decent Module Development literature, but it’s all crap.
I need to figure out how to properly create the forms in the templates and get that form submitted to my module class methods!
I’m liking EE from every standpoint EXCEPT extendability. I know it’s possible to do some great things, but the learning curve is way too steep considering the total lack of learning material (do not mention the user guides, they suck, they’re way to basic in scope). Is tapping into CI the way to go?
Thanks for the help, Pete
There is a bit of a learning curve with EE development. I found some of the best ways to learn is looking at how others have made their add-ons. Also http://xdebug.org/ comes in useful to see what information is available to you in EE. This thread also has some good suggestions: http://ellislab.com/forums/viewthread/222274/
Here’s a super simple (and completely untested) example of how I’ve made forms in add-ons in the past, it just takes a forename and redirects if one is present.
class Addon {
function __construct()
{
$this->EE =& get_instance();
}
public function signup()
{
$forename=$this->EE->input->get_post('forename'); // get form values
$isValid = ($forename!=false); // validation goes here
if ($isValid) {
//do_signup(); // signup goes here
header("Location: signup-thank-you");
exit;
}
$tag = array(array('forename'=>$forename)); // if validation fails repopulate form
return $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $tag);
}
}Template code:
{exp:addon:signup}
<form method="post">
<input type="text" name="forename" value="{forename}" />
<input type="submit" name="submit" value="submit" />
</form>
{/exp:addon:signup}Hi Pete,
I can appreciate the frustration when first diving into EE development; I wouldn’t necessary say the docs are crap, but I do know there are some areas that I’d love to see in more detail (Fieldtype development for example). It might help if you mentioned particular pages/sections that you felt were exceptionally lacking, and I’m sure EL will do their best to improve…
Whenever I need to figure out how to develop an add-on, I begin by looking at other 3rd party add-ons that show similar behaviour. Stick to developers that are proven to produce high quality content (Experience Internet, Low, Pixel&Tonic; to name a few), and you’ll learn much faster.
As for your particular issue, you’re sort of blurring the lines between your job (add-on developer), and the designer/developer who is responsible for the site’s templates & front-end code. There isn’t much docs detailing how you insert forms into templates, because you really shouldn’t be doing that - what you should do however is create tags that the designers can use to build their own forms.
I’d take a look at Solspace’s Freeform module, since it does similar things to what you describe. (I haven’t seen how their new 4.x version works, and I know it’s a substantial rewrite, so perhaps dig up a 3.x version since the codebase will likely be a bit simpler).
Hope that helps, John
Thanks guys,
no doubt that part of the problem is that I’m doing this on my “off” time after work (so already a bit tired and nervous)… but generally I am not too fond of the user guide samples. They’re ok, but really have a lot of gaps.
I’ve started dissecting a couple of modules to get an idea of basic functioning and what not, it’s getting better! 😊
I’m still open to suggestions if anyone should happen to come across a good guide or book on the subject of module development for EE.
Cheers. Pete.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.