How to run a external program in PHP?

How to bend PHP to my ASP.NET desires

  • What frameworks or modules exist to allow PHP to function similar to ASP.NET? Specifically I am talking about the following ...Separating code from designMaintaining page and HTML element state between postbacks As a web developer, I program in ASP.NET/ MS SQL Server for work and have done so for many years. I am learning PHP and MySQL in order make myself more marketable and because it is cheaper to develop and host PHP and MySQL web applications. I love the XAMPP/WAMP stacks and how portable they are. I can run it right from a USB stick. Can't do that with IIS, SQL Server and the .NET runtime. I know PHP is very powerful as I can see how well the WordPress and Drupal frameworks work (just to name a few). There are many development paradigms that ASP.NET makes use of that I would be surprised to find did not exisit within PHP modules or frameworks. Separating code from design - Allowing for code to be kept separately and away from UI elements. ASP.NET does this via "code behind". Maintaining page state between postbacks - Sure you can code this manually in PHP but there must be another way to maintain page state than coding it all by hand. I don't mean for this to be a ASP.NET vs PHP rant. Quite the opposite I can see that PHP is a very serious development tool. Rather I am just looking for advice on how PHP has addressed some of the same issues ASP.NET has.

  • Answer:

    I think you're going to have a hard time with your first requirement- it's one of the key benefits of .NET and JSP, and PHP just isn't built to work that way. That said, an MVC framework for PHP might get you at fair way down that road. Have you tried some of the more popular frameworks like http://cakephp.org/?

mountainfrog at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

Seconding CakePHP: It will get you most of the way there. Cake does pretty well at emulating Rails. But why just PHP and MySql? Learning Python or Ruby (along with Django or Rails) might suit you as well. IMHO those languages/frameworks are a lot better suited to MVC frameworks and good stuff like seperation of business logic/presentation.

gunslingingbird

There's also the http://www.symfony-project.org/ which is modeled fairly closely to Rails. Just avoid Zend. It's been awhile since I've had to (shudder) use it, but I don't have anything good to say about it.

jacquilinala

http://www.smarty.net/ pretty much nails your first requirement.

xmutex

Seconding http://smarty.net/. You will hate it. You will hate the templating syntax and its odd idiosyncrasies. And then, suddenly, you will love it. Cake and other MVC engines will help you abstract/architect code. But nothing's better than Smarty for separating your PHP code from your design.

lexfri

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.