Advice for a novice PHP enthusiast - php

I am totally new to PHP, I want to know whats the difference between PHP,CakePHP and Joomla.
Which IDE is most commonly used for developing PHP based web applications.
How Ajax is implemented in PHP, is it through JQuery only or there's something more to it.
Which will be the ideal book that covers most of the basic and advance concepts.

PHP is a programming language.
CakePHP is a framework written in PHP.
Frameworks establish a basis for quickly developing applications by providing you with a lot of functionality that you would have to write in plain PHP for most applications anyway. For example, secure database access, session management or pagination. These are all tedious things you have to care about, but that are basically the same for every app. It also establishes a certain structure for your project.
Joomla is a CMS, a content management system, written in PHP.
CMSes are pre-built systems you can use as-is, that allow you to manage your content. They're extensible and customizable, but often not to the degree that an app written in plain PHP or using a framework can afford, or not easily so. There's a lot of functionality in there already though that you don't need to write at all.
AJAX is not implemented in PHP at all.
AJAX just means that Javascript asks your server for data and the server delivers it.
A typical PHP page responds to requests with a complete HTML webpage. For AJAX requests your server instead responds with XML, JSON or plain text, whatever you decide. It works exactly the same way as responding with an HTML page.
Javascript is a programming language.
jQuery is a library written in Javascript.
See framework, the definition is almost the same.
For IDE recommendations, do a search.

PHP is a programming language
CakePHP is a framework
joomla is a CMS
AJAX - php is executed server-side and as such isn't something "implementing" ajax. The original call comes from client-side javascript that is not limited to JQuery. JQuery is a javascript library.

Ajax isn't implemented in PHP. Ajax is client-side technology. PHP is server-side. I started using Eclipse's PHP IDE, but I found the debugger to be more of a hassle than it was worth. I'm still using the IDE, but I'd probably be just as well off with a plain text editor.
You might want to check out Zend (www.zend.com). Most of their tools are commercial based, but they have some free tools that help you run PHP on your own machine.
I don't personally use a PHP framework, so someone else will have to help you with that one.

When I was first introduced to PHP, I was directed to these free instructional videos.
While they don't directly address your question, I'd be wrong to not perpetuate the kindness by sharing them with a new, novice enthusiast.
Good luck!

You are asking a lot of questions at once, which are fairly simple questions but the real answer is you need to learn a bit more about web development in general in order to give yourself a broad knowledge of the web development ecosystem. Stack Overflow is not good at giving you 'how do I program in PHP', it's better for specific questions like 'how do I sort an array by string size' or something like that. For learning how to program, you need to learn this yourself.
The wikipedia page on web development gives a very broad overview of how things like server-side, client-side etc fit together - so broad as to not be particularly useful for those wanting to achieve anything in particular, but suitable for people coming across web development from not knowing the difference between an application and a programming language. An equally broad knowledge of http is also helpful, and since you brought it up, it also looks like you are having difficulty understanding what ajax is.
For PHP specifically, the PHP manual contains everything you need for all but the most obscure questions, providing you have picked up a few programming skills already - and if not, I recommend you take a course or something, since if you haven't been programming since you were a child you probably won't take to this kind of thing quickly.

A little-known but powerful solution for AJAX in PHP is Xajax. It allows you to call PHP functions asynchronously as AJAX calls, making it by far the most familiar solution for people familiar with PHP but not Javascript.
Beware, however, that a huge portion of the users are based in Europe so the help forum can be VERY difficult to understand and official documentation is similarly spotty.
I personally always advise against using a book to learn--stick to quality websites (which ones become very obvious very quickly) By the time something is put into print, it's usually out of date or has been superseded by better technique. While the basics don't change much, there are many day-to-day things that experienced developers use regularly that you won't find in a book. I also advise learning the basics of development first (object oriented theory, logic progression, arrays, etc) before learning the specifics of any language. PHP.net can define specifics all day, but it's far more difficult and time consuming to learn MVC theory on the fly. Finally, if you have some money, I can't say enough good about Zend's certification training.

Related

Alternatives to php for in-line web programming?

I first learned web programming with php a while back. It has some features that I find very helpful, but the overall language is not something I enjoy, just as a matter of personal preference. I am wondering what alternatives I could use to provide similar functionality using a different underlying programming language (Python? Ruby?).
What I am looking for:
general purpose programming capability
in-line server-side code embedded in HTML (i.e. I want to be able to make my documents pure HTML if desired, rather than demanding special syntax even where I don't want dynamic content)
access to request parameters
ability to send headers, set cookies, etc
Preferably:
does not require a separate server process
easy to connect with Apache
Does anyone have any suggestions?
One thing I tried to do was embedded Ruby (erb) through CGI. This looked like a good fit on paper. Unfortunately, I was not able to get it to work, because I was following a few different guides and the result of combining them did not work out. At any rate, it seems this would not allow me to set arbitrary headers (and more importantly, use sessions and cookies).
Note: I'm not looking for a full web framework at the moment. Just relatively small amounts of dynamic content among otherwise HTML pages.
Thanks!
You've hit on the big reason why PHP is so popular - it has all of those pieces in a server-embeddable package. There aren't really many solutions with its ease of deployment; PHP is written specifically for what you want, which is both its strength and weakness. It's why it's such a weak general-purpose language, and why everyone and their dog knows it. It's everywhere, and the barrier to entry is near zero.
PHP is a language plus templating plus a web framework all baked into one package. To get an equivalent, you're going to need a web framework, even if it's a small one. Something like Sinatra is a super lightweight way to do similar in Ruby, though it requires a separate server process.
You could look at something like Perl with cgi.pm, but it may be a step in the wrong direction if you're wanting something cleaner than PHP.
I don't know Python packages well enough to offer suggestions there, but Twisted makes it easy to bind a Python program to a web interface. That does end up running in its own server process, though.
You'll need to do a little more work than your standard PHP deploy if you want to use something besides PHP, but that's often a choice that people consider to be a reasonable tradeoff for gains in productivity.
Python Flask is a good web framework: it fits your requirements, easy to learn, and scales gracefully. Go through the tutorial to see!
I have three suggestions.
The first is Ruby on Rails - It's pretty fun once you get into it.. I would recommend going through Rails for Zombies to get a general idea of whether you like it or not.
http://railsforzombies.org/
It's really easy to get something up and running on Heroku for free, so you don't have to spend any money to get something up on the web..
My second suggestion is one I'm just trying out called Node.js. I'd recommend watching this video to get an idea of what it's about:
http://www.youtube.com/watch?v=jo_B4LTHi3I
If you're into Javascript, I think you'll get it right away. You can also build an open source Node.js project on www.cloud9ide.com which is pretty nifty too.
A third one, if you're into learning Java, is "Play". A cool video on this is:
http://vimeo.com/7087610
I haven't used this much, but it's on my "to do" list of things to check out. Overall, I suggest just dipping your toes in the water for a bunch of different frameworks and get an idea of how they work and then you'll naturally pursue whatever makes the most sense to you. Good luck!
I'd say given your requirement
Just relatively small amounts of dynamic content among otherwise HTML pages.
then, PHP is going to be hard to beat for getting going quickly and a minimum of learning overhead. It avoids all the CGI issues that you would otherwise have to deal with, and is in fact its own templating language. That's why so many get started with it. Once you get past the point of your goal of mixing a little programming logic into HTML pages, and developing more flexible, maintainable and testable applications, then frameworks such as Rails, Django and others will be worth your time to learn.
Using Scheme as a web development language meets your criteria, with a caveat: instead of inline code embedded in HTML, you have inline code embedded in the Lisp-ish representation of HTML called s-expressions. (There is a one-to-one correspondence between HTML and is s-exp equivalent; they can be interconverted with one function call.) So the static parts of your page and the code share the same syntax - something I really like about Scheme.
> (sxml->xml `(div (p "It's been: " (i ,(current-time)) " seconds")))
<div>
<p>
It's been: <i>1339772791</i> seconds
</p>
</div>

NOT PHP vs JS Comparison: Can I do anything in PHP that can be done with JS?

I've now got some very good understanding of (X)HTML and CSS, and plan to move on. My next choices are PHP and JS (and don't know if I'll ever end up learning one of them, but I would love to).
So, I need to choose one of them. I have learnt that PHP is server-side programming and JavaScript is client-side programming, and I am NOT asking you to compare the two of them for me. What I would like to know is, can I do anything (or most of) in PHP that can be done with JS? (or put it this way, can do everything people use JS for, on the server-side with PHP?)
Instances include, using PHP instead of JS in web themes, real-time content display (as in live blogging, live comments etc), effects etc.
This might seem dumb, and there's definitely a reason why people use JS in all the above instances, but since I cannot (really) learn the two of them, thought I should ask for some advise here.
EDIT: Would it be possible to reload only a part of a web page (not the entire web page) every few seconds with PHP? That should be good enough for the real-time application that I am planning.
If you absolutely don't want to learn both, then learn Javascript. There are possibilities to implement a Javascript-based backend with node.js.
I advise you to at least try PHP since it is widely used - maybe even at your company.
For nice user experience (dynamic menu, ajax, effects, ... ) you need client-side programming and for dynamic content you (almost always) need server-side programming.
In short, you need both.
PHP and JavaScript cannot really be compared in the way you're asking...
Both are powerful in what they've ment for and they have a very similar syntax. If you can't absolutely study more than one of them, learn PHP in my opinion. I coded with PHP for almost 10 years before really getting into JS. I would say PHP is the food and JS is the spice.
In order to create AJAX web apps Javascript AND a server-side language is required.
No, you can't. PHP only works on the server side. Once you've delivered content to the client, PHP can't do anything until the page reloads or the user loads a new page. If you want to do anything client-side in between, you need JavaScript (this includes loading content in real-time, doing a lot of modern UI stuff, etc).
Either learn both PHP and JS or use a blogging CMS and use a minimal amount of both.
If you put enough effort into it, you can do almost anything server-side using lots and lots of page reloads. You can also generate arbitrarily complex dynamic content using Javascript.
But it's a lot easier to do minor changes to a page's content from Javascript, it's only possible to do animations and effects from Javascript. It's also much easier to directly access the database from server-side code – there might be pure-javascript drivers for SQL databases, and you could use a NoSQL databases that's accessed using web services, but both are relatively uncommon techniques.
I have a thought regarding your original question/situation. I know this is about four years tardy, but I thought I should throw in my two cents for people who are looking back on this conversation as a reference from Google like I am. In your situation, because you are a blogger who is trying to save time when it comes to programming, I would recommend looking into WordPress (the .org version, not the .com). It is a sort of marriage of WYSIWYG blogging/website creation and programming. It takes care a lot of the back end stuff (including Javascript, PHP, and more), but also leaves it open for you to edit if you so desire. You probably could get away with using Wordpress as a total non-coder, but with HTML and CSS, you're already off to a great start. WordPress is super simple to learn and amazingly powerful. If you do take this route, I would suggest learning PHP as an asset because that is the language that WordPress runs off of. If you know PHP and are using WordPress, you have vast potential, not to mention that speedy blogging is a snap. If you don't feel the need to have whipped everything up from scratch and want to work faster, give WP & PHP a try. They'll take you a long ways.

Best high level Web framework, PHP preferred

I'm starting to architect a quite complex web application. The implementation is probably going to be done in PHP, though if there are impressive reasons to choose a different environment I might be convinced.
I've looked at tools like Symfony and CakePHP. The problem is that it feels like they're relatively low level for a modern Web 2.0 application. They handle the basic things like MVC and scaffolding, but not the more advanced UI elements that I'm looking for. Here are some of my requirements:
Single page architecture. With minor exceptions, there should be no page refresh. All actions are done via ajax, the way it's done in gmail, and to a lesser extent in Facebook.
Ajax layout and widget handling. Not only the application doesn't refresh the page, but the developer can specify the layout and load various widgets into different parts of the page. This is somewhat like iGoogle, but should be better integrated.
Support both on the client side and server side for AJAX widgets. It should be trivial to display the result of a select statement in an AJAX table/array like http://developer.yahoo.com/yui/datatable/. This should also apply to other widgets including
Trees
Menus
Forms
Speaking of forms, there should be easy integration with client side validation
Signup/Authentication/Authorization. Including all the housekeeping things like forgot my password, CAPTCHAs, etc.
There's more, but I think I've given enough details so that you get an idea for what I'm looking for. Basically, I'd like to engineer a modern Web 2.0 app and skip writing, testing, debugging things that most web applications need to do. And yes, I know I can take YUI or jQuery and slap it on top of one of the regular platforms, but then I'd have to write all the glue. Now if there are modules that do this, that would be interesting.
So if you say, take Symfony + modules xyz + jQuery and there's your answer, I'd be happy to hear that.
Finally, in terms of priority, I'm looking for something that's scalable, reliable, well engineered more than something that's easy to learn and deploy.
Since you are looking for all things AJAX, why not try GWT? Its not PHP I agree, but it makes writing AJAX applications easy for developers.
I agree with #Iznogood. What your looking for is not actually a framework but a talent.You can make any framework as "igoogle-ish" as possible if you know what your doing.
I suggest look for a framework with a huge and active community like, CI, Cake and Jquery. Search/ask the community for the specific things you need. Plug it in and Presto!
But I'm afraid you'll have to write some of it.
If you don't mind using Java, there is ZK:
http://www.zkoss.org/
I'd prefer using this over GWT.
In php, you might want to consider Cjax http://cjax.sourceforge.net/.
It is MVC oriented, and has a very generic API, with full support for customization, including the development of plugins (There is a full Plugin API available, including documentation, Plugins can be built in PHP and JavaScript in combination -- see uploadify and validate plugins).
It can access all JavaScript functions, Objects and proprieties, and elements properties and functions from PHP server side, with one line of code.
In Cjax,
you can execute ajax actions, inside controllers (ajax requests) - without a line of JavaScript. this allows you to fully function without refreshing the page. It also allows you to access all Js objects from PHP. A good sample that reflects this is the "recursive ajax request" see that demo. The API can be used on page load, when the page first loads, and within every single ajax request.
Do take a look at the documentation and to the 20+ demos included, and no where you will see a single line of JavaScript. It allows you to manipulate elements, containers, request ajax, submit ajax forms, creates overlays, upload files through ajax, all from the server side. Take a glace at the API Table.
It has support for both, server side ajax, and client side, (see plugins JavaScript Documentation)
It plays nice with jQuery - the validation plugin in jquery is full executable in PHP without a line of JavaScript (see http://cjax.sourceforge.net/examples/plugin_validate.php without any custom line of Jquery inside the framework, it's all plugin's work). Ajax Responses from Jquery also get processed by this framework automatically, so using Jquery's Ajax function API wise, is the same as if you were using the Framework's Plugin's JavaScript Ajax Functions.
And you would just have to take your time learning more about it, because it has quite a few more tools that I am sure you'd find useful.
Currently there are two official releases, the generic release and
there is an official release for CodeIgnater of this framework (and it is the leading ajax option for codeignater) , and works great in conjunction other PHP Frameworks and without them.
Signup/Authentication/Authorization. Including all the housekeeping
things like forgot my password, CAPTCHAs, etc.
This is something that you can build within an ajax controller, the framework itself its meant to be a generic "AJAX" framework, so if you are looking for none ajax features, you will need to build them or integrate other PHP Framework with Cjax (such as Codeignater).
I do not know if this matches all of your criteria, or if you ever will find one. However, I like the Zend Framework myself.
As for the UI and AJAX portions - the server side technology matters little, and it's more about browser-side technology and interaction mechanisms, as well as DOM manipulation.
jQuery is my favorite for that. As for the PHP back-end, I tend to develop it with my own codebase that's grown with me over the years.
But all this takes a lot of practice, knowledge, education, research, reading, and posting questions on StackOverflow.com ;)
I would recommend symfony PHP framework since it has very good support for every feature you mentioned, and it can be easily integrated with Zend Framework - as of version 2.0 coming this year it would be integrated in the package. You can easily set symfony to handle AJAX requests so that it would be perfect transparent layer handling server side.
For me, if you look at THAT heavy AJAX, I would recommend searching for some good JavaScript framework - such as Ext.JS - that would handle all client side functionalities.
For the front-end part of your app, you might want to have a look at SproutCore ( http://www.sproutcore.com/ ).
Building a Web application with SproutCore feels more like configuring components than writing code.
There is no glue code.
On the backend all you have to do is accept and emit JSON.
Depends what sort of level you're looking at. If by 'framework' you mean something like Zend or Symphony, then to be honest all the big ones are about as good as each other. They all have strong points and weak points, but none will really meet your criteria.
But your question implies you're looking for something more than that kind of framework. Maybe you're looking for a full-blown CMS platform like Drupal, Joomla or Wordpress?
In that case, again, you need to consider your needs verses the capabilities and pitfalls of each system.
Drupal, for example, has masses of modules, is very powerful, and easy to write your own modules, but isn't object-oriented and doesn't really do MVC, so if that's your bag then you may find it hard to get on with. Wordpress is much easier to get going quickly but is less flexible once you start getting deeper into it.
But again, they all have strengths and weaknesses. If one was clearly the best, it would be an easy choice. But at the end of day perhaps it's better to have several good quality options to choose from.
Have a look at Ext JS, it is pretty good. If it is a commercial project you are doing it isn't free but not too expensive either. It also has a GWT version if you prefer that.
This is only for the front end but it is not too complicated to use any backend that can emit json.
CakePHP is pretty good

What to do after learning basic PHP? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have learned extremely basic PHP (I think so) using Lynda Tutorial. After that, I feel, I got some grip on that language. My ambition is to become a web developer! After some googling, I planned to learn some more advanced and practical php by using websites like PHPSCripts, Webapps etc..
But, now I'm in a confusion! After my studies, when I seek for a web developer position & got selected, how will I work, by just knowing some language basics?
Can you guys help me to become a good web developer, what will I have to learn & how to learn?
Also, can I get the steps to do a practical PHP project.
As a web developer it is important to have client and server side skills. But there are few web developers which are excellent at both... But knowing the basics and where to look for info is definitely a good starting point.
I would recommend to work through the following list(s) in the order presented. If you feel comfortable with a topic, move one. Even though that in reality you will often have to go back and forth during the learning process...
Client Side
HTML / XHTML
CSS
a JavaScript Library (e.g. jQuery, prototype/scriptaculos, etc.)
Server Side - Infrastructure
familiarize yourself with shell scripting if working on Linux (e.g. bash, etc.)
Webserver (e.g. Apache)
PHP Server
Databases (e.g. MySQL, PosgreSQL, etc.)
Server Side - Programming
PHP
SQL
Advanced Topics
After getting familiar with the basics...
AJAX (this is placed here because it is a client/server topic, not because it is advanced...)
Object Oriented Programming (OOP)
Security issues
Source Control Management (SCM) -> (e.g. git, etc.)
Model View Controller (MVC) software architecture
PHP Frameworks (Zend Framework, Symphony, CakePHP, Agavi)
Unit Testing (e.g. PHPUnit)
Object Relational Mapper (ORM) for PHP (doctrine, Propel)
Usually this keeps you busy for a while. At least it kept and still keeps me busy... ;)
Here are few suggestions:
Read these advanced/practical php articles on phpro.org
Learn the basics of OOP
Familiarize yourself with php frameworks and CMS
Familiarize yourself with HTML/CSS/Javascript
Try to make clones of other websites
Try to volunteer in open source projects, you may get started at:
openhatch
sourceforge
Im my opinion, A good webdeveloper MUST know:
HTML
CSS
JavaScript
After this, it's important to know:
Jquery
XHTML
Crossbrowsing (diferences of IE X Firefox x Chrome, etc)
Rationale:
HTML: it's the base of web.
CSS: in 2010, it's the base of web.
JavaScript: only the basic, to understand jquery after.
Jquery: you can solve a lot of problems quickly and it's large used.
XHTML: because your page may broke in modern browsers, if has a <br>, not a <br/>
Crossbrowsing: there is more than one browser in the world.
Just keep on practising. You will likely need solid HTML / CSS skills as well as PHP since the two go hand-in-hand - it's also useful to learn MySQL. Spend lots of time going through the tutorials on the excellent tizag.com as well as Lynda.
Once you're comfortable with all that and you're ready to move onto something more advanced, it's worth looking into Wordpress customisations and plugin development - that has the advantage of being pretty easy to use, with an awesome support community, and a whole bunch of mature code that you can look through yourself to get more familiar with how the language is used in the real world.
After that, try a framework like CodeIgniter or CakePHP - these are awesome for your productivity but do make sure you're comfortable with the basics first as the learning curve can be pretty steep and you want to reduce frustration as much as you can. :-) Learning design patterns will also be helpful at this stage.
One thing that will always be important to you, your users, your applications, and your potential employers is code security. I can't stress this enough. As soon as you put an application into real-world use, you have a moral and professional obligation to make that application secure. http://www.addedbytes.com/writing-secure-php/ <- read, digest, read other guides. Security is the single most important thing that a PHP developer can learn.
Above all, have fun! The best developers tend to be the ones that get genuine enjoyment out of what they're doing. You might find yourself eventually leaning in a different direction and using completely different technologies, so always keep your eyes open and be prepared to learn new things even if they don't necessarily 'fit' your current skillset. Also the more general knowledge you have about programming patterns, the better you will become in individual languages. Remember that it's an organic process so you will need to let it develop naturally - but help it along by exposing yourself to as much as possible (foreign language teachers call this 'immersion' :-) )
Regarding PHP
Make a small project using PHP, so you know that you know.
Learn a (MVC) framework like CakePHP or Agavi.
Read this SO answer.
Regarding Web Development in General
Know about CSS, XML, XHTML, XSLT, W3C validation, HTML5, JavaScript, AJAX (and most other acronyms you come across).
You will find there are various libraries which make your life easy, use them. And there will be one browser that will make your life difficult, but you will have do deal with it.
A solid web developer needs an understanding of HTML, CSS, JavaScript, and the server-side scripting language of her choice. But still more important is a solid foundation in programming. You don't have to be an expert computer scientist, but you need to understand how to structure a program and how to solve problems in a sensible way.
Most professional web development involves database access of some sort. Teach yourself SQL, and use a real SQL -- not Access -- for the effort. You can run MySQL or Postgres on a laptop these days, and it's free.
Learn to design databases well. Learn about normal forms, and indexes, and so forth. The time you spend on that will pay off in spades.
Take a while to study up on security. Look at the security bugs that have afflicted high-profile projects and sites. (Hint: they're pretty much mostly about trusting untrustworthy data, or else relying on old out-of-date infrastructure, but the consequences include site defacement and the compromise of valuable information.)
And then, take on a charity project somewhere. You won't get turned down, and you'll cut your teeth, so to speak. Just make sure you're not storing social security numbers or something crazy like that, because charity workers are often vulnerable to social engineering attacks.
the very very first thig to do is to learn Object Orientated Programming (if you haven't).. then you might want to start learning the MVC pattern... and then you must decide either you star using frameworks (like cakePHP, Symphony,Zend) or you prefer using CMS (like joomla or wordpress)... on the process you might also want to learn javascript using a framework (mootools, jquery or prototype)...
Edited: i forgot about databases and sql!! wow.. there's a lot to learn!
The only way to become a good programmer on a certain platform, is to study something more than just tutorials. Read a book, at least. Then the rest comes with practice.
A good way is to also learn a specific platform (depending on what they work with). Some work with Wordpress, so once you know basic PHP and how to use it with databases, and how to work with databases, you would be able to quickly make some basic information websites. Others use Joomla, Drupal, DLE, to quickly build websites, without having to hurt their heads with full backend and frontend architecture. If you need a more general approach, to be able to make more specific web applications, use frameworks like Zend, CakePHP, Symfony, CodeIgniter.
Also, besides knowledge of PHP, to build a small website by yourself, you will also need to know HTML, JavaScript (with AJAX, possibly a framework like jQuery), SQL.
And last but not least, you will need to learn how to protect the site against XSS, SQL Injection and other security threats.
Learn Object Orientated Programming (OOP for short).
Watching any programming tutorial is different than watching any movie. You need to have practice and have experiments form different angle of codes. Prentice and research is only way to get into the deep of any language. If you think you have well understanding about php then try to make some small application like phonebook which have database connection. After that you can move for any frame work like laravel, cakephp. But I always recommend to do at least one small project with raw php before move for any framework because when you come from raw php you will start loving working with frameworks otherwise you will may feel boring to learn again something new as my point of view.

How to transition from PHP to Python Django?

Here's my background:
Decent experience with PHP/MySql.
Beginner's experience with OOP
Why I want to learn Python Django?
I gave in, based on many searches on SO and reading over some of the answers, Python is a great, clean, and structured language to learn. And with the framework Django, it's easier to write codes that are shorter than with PHP
Questions
Can i do everything in Django as in PHP?
Is Django a "big" hit in web development as PHP? I know Python is a
great general-purpose language but I'm
focused on web development and would
like to know how Django ranks in terms
of web development.
With PHP, PHP and Mysql are VERY closely related, is there a close relation between Django and Mysql?
In PHP, you can easily switch between HTML, CSS, PHP all in one script. Does Python offer this type of ease between other languages? Or how do I incorporate HTML, CSS, javascript along with Python?
Can i do everything in Django as in PHP?
Always
Is Django a "big" hit in web development as PHP?
Only time will tell.
With PHP, PHP and Mysql are VERY closely related, is there a close relation between Django and Mysql?
Django supports several RDBMS interfaces. MySQL is popular, so is SQLite and Postgres.
In PHP, you can easily switch between HTML, CSS, PHP all in one script.
That doesn't really apply at all to Django.
Or how do I incorporate HTML, CSS, javascript along with Python?
Actually do the Django tutorial. You'll see how the presentation (via HTML created by templates) and the processing (via Python view functions) fit together. It's not like PHP.
Yes.
It's very hard to tell exactly how popular it is.
MySQL is officially supported.
Yes, but probably not in the way you think. Please read this and also follow the tutorial that S.Lott mentions.
No. You can only do a LOT better.
Awesome, popular. Supported by best hosters like Mediatemple.
No. You can just change 'mysql' to 'postgresql' or 'sqlite' in your settings.py.
NO! Python would never give you the right to mix up everything in one file and make the shittest shit in the world. Templates, static server.
Django is a Model-Template-View framework, great for any applications, from small to huge. PHP works fine only with small apps. Yeah, PHP == Personal Home Page, lol.
P.S. Also you can minify your CSS and JS. And compile to one single file (one js, one css). All with django-assets. And yeah, there's a lot more reusable Django apps (for registration, twi/facebook/openid auth, oembed, other stuff). Just search Bitbucket and Github for "django". No need to reinvent a bicycle, like you do with PHP.
In PHP, you can easily switch between
HTML, CSS, PHP all in one script. Does
Python offer this type of ease between
other languages? Or how do I
incorporate HTML, CSS, javascript
along with Python?
That's one of the reasons why PHP is so easy to learn. And it's also exactly why so many (if not most) PHP projects are such a complete mess. It's what leads to the "spaghetti code" syndrome.
Django is all about complete separation of page design from view logic from URL routing (in fact this is true of most modern MVC or MTV frameworks). So templates are in one place, data structure definitions are in another, and the logic that defines their interaction is in another. It takes a bit of getting used to, but has a huge payoff.
Another thing that takes getting used to for people coming from PHP is that fact that file and foldernames no longer have a direct bearing on the URL. For example in PHP, you might have foldername/filename.php and the URL would be http://example.com/foldername/filename.php. It doesn't work like that in Django. Instead, you define a URL structure in a file (urls.py). In that "map" you define which piece of logic ("view code") will be called when a matching URL is intercepted. Everything is abstracted like that. The result is a much cleaner, more logical site layout and logic.

Categories