Practical Web 2.0 Applications with PHP 153
Michael J. Ross writes "Web 2.0 applications and sites commonly employ a number of technologies: PHP, MySQL, XHTML, CSS, JavaScript/Ajax, microformats (standard formats for HTML data), tags (keywords for categorizing site content), and Web feeds (formatted and streamed Web content, usually in XML, such as an RSS feed). Because learning and using most of these technologies can be rather challenging to a Web developer, perhaps the best way to get started doing so is by using all of them to create a single Web-based application, with no pretense at mastering any one of them. This is the approach taken in Quentin Zervaas's book, Practical Web 2.0 Applications with PHP." Read on for the rest of Michael's review.
The book was published by Apress, on 20 December 2007, under the ISBNs 1590599063 and 978-1590599068. On the book's Web page, visitors can read and submit errata (apparently none, as of this writing), read the online table of contents, download Chapter 11 ("A Dynamic Image Gallery") as a PDF file, and purchase an electronic version of the book.
Practical Web 2.0 Applications with PHP | |
author | Quentin Zervaas |
pages | 569 |
publisher | Apress |
rating | 7/10 |
reviewer | Michael J. Ross |
ISBN | 1590599063 |
summary | An example-based guide to PHP and Web 2.0 technologies. |
Given the number and complexity of the technologies discussed in the book, it is little wonder that it is 569 pages long. There is certainly a generous amount of material, and it is grouped into 14 chapters: planning and designing the sample application; application framework setup; user authentication, authorization, and management; user registration, login, and logout; Prototype and Scriptaculous; page styling using CSS; creating a blogging system; extending the blog manager; personalized user areas; Web 2.0 features (tags, Web feeds, microformats, and public profiles); the image gallery; site search functionality; integrating Google Maps; deploying and maintaining the site.
The first two chapters set the stage for the rest of the book. Chapter 1 provides a brief overview of Web 2.0, the sample Web-based application to be developed in the book, database connectivity, search engine optimization, PHPDoc, templating, and security, as well as the major features of the sample application, namely, a blog site. Chapter 2 describes how the reader can set up the application framework needed to follow along as the author explains how to build the sample application. This includes brief descriptions of how to install Apache, MySQL, PHP, and the Zend Framework. In fact, the book makes so much use of the Zend Framework that, after reading it from cover to cover, the reader will have gained a strong understanding of how some of the most popular components of that framework can be employed in their own projects. The chapter describes the file system structure the author has chosen, how to configure your Web server, how to set up the database, and how to connect to that database. It also provides an introduction to the Model-View-Controller (MVC) design pattern, as well as the Smarty template engine — both of which are used later.
While the introductory material in the first two chapters is essential — particularly to any inexperienced programmer — and generally spot on, some of the material could use a significant amount of expansion and clarification. For instance, in Chapter 2, the instructions on how to configure one's Web server, could easily prove confusing to most readers, because the author refers to the IP address 192.168.0.80, with no explanation as to what it is and how it relates to the usual local Web server address, 127.0.0.1 (localhost). His recommendation for a "hosts" file entry, "192.168.0.80 phpweb20," certainly does not help clarify matters. Furthermore, the author does not explain why "phpweb20" should be used instead of "localhost." In the subsequent discussion on virtual hosting and Linux, in a "Note," he mentions that the reader "must have previously included the NameVirtualHost 192.168.0.80 in your main Web server configuration..." In another note on the same page, he provides instructions on the PHP setup that should have been included earlier, in the section on installing PHP. In general, there are too many instances in the early chapters where key information is presented not where the reader would need it, but pages later. This can be especially exasperating to readers who are fairly new to the technologies, and are trying their best to follow the author's examples, every step of the way.
Chapter 3 discusses user authentication, authorization, and management. Unlike most PHP books, this one does not limit the reader to using MySQL as the relational database management system in conjunction with the sample application. The downloadable code for the book makes it possible for the reader to use PostgreSQL, even though the text itself focuses on MySQL. This flexibility is made possible by the author's use of the Zend_Db class. Admittedly of little significance, some of the book's SQL code looks a bit puzzling in some places. For instance, on pages 46-47, unneeded blank lines are contained within the "create table users" statement, with no reason given. Of greater importance, the chapter includes a short but valuable section describing the potential problems of date and datetime values in MySQL caused by server time zones, daylight savings, etc. — a topic well worth reading up on. The fourth chapter explores user registration, login, and logout functionality. Crucial topics such as password reset are covered, while some others, such as password strength, are not — no doubt due to space limitations.
Ajax is considered a central part of the new Web 2.0 trend, and for doing Ajax, the author recommends Scriptaculous, which is based on Prototype — both introduced in Chapter 5. The basic CSS styling of the sample application's Web pages, is covered in Chapter 6. The only flaw in the sample CSS code is that the author formats the declarations within each rule inconsistently, with some rules having multiple declarations on a single line, and others having each declaration on a separate line, which most people find easier to read and maintain. A highlight of the chapter is the author's comparison of the advantages and disadvantages to using a print-only CSS stylesheet versus a dedicated secondary print page — a topic not even seen in Web programming books that focus on design and CSS. The chapter concludes with a discussion of client-side form validation using JSON.
Chapters 7 through 13 focus much more on the sample application's functionality: implementing the user blogging system, and supplementing it with a blog manager index, Ajax capabilities, and a WYSIWYG editor (FCKeditor); creating user areas that can be customized by the users themselves; implementing the aforesaid Web 2.0 features (tags, Web feeds, microformats, and public profiles); implementing a dynamic image gallery, using GD for resizing, etc.; adding site search capabilities using Zend_Search_Lucene; incorporating Google Maps into the users' public blogs. All of these chapters are chock full of sample code, which the energetic reader may want to test out in their own development environments — particularly if they want to follow the author in creating the sample application. Fortunately, the reader will not have to waste any of that energy typing in code, because it can all be downloaded from the author's book site.
Specifically, Chapters 7 and 8 are devoted to the blogging capabilities of the sample application. While the discussion of permanent links, filtering, and the FCKeditor WYSIWYG editor may be of interest to a reader not implementing blogging themselves, the book at this point becomes more narrow in the information that it conveys — focusing even more on the code of the sample application. After reading through dozens of pages listing the code for blog entry management, readers may begin asking themselves, "Why not just use a CMS, instead of reinventing the wheel?" It should be borne in mind that the point of the book is not to advocate reinventing the wheel, but rather to show how a sturdy and reliable wheel can be built. Nonetheless, readers will need fortitude to plow through the many pages of code.
Despite the obvious expertise of the author, readers should be alert and open-minded to potential pitfalls. In the sample application's code, for generating passwords, the author uses only a hash function, md5(), despite its vulnerability to rainbow tables. The reader is advised to use an encryption function instead of — or in conjunction with — any hash function. The book contains another example of inattention to data security: In Chapter 4, as part of the user registration process, the user's password is e-mailed to the new registrant, naturally in plaintext, making it visible to anyone who intercepts the e-mail message. Years ago, all sorts of online organizations were following this lamentable practice; fortunately, "nasty grams" from security-savvy users seem to be turning the tide.
After exploring the possibilities of dynamic image galleries and Google Maps, the last chapter may appear relatively uninteresting to the reader, because it discusses application logging, error handling., and Web site deployment and maintenance, including backups. These topics may not seem too exciting, but failing to take the lessons to heart, and then experiencing a heart-stopping crisis on one's production site, will be the kind of excitement no Web programmer wants to experience.
What distinguishes this book from the majority of other PHP titles — for better or for worse — is that the author makes extensive use of specific frameworks and other tools, such as the Smarty templating engine and the Zend Framework, as well as classes that he has written, which are freely available in the source code. As a result, the value of the book to the reader is, to a certain extent, proportional to how much that reader wants to learn and possibly use those components. For example, if the reader chooses, for whatever reason, to not use the MVC design pattern and the Zend_Controller class for implementing MVC in their application, then the author's use of these will appreciably reduce the value of the book to that particular reader. In fact, given how lengthy Chapter 2 is, such a reader may mistakenly conclude that the rest of the book would be of no greater interest to them, and consequently become discouraged and quit reading. Other examples include the homebrew DatabaseObject and Profile classes, discussed in Chapter 3. Regardless, some readers may find that even if they do not use the author's chosen tools for their own applications, there is enough other programming and application-focused information that makes the book worthwhile to them. Other readers will be disappointed in the overall value of the book should they choose not to follow the author's recommended approaches. In addition, some programmers may be quite hesitant to base one of their own applications — particularly for paying clients — on classes created by a single developer, with no accompanying unit testing code to verify its soundness.
In terms of the production of the book, it is definitely up to par, with a font that is readable and yet small enough to get plenty of information on each page — in conjunction with the bottom margins being utilized better than in other books. However, at least for my particular copy of the book, several blocks of pages were cut with different widths, making it appear as if one or two blocks had become detached from the glue binding, when in fact they were all well attached. Within the binding glue, they were all attached at an equal depth, indicating that it was the cutting of the pages that caused the problem, and not how the blocks were set in the binding.
Even though some readers may find the book overly focused on particular frameworks and other tools, Practical Web 2.0 Applications with PHP is an instructive and expert demonstration of how to use PHP, MySQL, the Zend Framework, Smarty, Ajax, and other powerful technologies for creating robust Web sites.
Michael J. Ross is a Web developer, writer, and freelance editor.
You can purchase Practical PHP Web 2.0 Applications from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Wait... (Score:2, Insightful)
Re:Wait... (Score:4, Insightful)
Re:Wait... (Score:5, Informative)
Eclipse PDT (and Zend's PDT based 'Neon' product)
NuSphere PHPed
Zend Studio
Sure it takes a while to get the hang of the nuances in function naming and parameter ordering, and even now I still need to lookup some functions in the manual, but for most purposes the auto completion in Eclipse PDT works well - it fully supports auto-completion for user & system code along with classes and javadoc/phpdoc style documentation comments.
Re: (Score:2)
Re: (Score:3, Informative)
Re: (Score:2)
Re: (Score:2)
I've found that it doesn't get in my way and most of the time I it speeds up the manual labor part of writing code, it lets me express my ideas quic
Re: (Score:3, Funny)
Re: (Score:2)
You misspelt 'nuisances'.
Re:Wait... (Score:4, Informative)
Re:Wait... (Score:5, Insightful)
Add to that, the massive headache that new
Add to that the massive library of FREE addons, libraries, scripts and opensource projects that you can learn from or incorporate... and I'd say the massive number of PHP newbies out there indicates how EASY it is to use. Did I mention free? And open - as in not tied to the whims of one corporation.
I'll refrain from listing good IDEs since I see another responder has done so.
Re:Wait... (Score:5, Informative)
Re: (Score:2)
You don't have to navigate MSDN. You put your cursor on the desired function, and press F1. Alternately you can search for the function/class name, and it usually shows the correct item in the first 3 or 4 results.
Replace F1 with F2 and Eclipse with PDT does the same thing. phpDoc is used very similarly to Microsoft's way of being able to comment code.
Also the GP who promoted Java; it's now very easy to use Java functions from within PHP, so if you require Java it's no problem to use it from directly within a PHP app. Also PHP6 will bring namespaces, so I think all of the gripes about PHP I've seen so far in this topic are outdated.
Re: (Score:2)
Re: (Score:2)
... in soviet russia (Score:2, Insightful)
Re: (Score:2)
-Install VS2008 Express (comes with sqlexpress, no setup necessary for it seperately)
-Start programming, with intellisense help (web apps, console apps, windows apps, etc)
That's quite hard! No web server to install. No "15 different libraries all to talk to the same database". No "now install 15 different libraries, all of which take parameters in different orders and have differing semantics". Etc.
Re: (Score:2)
Re:Wait... (Score:5, Funny)
Have you ever coded in Perl? I remember the first time I saw Perl:
Me: Hey Bill, you know when I asked to send over some perl scripts for me to learn perl, I think it got messed up. Part of it looks encrypted or encoded or something.
Bill: It's not encrypted or encoded. That's how perl usually looks.
*My head explodes*
Re:Wait... (Score:4, Funny)
As the saying goes, "Java is executable bytecode, Perl is executable linenoise."
Re: (Score:2)
Re:Wait... (Score:4, Informative)
Go here to get the Yoxos Eclipse distro (I like this one because it does the best job of finding your dependencies for you).
http://ondemand.yoxos.com/geteclipse/start [yoxos.com]
In plugin explorer, search for and schedule PDT, SQL Explorer, and either Subclipse or whatever is compatible with your versioning software.
Click Start Download, and then unzip and copy the eclipse directory to somewhere suitable.
Meanwhile, go here:
http://www.aptana.com/studio/download [aptana.com]
And click on the Eclipse Plugin tab and download the plugin.
Then open Eclipse, go to the workbench, and in the menu, do Help > Software Updates > Find and Install, then choose to Search for New Features to Install, then choose install from archive and point it at the plugin you just downloaded. It will tell you it needs to restart afterward.
Now you have a functional IDE, and you can use Window > Show View > Other to choose whatever panels you want to have open in your workspace. I mix and match Aptana and PDT.
Last but not least, you need the Zend Debugger. Do Help > Software Updates > Find and Install, then do Help > Software Updates > Find and Install, then choose to Search for New Features to Install, then choose New Remote Site. For Name, put Zend Debugger, and for URL, put http://downloads.zend.com/pdt [zend.com]. Make sure that site is checked in the list, then click Finish and it will search for your debugger. Find it, install it, then do go here:
http://www.thierryb.net/pdtwiki/index.php?title=Using_PDT_:_Installation_:_Installing_the_Zend_Debugger#Installing_Zend_Debugger_client [thierryb.net]
And follow whatever directions are consistent with the platform you're using.
Re: (Score:2)
Re: (Score:2)
Design is done with CSS :)
Yeah, I meant markup.
That's hardly specific to PHP though, I find Java worse than PHP for that. "why is this code using HashMap instead of Vector" etc... Idiocy transcends language boundaries.
Perhaps, but features of a language can increase or decrease the difficulty of reading and comprehension.
Keyword "generally". I've got several small apps that exist as single PHP files. Forcing separation (or even OOP) here is not a good thing, it's pointless and stupid.
Well, PHP was originally a templating language :) In fact, the common problems I have with it are when there's more PHP than HTML. When used as a templating language, it's just fine, and it makes sense for it to all be in one file. Other times, I'm not so sure, but I'd be hesitant to say that there's NEVER a time when one file doesn't make sense--it just usually doesn't. PHP's
Re: (Score:2)
That's hardly specific to PHP though, I find Java worse than PHP for that. "why is this code using HashMap instead of Vector" etc... Idiocy transcends language boundaries.
Java is worse than PHP? Because of *that*!? For one, I think you meant to say, "Why is this code using Hashtable instead of HashMap," or perhaps say, "Why is this code using Vector instead of ArrayList?" For anything since Java 1.2 (many years ago), you should only be using Vector or Hashtable for legacy code that must work with very old VMs or if you need to access the data structure from multiple threads. Pretty straightforward to me as any Java programmer worth their salt knows this.
The fact that just a
Re: (Score:2)
I've said it before and I'll say it again (Score:4, Funny)
and all other web languages, ROR, perl, etc.. (Score:5, Funny)
Re: (Score:1, Troll)
Regards,
Re: (Score:3, Interesting)
Re: (Score:2)
I would say that it is good for building web *sites* but not so much web *apps*. PHP is fine if all you need is a little dynamic content here and there, but for applications it falls short, IMO. PHP is a bland, unexpressive language with a bunch of modern features such as OO bolted on as an afterthought.
Re: (Score:2)
I would say that it is good for building web *sites* but not so much web *apps*. PHP is fine if all you need is a little dynamic content here and there, but for applications it falls short, IMO.
That's a pretty good way of looking at it. Usually, I find that PHP makes for unmaintainable code. Simple websites don't have this problem, but then, simple websites sometimes grow up to be large ones.
Oh well, not really interested in a PHP flamewar. Suffice it to say that ever since I've discovered Ruby and Python, I don't want to touch another line PHP code again. I don't care if you do dress it up in some MVC framework, it still looks like a turd to me.
Well I hate Rails vehemently, but I'm liking Django (an MVC framework for Python.) Both have limitations, though. I used to think that a PHP MVC framework might be ok, but then I remembered that a lot of the things that I hate about PHP would still exist.
Something I find funny about PHP is that someone actually wrote a templating language for it (Smarty). I thought PHP WAS a templating language!
This happens all the time. People take a perfect
Re: (Score:2)
That's a pretty good way of looking at it. Usually, I find that PHP makes for unmaintainable code. Simple websites don't have this problem, but then, simple websites sometimes grow up to be large ones.
That's a programmer problem, not a language problem. It's just as easy to write understandable, maintainable code in PHP. PHP gets a bad reputation because it's so accessible to newbies, who write bad code. But in the hands of an experienced programmer, it's no different than any other language.
Well I hate Rails vehemently, but I'm liking Django (an MVC framework for Python.) Both have limitations, though. I used to think that a PHP MVC framework might be ok, but then I remembered that a lot of the things that I hate about PHP would still exist.
You should take a look at Zend's PHP framework. There are a lot of other ones out there too.
This happens all the time. People take a perfectly reasonable tool and try to apply it in ways for which it was never designed. Then the developers add features to make those uses easier, and you end up with a crappy tool that does the job.
This is very true. However, Smarty is supposed to remove presentation from the programmers. So if your bus
Re: (Score:2)
Frameworks help a lot. The problem with PHP is that everyone ends up writing their own quirky framework. But even then, PHP as a language is somewhat unexpressive with an object model that feels bolted on as an aft
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Is that to imply that something which is specifically built for a purpose is always better at said purpose than something which is built for a broader range, including the purpose in question?
Don't be ridiculous. Nowhere did I imply that, or even say which one I thought was "better". I said you need to evaluate them on the same level, ie. their ability to build web applications. You wouldn't compare a 3-in-1 Printer/Scanner/Fax to a Laser Printer and say "The 3-in-1 has more features, so it's better at printing."
What I'm pointing out is that the features of Java and .Net are often compared to PHP in a broad view when that doesn't make sense, and it's something you have to be careful of.
This is how I learn. (Score:5, Insightful)
Re:This is how I learn. (Score:5, Insightful)
Re:This is how I learn. (Score:5, Insightful)
Re:This is how I learn. (Score:5, Insightful)
Re: (Score:2)
Personally I can't think of anymore more in-scope for a tutorial book. There's already enough of worthless "tutorial" books that cobble together a useless example and then just cat a bunch of man pages together to pad out the rest of it (in fact, we seem to get a "review" of one of those every couple of weeks here on slashdot).
Re: (Score:2)
Only replying because there is no -1 for being flabbergasted
best practices ... beyond the scope of a tutorial or a book WTF?
Though that does explain a lot of the schlock out there that passes for code...
Re: (Score:2)
To figure out how to do things, I started piecing together tutorials, to make things just work. To really figure out how to do it right, I started disassembling code from large, popular hacking-targets such as Wordpress.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Anyway, if they're teaching dangerous programming practices, they should be removed. We don't need generations of ignorant PHP programmers causing SQL-injection in their projects.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
CMS might be a little kind. I was able to post stories and people were able to leave comments, along with admin and registration pieces.
Re: (Score:2)
My first experiences programming were....amusing. I still remember at age 7 or so I got my first computer - A Texas Instruments 99/4A - and not knowing whether or not a typo in the code could blow the thing up.
Then there's the fact that mouse droppings in my Apple IIe hard disk was causing disks (including my backup disks) to get wiped. I was writing my first game
Okay, I have a question (Score:2)
wrong question (Score:2)
The question to ask is "Have any PHP frameworks introduced or adopted concepts like 'Master Pages'?".
Short answer is that I don't know. However, you'd need to look at things like symfony, codeigniter, cakephp, zendframework, and others. My guess is that no, those frameworks don't have any concepts like 'Master Pages', but I'm not an expert in those frameworks.
Re: (Score:2)
Well, yes that is true. But in application they seem to serve similar functions (once you decide what language you're using in PHP). Dynamic server-side content would seem an ideal way to separate layout from content (much in the way CSS separates formatting and content), yet ASP's Master Pages seems to be the only implementation of this simple idea (can't believe it has taken this long for someone to come up with something that would seem so basic). I always expe
When in doubt, try PEAR (Score:2, Informative)
I know nothing of ASP or its Master Pages, but when it comes to said separation, I favor HTML_Template_IT for its simplicity. For those who want a more "involved" templating system, there's things like Smarty, which I think doesn't quite have as strict a separation as I'd like.
Re: (Score:3, Interesting)
print 'My content';
require("footer.php");
require($_GET['page'].'.html');
print 'bottom of page';
(using print rather than escaping to html due to slashdot restrictions)
Re: (Score:2)
Re: (Score:2)
I was just showing the basic principle.
Try this one, a very very simple site I made (and before anyone bitches I didn't feel like doing the extra work to support IE properly)
http://file-folder-ren.sourceforge.net/index.php?page=/home/ianare/.mozilla/bookmarks [sourceforge.net]
(I'm kinda curious
Re: (Score:2)
or ...
... where the content is changed with a GET variable, i.e. mylayout.php?page=mycontent
print 'top of page';
require($_GET['page'].'.html');
print 'bottom of page';
I like this method better. You can do two requires, one that does form and input validation, before you start outputting HTML and another at the bottom that does the content.
switch($page){ ...
...
case 1:
require($page.'_preproc.php');
break;
case 2:
}
if($errors)
print 'top of page';
else {
print 'bad dog';
exit();
}
switch($page){
case 1:
require($page.'_output.php');
break;
case 2:
}
It's not pretty, but it is flexible. For some pages, I have no preprocessing and for others, the preprocessing may determine which page gets output at the bottom.
The only thing I don't like about PHP is that I haven't found an expert voice, along the lines of a Scott Myers for C++. I have a nagging feeling that something I have
Re: (Score:3, Interesting)
It's not pretty, but it is flexible.
That's how I feel about PHP as a whole. :-)
... much cleaner, much easier to read, and there should be only one way of doing things - the right way.
When I discovered Python after PHP/Perl I was hooked
But you still can't beat PHP when it comes t
Re: (Score:2, Interesting)
mycontent.php:
=============
<?php require('header.php'); ?>
...
rest of the page in here
...
<?php require('footer.php'); ?>
Benefits?
* no risk of parameter injection
* better URLs, especially combined with Apache MultiViews (which lets you omit file extensions, so no
* cache-friendly, since many HTTP proxies such as squid will never cache URLs with querystring parameters
There are other ways to do it, but in ge
Re: (Score:2, Insightful)
Re: (Score:2)
Re: (Score:2)
From what I can tell, it is equivalent to having each of your PHP pages include a header and footer into each page.
There are also various PHP templating e
Re: (Score:2)
Re: (Score:1)
When you modify the master page, there are areas of the page that you designate as editable regions, and so when anything outside these editable regions is updated in the master page, the change is replicated on to each associated page.
This is assuming these master pages are similar in functionality to the 'dynamic
Re: (Score:2)
The purest form isn't always the best way of doing things, but a good rule of thumb is that the more that your template handles, the better.
It's called templating ... (Score:3, Informative)
And if you want to use templating for your web developement - which is discussion worthy in itself - anything other that TAL (Pe(rl)-TAL [cpan.org], PHP-TAL [motion-twin.com] or 'original' [owlfish.com] TAL [zope.org] is completely pointless, because the above mentioned languages are nothing but templating solutions in themselves. There is no point bolting another layer of that on
Re: (Score:2)
... PHP-TAL ... There is no point bolting another layer of that on top of them. Which is why I strongly dislike Smarty and it's ilk.
PHP-TAL is the same as Smarty just with a different syntax. And much more code in the generated templates. A short 11 lines template, which outputs data in a table gets a 18 line compiled template and smarty, while PHP-TAL needs 40 lines to do the same. And I don't need a benchmark to see PHP-TAL produces slower code with all the function calls and controller classes.
Wrong. (Score:2)
Wrong.
TAL (Template Attribute Language) stores it's signals in it's own tag attributes. Hence the name. This means you can build a template filled with mock-content that renders perfectly in any browser without the SSI enviroment and as soon as you integrate it into the templating layer the demo content is automatically replaced by the generated content. A feature pure PHP, JSP, ASP, whatnot code definitely can't provide.
That template processing - a
Re: (Score:2)
Qbertino> There is no point bolting another layer of that on top of them.
Hear hear!
All these freaking template languages just re-invent the wheel for the most part. PHP *IS* a template language first and foremost, that's what it was designed to do, that's why we can intermingle PHP with other stuff in the first place. What the hell is wrong with
how is it any worse than
{loop y as x} {echo x} {/loop}
and other such cons
Re: (Score:2)
Qbertino> There is no point bolting another layer of that on top of them.
Hear hear!
All these freaking template languages just re-invent the wheel for the most part. PHP *IS* a template language first and foremost, that's what it was des
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Also, C# is probably as close to straight C as Python is to Smalltalk: not very (aside maybe for the brackets)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2, Informative)
Password hashing (Score:2)
Password handling (Score:3, Insightful)
That may be md5, crypt, or whatever, but multiple methods are always better. And it has to be deterministic (ie: the password goes in, and the result is always the same).
If you do need the password later (because you need to stash it for enabling access to other systems), your options are
Re: (Score:2)
Anyhow, what this leads to is you have to assume that your database config isn't even vaguely secure unless you've
Re: (Score:2)
Secondly, if you're writing an app that's intended to be distributed everywhere, it's best not to rely on magic quotes and just escape stuff manually, but to each their own.
Re: (Score:2)
But to be safer, use mysql_real_escape_string, pg_escape_string or whatever your local database connection supports.
Re: (Score:2)
Re: (Score:3, Funny)
Re: (Score:2)
Re: (Score:2)
Oh look, a PHP article (Score:2)
Learning PHP (Score:2, Interesting)
This book, like many other skips over this whole learning process. To really teach a language, any language, you have to explain why you do things as well as the goals.
I also don't like the fact that many PHP books attempt to half ass
No practical tags (Score:1)
I guess this is the forward progression of Slashdot tags: no attempt at useful tags.
This is a very good way to learn (Score:3, Interesting)
That is how I learned PHP, Javascript, and SQL simultaneously. I decided I wanted a web site that was database-driven and would stream MP3's. I knew what needed to be done, but I didn't always know how. I found people's examples on PHP.net very helpful, and went off on all kinds of tangents reading "Oh, hey if you have this situation, watch out for this...."
Now I can actually do stuff without having to look up function names all the time (though I still have to occasionally).
What did it get me? Well it got me off the telephone with a nice paying job that nearly doubled my salary, and to-date I'm about the best guy I know who does this sort of stuff. (Please don't take me wrong... I know there are people far more proficient at this than me; I'm not saying I'm the best -- just better than 90% of the industry out there, and I am creating useful things.)
I owe it all to that one project I decided to do.
do it yourself (Score:2)
i knew nothing about RSS feeds, and after a quick read at google I was able to add RSS to my site and get it online in un
From my personal expierence (Score:3, Interesting)
From my expierence of learning new languages and techniques as well as teaching others who are new to web development with such techiques as AJAX; learning off a full blown app with all the bells and whistles all ready added makes it difficult and even more challanging. Many times the code can be misleading and often confusing (most AJAX code I have worked with has been a nightmare) and can often lead to most people not learning but instead simply doing copy/paste of code snippets and simply relying on the fact of "this piece of code works with this form, it will work on this form also" type of mentality of programming.
Don't get me wrong; I am a firm believer that the best way to learn how to program is by trying pre-existing apps that are around to get your feet wet and to see things in action which many of the chapters in the book touch on (authenicating users, user logins) but for many people who are getting into programming IMO planning and designing and application frameworks are not the type of thing anyone should focus on first. How can you start to learn about designing a web application if you have had hardly any expierence with the language itself. And even more so with PHP as this is the gateway drug; er language many people are starting off with in their first step into programming.
Re: (Score:2)
So even though Im fairly knowledgeable in virtually all mainstream or semi-mainstream web technologies of the past decade, from raw C with CGI Bin to
All these Web 2.0 books (Score:2, Insightful)
It's ugly, but gets the job done. (Score:3, Insightful)
web 2.0 - WHY ? (Score:2)