News Feed
Jobs Feed
Sections




News Archive
feed this:

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

SitePoint PHP Blog:
How to Dynamically Localize TinyMCE
December 02, 2013 @ 10:37:41

The SitePoint PHP blog has a post from Roland Clemenceau about localizing the TinyMCE editor, a web-based Javascript HTML WYSIWYG editor. It's dropped in to make textareas rich-text editing components of your page quickly and easily.

This tutorial assumes you have built a PHP multilingual site/framework and you, or whoever the admin is, would like TinyMCE to automatically switch to the current language of your site. [...] Although TinyMCE is a great wysiwyg editor that provides localized files for almost every known language, it still does not come with an automatic language-switching feature. It's very easy to roll your own solution to this problem, though, so that's what we're going to do now.

He shows how to use extra language files in coordination with a "language" setting. This setting (usually something like "en" or "es") can then be set as a configuration option when the TinyMCE instance is added to the page.

0 comments voice your opinion now!
localize tinymce editor wysiwyg tutorial html

Link: http://www.sitepoint.com/dynamically-localize-tinymce/

SitePoint PHP Blog:
Coding a Lorem Ipsum Alternative
August 26, 2013 @ 10:54:02

On the SitePoint PHP blog David Francis has written up an example showing how to create a "lorem ipsum" alternative in PHP. The "lorem ipsum" functionality generates text to put into layouts or prototypes of pages. It's named this way because the first two words are traditionally "lorem ipsum."

Lorem Ipsum generators are well known and are useful for generating text copy during website development. [...] t's good that we have a wide selection of text generators, but how exactly are these generators made? Can we use PHP and MySQL to build our own? That's exactly what we'll tackle in this article. We won't develop a fully working website; what we will cover are the essentials for building a site such as Fillerati.

He suggests using something from Project Gutenberg (a collection of public domain books and other written works) with the HTML markup already included. His personal choice is On the origin of the Species. He uses a simple PHP script to extract the content from the downloaded document to find useable paragraphs (don't want ones that are too long or short). He then takes that same data and populates a few database tables with it and includes the script to extract them and place them in the page. This could easily be adapted into a view helper for your favorite templating language or framework.

0 comments voice your opinion now!
loremipsum alternative projectgutenburg tutorial html extract

Link: http://www.sitepoint.com/coding-a-lorem-ipsum-alternative/

PHPMaster.com:
Convert HTML to PDF with Dompdf
August 15, 2013 @ 10:39:16

On PHPMaster.com there's a new tutorial from Shameer C showing you how to use Dompdf to convert HTML to PDFs. The handy library makes it (relatively) simple to automatically generate the documents without the need to know the internal PDF file structure.

PDF is a standard format originally created by Adobe for representing text and images in a fixed-layout document. It's not uncommon for a web application to support downloading data, such as invoices or reports, in PDF format, so in this article we'll go through how we can easily generate PDF documents using PHP.

He starts off with the installation (via Composer) and the creation of a simple "Hello World" document, showing how to "stream" it into a PDF file. He also includes some more advanced usage - loading an external HTML, drawing lines, changing fonts, adding page numbers and additional text to the page.

0 comments voice your opinion now!
html pdf convert tutorial dompdf adobe

Link: http://phpmaster.com/convert-html-to-pdf-with-dompdf

David Müller:
Cross Domain AJAX Guide
December 10, 2012 @ 12:17:39

In his latest post David Müller covers some of the things to consider when working with cross-domain ajax requests including CORS and iframes.

As it is widely known, AJAX Requests are only possible if port, protocol and domain of sender and receiver are equal. [...] Having this cleared out, we will cover ways around this restriction.

He covers three main approaches to allowing these cross-domain requests (and some of the security implications that can come with them):

  • CORS (Cross Origin Resource Sharing)
  • JSONP (Javascript with a local domain callback)
  • Iframes

He also briefly mentions things like window.postMessage (HTML5) and the use of a backend script to proxy a request into your application's local code.

0 comments voice your opinion now!
crossdomain ajax cors iframe jsonp tutorial introduction


Rob Allen:
Sending an HTML with text alternative email with ZendMail
November 02, 2012 @ 10:26:20

Rob Allen has a quick tutorial posted to his site today showing you how to send an email with the ZendMail component of the Zend Framework 2 that contains HTML but provides a plain text backup in the same message.

Sending a multi-part email with ZendMail is easy enough, but if you want to send an HTML email with a text alternative, you need to remember to set the content-type in the headers to multipart/alternative. As this is the second time I had to work this out, I'm noting it here for the next time I forget!

The rest of the post is the code you'll need to send a simple email with a text and HTML body sections, configure the headers (to, from, etc) and the "multipart/alternative" header to make the HTML or plain text switching work correctly.

0 comments voice your opinion now!
zendframework2 mail tutorial send alternative html plaintext


James Morris' Blog:
Parsing HTML with DOMDocument and DOMXPathQuery
June 27, 2012 @ 10:19:35

In the latest post to his blog James Morris looks at using XPath's query() function to locate pieces of data in your XML.

The other day I needed to do some html scraping to trim out some repeated data stuck inside nested divs and produce a simplified array of said data. My first port of call was SimpleXML which I have used many times. However this time, the son of a bitch just wouldn't work with me and kept on throwing up parsing errors. I lost my patience with it and decided to give DomDocument and DOMXpath a go which I'd heard of but never used.

He includes a code (and XML document) example showing how to extract out some content from an HTML structure - grabbing each of the images from inside a div and associating them with their description content.

0 comments voice your opinion now!
dom domdocument domxpath xpath tutorial html


NetTuts.com:
So You Want to Accept Credit Cards Online?
June 14, 2012 @ 09:30:25

On NetTuts.com they're posted a new tutorial about using the Stripe service to accept credit cards on your site. Thanks to some handy libraries they provide, integration is a relatively simple process.

Until recently, accepting credit cards on a website was expensive and complicated. But that was before Stripe: a radically different and insanely awesome credit card processing company. Today, I'll show you how to start accepting cards in 30 minutes or less - without spending a dime.

They step you through the whole process you'll need to get the full flow set up:

  • Install an SSL Certificate (on your server)
  • Create an Account
  • Create Your Payment Form
  • Collect The Form Values
  • Request a Token
  • Create a Server-Side Script

Screenshots of the Stripe interface, HTML, Javascript and PHP code are all included - everything you need to make the simple card handling work. One of the keys to how Stripe deals with credit cards is that you provide it the card info, it gives you a token. Your app uses this to work with the card instead of storing the card information in your database (also making it more secure).

0 comments voice your opinion now!
creditcard stripe tutorial processing javascript html php library


PHPMaster.com:
Server-Side HTML Handling Using phpQuery
June 12, 2012 @ 10:58:26

PHPMaster.com has a new tutorial today showing how you can use phpQuery to work with HTML in your application. phpQuery is a server-side CSS-selector-driven based on jQuery's API.

Think about how you can change and manipulate the generated HTML using server-side PHP code. phpQuery is the ultimate solution that will come to your mind. If you haven't heard about phpQuery, you may be interested in this article since I am going to give you a brief introduction to phpQuery and explain how you can use it in real-world projects.

The tutorial shows you how to generate a simple table with alternating row colors (zebra) and column headers from an array of product information. They also talk a bit about why using something server-side like this is important (over something client-side like jQuery) - how it can make things easier by keeping the "business logic" all in one place, leaving your frontend to do what it does best.

0 comments voice your opinion now!
tutorial phpquery backend html processing


Danne Lundqvist's Blog:
Getting to grips with an existing XML structure
April 25, 2012 @ 10:44:43

Danne Lundqvist has a new post where he shares a bit of code he's written to "come to grips" with an existing XML structure.

Very often I find myself writing input filters for large XML files using PHP. Common enough task; and PHP offer a great variety of tools to do this effectively depending on the situation. Unfortunately, almost as common is the lack of documentation for the aforementioned XML files. [...] I have looked around for a simple tool but I didn't really find a tool that gave me the quick and dirty overview I wanted. A year or so ago I finally wrote a small PHP class to analyze large XML files.

He includes an example XML file, the HTML output of the parsing and a sample of how to use the class to parse and output the XML structure, complete with some CSS.

0 comments voice your opinion now!
xml structure schema parse output html csss


DZone.com:
PHP Ajax Cookbook (Book Review)
April 17, 2012 @ 13:03:50

On Dzone.com there's a book review from Ivan Ilijasic covering a recently released title from Packt Publishing, the "PHP Ajax Cookbook" (by Milan Sedliak, Rajesh Jeba R. Anbiah and Roshan Bhattarai). His review gives a "one minute bottom line" about the book and its contents.

I've been in PHP development for more than 10 years and this book is really useful material. I could recommend it to beginners and experienced developers. From my point of view, there are three types of developer books - complete byte-to-byte fat books, introduction books and cookbooks. I want my cookbook to have useful and simple to use recipes. This book fulfilled my expectations.

He mentions some of the topics that the book covers including javascript libraries and frameworks (mostly jQuery) and recipes for things like form validation, dynamic content, pagination and drag and drop functionality. He also points out some coverage of testing and debugging content as well as web service "mashups" and mobile app development.

0 comments voice your opinion now!
book review ajax cookbook packt



Community Events











Don't see your event here?
Let us know!


framework performance symfony2 database package install overview release composer facebook hack hhvm unittest application introduction security language podcast component opinion

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework