Jump to content

Comparison of PW and CodeIgniter


onjegolders
 Share

Recommended Posts

Also it would be cool to have something like automagical MVC support. For example, if template acts as a controller then when action is accessed in url (for example controller/action1) then it's automatically dispatches to the corresponding method action1() in controller. :)

You could easily make something like this with using urlsSegment on templates.

$action = $input->urlSegment1;

$method = "_$action";
if(function_exists($method)) echo $method();

function _addItem(){
return "Item added";
};

Then you can use something like /mypage/addItem/

  • Like 2
Link to comment
Share on other sites

What are the components that people find useful in these frameworks? I know email and forms were mentioned previously. E-mail is something PHP does quite easily and well just with it's mail() function (though I understand some like to use alternate sending systems). When it comes to form systems, I don't feel like I've ever come across one that didn't leave me feeling like I wished I'd just built the form from scratch... though I'm working on something in that regard. But beyond email or forms, what are the components that people use in these frameworks? The only other component I commonly include in my ProcessWire installations is the Snoopy() class, for doing http requests. Beyond that, I've rarely come across a need to have other PHP components in my applications. Still, if there are some really common needs, perhaps we should look at expanding PW's performance as a framework and including more helpers/components for common needs. I'm just not sure what the needs are yet. :)

Sorry Ryan just saw the latest posts on this thread. I personally believe for coders of my level (that is to say relatively inexperienced) that a couple of "helpers" would make the world of difference.

Email

Form validation

There are perhaps others but the reason for these two being that any website created needs a contact form and I personally find them the least enjoyable part of coding!

The code you helped me come up with for my contact form was reasonably complex and quite long. If PW could somehow find a way of replicating the way Codeigniter handles email and also form validation eg

$this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[12]|is_unique[users.username]');
$this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');

Then it would remove a huge part of the headache of creating standard websites.

As you say using mail() by itself is pretty straightforward but when you need to check to see if fields have been entered, if an email is really an email, display a message if there is an error, things can become pretty complex.

I really hope that this could be part of the PW future as by having this, it just removes one more reason why someone like me would have to look elsewhere!

Link to comment
Share on other sites

The only things I've needed I do use a Google library for YouTube (very specific) as well as Flourish for reading a mailbox's contents (again very specific).

Other than that a HTML email class like PHPMailer is always useful as it just offers much more than PHP's mail functions. Again, HTML emails sent using SMTP (there are some good reasons not to use mail() on some servers) are pretty uncommon needs so I think of my three this is the only one I'd use regularly in projects and even then not all the time.

Link to comment
Share on other sites

  • 2 weeks later...

What are the components that people find useful in these frameworks?

...

Beyond that, I've rarely come across a need to have other PHP components in my applications. Still, if there are some really common needs, perhaps we should look at expanding PW's performance as a framework and including more helpers/components for common needs. I'm just not sure what the needs are yet.

Some kind of clever truncateDescription method for strings would be nice to have in core. Most of that kind of needs are pretty well available on php, but cutting text is something that needs some logic to work well.

EDIT: This seems to be on core already, but maybe not in logical place: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupRSS.module#L169

Edited by apeisa
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...