 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
SitePoint PHP Blog: DOM vs. Template
by Chris Cornutt September 25, 2008 @ 11:18:25
In this new post to the SitePoint PHP Blog there's a look at using a small templating engine recently released by Fredrik Holmstrom that takes a different tack on working with template files - it parses them into a DOM structure.
The main difference to traditional template engines (Such as Smarty), is that the template it self doesn't have any imperatives within. In fact, the template doesn't even have to be written to the template engine, to be used - Any markup can be used as a source.
The templating system uses Domlings, bits of HTML to match against and replace with the bound information. A few examples are included - a simple binding, how to switch out a block of HTML, pushing it back in and looping over a block of information to do some search and replace.
voice your opinion now!
dom template smarty domlings html replace
Developer Tutorials Blog: Easy Screen Scraping in PHP with the Simple HTML DOM Library
by Chris Cornutt August 06, 2008 @ 08:40:15
On the Developer Tutorials blog today Akash Mehta looks at screen scraping using a simple DOM library to help make it easy.
In PHP, regular expressions tend to get rather messy, DOM calls can be confusing and verbose, and often the string functions just aren't enough. In this tutorial, I'll show you how to use the middle ground - the open source PHP Simple HTML DOM Parser library, which provides jQuery-grade awesomeness for easy screen scraping without messy regular expressions.
In his examples he shows how to grab the contents of a page (google.com), find and replace information in the HTML and perform a query on the data (like finding each of the news stories out of the front page of slashdot.org).
voice your opinion now!
screen scraping simple html dom library example tutorial
DevShed: Composing Messages in HTML for MIME Email with PHP
by Chris Cornutt July 30, 2008 @ 14:34:59
DevShed continues its look at sending MIME emails with PHP in the fourth part of the series - a method for sending HTML in the message.
In this article, I'm going to show you how to provide the MIME mailer class with the ability to send email messages in HTML format. This will greatly extend its functionality, so don't miss this tutorial.
They start by reviewing the class they've created so far, including an example of its use. From there they modify it slightly to make it easy to embed the HTML content into the email by adding the addHTML and buildHTMLPart methods.
voice your opinion now!
compose email tutorial mime html content
Kae Verens' Blog: pre-parsing HTML for incorrectly-sized images
by Chris Cornutt July 29, 2008 @ 12:03:55
Kae Verens has a recent blog post that looks at a method for helping to protect users from themselves when working with images - a method for handling ones incorrectly sized.
Every now and then, I get a call from a client who is puzzled why their site is running slow. I would look at their page and see an innocuous image inserted into a paragraph. When I examine the image, though, I see that the client has artificially resized the image using HTML. One recent example showed on-screen as a 300px-wide image. When I examined it, it was actually 3000px wide (approx).
The script looks through some HTML markup and, based on the sizes in the image tags, resizes the images appropriately. An example and the source are provided.
voice your opinion now!
html image size height width parse resize
Zend Developer Zone: Three Quick Tips To Make Your PHP Understandable
by Chris Cornutt June 25, 2008 @ 07:57:19
The Zend Developer Zone has posted a new article today with three tips to help you make your code a little easier to understand (both by other coders and yourself down the road).
Producing code that clearly conveys a developer's intent is key to any well written application. That not only applies to PHP, but every programming language. Developers who emphasize the creation of legible code tend to create applications which are easier to both maintain and expand upon.
His tips include suggestions about keeping conditional logic clean, using "less PHP and more HTML" and to make the best possible use that you can out of sprintf "and friends".
voice your opinion now!
tips understandable code conditional logic html sprintf
Stefan Mischook's Blog: Why build all your pages in PHP?
by Chris Cornutt May 16, 2008 @ 07:54:06
On his blog today, Stefan Mischook shares his reasoning for making all of your pages PHP pages, regardless of static content or dynamic.
By making all your web pages PHP pages from the start, you are basically leaving open the possibility of using PHP in your web pages at any time.
By his reasoning, it provides an "out" for you later on should you decide that a page needs to have some dynamic content thrown in there somewhere (without having to change the filename - bad for SEO, supposedly).
voice your opinion now!
build page dynamic content static html
Michael Girouard's Blog: Rolling Your Own MVC The View
by Chris Cornutt April 28, 2008 @ 09:39:45
Michael is back with part three of his series stepping you through the creation of your own MVC framework (Part 1 and Part 2) with a look at the part that interfaces with the user - the View.
Using the view as a starting point may seem odd at first considering the view-related actions are some of the last steps in the page load scenario, but since our views don't have any external dependencies, unit tests are very easy to write and so is the accompanying code.
He explains how views work along with the rest of the framework and some of the basic rules surrounding how they get their data. Code comes along with the explanations for different views like XML, HTML and JSON methods of output.
voice your opinion now!
modelviewcontroller mvc view tutorial output xml html json
Greg Szorc's Blog: Using DTD's and Catalogs for XHTML Validation
by Chris Cornutt April 10, 2008 @ 11:29:48
Greg Szorc shows how, in this entry on his blog, to use DTDs and catalogs to validate your XHTML pages with a little help from PHP.
This [validation from an external site like the W3C validator] approach is a good start, but it is far from ideal because it is based on an honor system of sorts. You often forget to validate each change you make and there is always some corner case that you forget. So, what can be done about it? Well, if you find yourself developing in PHP, you can employ the following solution.
The code he includes pulls in the XHTML content from your page (or the output of the framework's view layer) and pushes it into a DOMDocument that's build with the LIBXML_DTDLOAD and LIBXML_DTDATTR options.
voice your opinion now!
html validation dom extension document import
|
Community Events
Don't see your event here? Let us know!
|