Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
Parsing HTML With PHP Using DiDOM
Jul 05, 2018 @ 15:48:35

The TutsPlus.com site has posted a tutorial showing you how to use the DiDOM library to parse HTML in PHP. The DiDOM is a "simple and fast parser" packed with a lot of functionality for parsing, searching and modifying HTML.

Every now and then, developers need to scrape webpages to get some information from a website. For example, let's say you are working on a personal project where you have to get geographical information about the capitals of different countries from Wikipedia. Entering this manually would take a lot of time. However, you can do it very quickly by scraping the Wikipedia page with the help of PHP. You will also be able to automatically parse the HTML to get specific information instead of going through the whole markup manually.

In this tutorial, we will learn about a fast, easy-to-use HTML parser called DiDOM. We will begin with the installation process and then learn how to extract information from different elements on a webpage using different kinds of selectors like tags, classes, etc.

The tutorial starts by helping you get the package installed (via Composer) and provides a simple example of using it to parse either a string of HTML, a local document or a remote site. It then walks you through using the search functionality built into the library, using either CSS selector type strings. They also include examples of traversing the DOM, updating element attributes, and adding/removing/replacing elements.

tagged: tutorial dom parse html didom package elements

Link: https://code.tutsplus.com/tutorials/parsing-html-with-php-using-didom--cms-31242

MaltBlue.com:
Zend Framework 2 - The New HTML5 Form Fields
May 29, 2013 @ 14:33:59

Matthew Setter has posted another in his series looking at the Zend Framework v2 and some of its features. In this new post he focuses on the HTML5 form field support that comes bundled with recent versions.

In this tutorial, I’ll be taking you through a few of the new HTML5-specific form elements available in the new Zend Framework 2. We’ll see: how they work, how to use them, so you can also see what they’re like. This will be coupled with a good set of screenshots – so you know what they look like. By the end of this tutorial, you should be well on your way to being able to have fully HTML5 interfaces in your applications.

He starts off by talking about HTML5 elements in general, pointing out a few reasons why to use them, complete with statistics to back them up (of mobile usage where HTML5 can be handy). He focuses specifically on four different elements - the telephone input field, email field, URL field and the date/time selector. He gives examples of each and screenshots of what they look like on a mobile device (iPhone in this case). Complete code is included to create the elements as well.

tagged: tutorial html5 elements zendframework2 introduction screenshot

Link: http://www.maltblue.com/tutorial/zf2-html5-form-field-introduction

DevShed:
Building Dynamic Web Pages with Polymorphism in PHP 5
Mar 28, 2007 @ 23:15:35

DevShed continues their look at using polymorphism in an application with the latest part of the series - "Building Dynamic Web Pages with Polymorphism in PHP 5".

In short, Polymorphism is a feature exposed by certain objects that belong to the same family, which eventually can behave differently, even when they're using identical methods. Or more clearly, an object can be considered polymorphic when it's capable of performing different actions by utilizing the same method.

This time they focus on web page development that uses this object-oriented practice. The create a WebPageElement that you can ID and class attributes on and use it to create HTML widgets and extend them to create Div and Link element.

tagged: php5 polymorphism dynamic pages html elements php5 polymorphism dynamic pages html elements

Link:

DevShed:
Building Dynamic Web Pages with Polymorphism in PHP 5
Mar 28, 2007 @ 23:15:35

DevShed continues their look at using polymorphism in an application with the latest part of the series - "Building Dynamic Web Pages with Polymorphism in PHP 5".

In short, Polymorphism is a feature exposed by certain objects that belong to the same family, which eventually can behave differently, even when they're using identical methods. Or more clearly, an object can be considered polymorphic when it's capable of performing different actions by utilizing the same method.

This time they focus on web page development that uses this object-oriented practice. The create a WebPageElement that you can ID and class attributes on and use it to create HTML widgets and extend them to create Div and Link element.

tagged: php5 polymorphism dynamic pages html elements php5 polymorphism dynamic pages html elements

Link:

Metapundit.net:
PHP Do-Nots
Dec 26, 2005 @ 13:02:22

From metapundit.net, there's a new post with a list of a few "PHP Do-Nots" that he's picked up over the years and wanted to share.

I realise I haven't thrown my PHP readers a bone for a while. Lately, unfortunately, all my experience has been with how not to do things. Some of this has been my own fault, but a really healthy percentage has come because I am maintaining one horrible project and rewriting another even more horrid. So, a few pointers for you l3et coders out there: Don't do any of this stuff.

Items on the list include less than thought out design and a lack of knowledge about how to properly use a database.

tagged: do-nots amateur design ignorance form elements do-nots amateur design ignorance form elements

Link:

Metapundit.net:
PHP Do-Nots
Dec 26, 2005 @ 13:02:22

From metapundit.net, there's a new post with a list of a few "PHP Do-Nots" that he's picked up over the years and wanted to share.

I realise I haven't thrown my PHP readers a bone for a while. Lately, unfortunately, all my experience has been with how not to do things. Some of this has been my own fault, but a really healthy percentage has come because I am maintaining one horrible project and rewriting another even more horrid. So, a few pointers for you l3et coders out there: Don't do any of this stuff.

Items on the list include less than thought out design and a lack of knowledge about how to properly use a database.

tagged: do-nots amateur design ignorance form elements do-nots amateur design ignorance form elements

Link:


Trending Topics: