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

php[architect]:
Exporting Drupal Nodes with PHP and Drush
Oct 06, 2015 @ 16:09:11

The php[architect] site has posted a tutorial showing you how to export Drupal nodes with Drush and a bit of regular PHP. Drush is a command line tool that makes working with Drupal outside of the interface simpler and easier to automate.

Drupal 8 development has shown that PHP itself, and the wider PHP community, already provides ways to solve common tasks. In this post, I’ll show you some core PHP functionality that you may not be aware of; pulling in packages and libraries via Composer is a topic for another day.

The tutorial walks through a more real-world situation of needing to export a CSV file that shows a list of nodes added to the site after a specific date. He points out some of the benefits of doing it the Drush way and starts in on the code/configuration you need to set the system up. He shows how to create the Drush command itself and update it with a method to export the newest nodes (after validating the date provided). He makes use of a SplFileObject to output the results from the EntityFieldQuery query out into to the CSV file. He makes use of PHP's generators functionality to only fetch the records a few at a time. Finally he includes the command to execute the export, defining the date to query the node set and how to push that output to a file.

tagged: export drupal node drush commmandline csv output query generator

Link: https://www.phparch.com/2015/10/exporting-drupal-nodes-with-php-and-drush/

SitePoint PHP Blog:
Generate Excel Files and Charts with PHPExcel
Sep 11, 2014 @ 14:48:55

SitePoint's PHP blog has a new post that walks you through the creation of Excel files with the help of the PHPExcel tool, a part of the overall PHPOffice package.

After my article “How To Make Microsoft Word Documents with PHP” (using Interop capability under Windows), there were quite a few comments urging a pure PHP implementation, i.e., only using a universal PHP library to manipulate Office files. In this article, we will see how to use a PHPExcel library to provide an “Export to Excel” function in a web app so that the user can export the data into an Excel 2007/2013 file for further analysis.

His example spreadsheet shows game information for an NBA team (the LA Lakers) including some charting and analytic data in the exported output. He sets up a simple Silex application and both a base and export endpoints. He also shows you how to create the PHPExcel instance, configure it with properties like creator, title and a set of keywords. With this object in place he moves into setting data for each of the rows/cells, populating it from a database table. He also includes examples of creating more than one sheet of results, inserting formulas and creating the charts mentioned earlier.

tagged: phpexcel tutorial excel microsoft chart formular export

Link: http://www.sitepoint.com/generate-excel-files-charts-phpexcel/

VG Tech Blog:
Selenium Tests
Jun 21, 2013 @ 16:26:30

On the VG Tech blog today there's a new post introducing Selenium testing to those that might not have heard of it before for functional testing. It's a powerful tool that can even be used from inside PHPUnit tests to automate evaluation of your frontend application.

When we develop code at VG we have started to use Selenium tests for continuous integration. This allows us to easy write tests that programmatically checks that last commit didn't break anything.

He describes some of the types of tests Selenium can do and mentions the IDE that can hook into Firefox and record your actions and translate them into tests. This includes the ability to export them to PHPUnit tests (sample code provided) that extend the "PHPUnit_Extensions_SeleniumTestCase." An example screenshot of what the IDE running looks like is also included.

tagged: selenium test introduction phpunit export ide firefox

Link: http://tech.vg.no/2013/06/14/selenium-tests

Wojciech Sznapka:
Export colored Behat scenarios to PDF
Sep 04, 2012 @ 14:42:49

Wojciech Sznapka has shares his technique for creating colorized exports of Behat tests for use in PDF files:

Behat scenarios are one of the best ways to describe system. UML Use Cases or tons of pages in SRS documents are fine, but hard to understand from the begining, and even harder to maintain in the future. Behat eases this process and also gives opportunity to automate requirements verification. To write Behat scenarios you need a text editor. I’ve picked my favourite – Vim, which highlights *.feature files syntax. But business people mostly don’t use Vim, so I need to figure a way, to expose scenarios in easy and pleasant way.

His solution involves setting up some printing options in vim to export the tests as a Postscript file, setting the "colorscheme" to the default setting so the colors will be retained. The result is exported (via the "hardcopy" command) and can be converted into a PDF (with a result like this).

tagged: behat test color export postscript pdf print

Link:

9Lessons:
Import GMail Contacts Google OAuth Connect with PHP
Jun 17, 2011 @ 16:11:15

In a recent post to the 9Lessons.info site, Srinivas Tamada shows you how to connect Gmail with your system to import contacts via the magic of OAuth (pulled from Gmail to you).

Inviting friends is the most important part of the web project success. This post explains you how to import Gmail contacts from address book via Google open authorization protocol connect with PHP. It’s simple just few configurations follow below four steps, use this script and give option to invite more friends.

Following a few simple steps and using this simple script - registering the domain under Google Accounts, verify ownership and use the OAuth consumer and secret keys in the script. It's then simple to grab the contacts and output their details as the "Contacts.php" example script shows.

tagged: gmail contacts oauth connection tutorial export

Link:

ThinkPHP.de:
Import and export data using PHPExcel
Jul 15, 2010 @ 15:21:12

On the ThinkPHP blog today there's a new post looking at their experience with PHPExcel to open, modify, save, etc Microsoft Excel files directly from PHP.

EAR's Spreadsheet_Excel_Writer combined with the project Spreadsheet_Excel_Reader on SourceForge was a good helper in the past - but only for BIFF5. BIFF8 support in spreadsheet excel writer has been a problem for a long time, and according to the authors, is still somewhat kludgy in the current version. So I needed an alternative. After a short research I stumbled upon PHPExcel which supports reading and writing of many formats in one API.

He lists some of these input and output formats and includes a simple example of how to use the tool. He creates a basic Excel file with a few different attributes (title, body, keywords) and show how to read in a document to extract the document's content.

tagged: import phpexcel export tutorial excel microsoft

Link:

Maggie Nelson's Blog:
Finally, pretty syntax highlighting for blog posts!
Mar 02, 2009 @ 18:52:27

Maggie Nelson points out a cool way that you TextMate users out there can get better syntax highlighted code for your blog posts.

A coworker, Craig Campbell just launched a new blog recently. One of the really neat things about his blog is how he handles syntax highlighting for code samples - check out examples in his interesting post about Cool Object Building with PHP. In fact, he got so many good comments about this approach that he even wrote a post explaining exactly how he does it: Syntax Highlighting for Your Blog Using TextMate.

Craig's process is as simple as selecting the TextMate bundle and choosing "Create HTML from Document with Line Numbers". The resulting output takes a little tweaking in the HTML and CSS, but the end result is quite nice (and better than several of the syntax highlighting plugins out there).

tagged: blog syntax highlight textmate export html css

Link:

TotalPHP.com:
Creating a text or csv file of information from your database
Dec 10, 2008 @ 14:47:44

On the TotalPHP site there's a new tutorial showing how to pull data from your database and export it as a CSV file that tools like Excel can read in and use.

There are some occasions where you would want to export your site's information in CSV or similar text format. You might want to do this so you can view reports in a spreadsheet, or you might want an export of your product information to upload to a service like Google Products. Either way the method and end result are essentially the same.

The tutorial shows how to grab the information (via the mysqli functionality in PHP5) and formatting each row with the correct values in a certain order. Finally, the entire contents are echoed back out with the correct header() to force a download on the user's browser.

tagged: csv tutorial mysqli database export txt format

Link:

Richard Davey's Blog:
A Guide to using CVS Dude with NuSphere PhpED
Apr 20, 2007 @ 13:39:00

If you're a user of the PhpED IDE in your development work and have had a bit of a hard time with the CVS support, you might want to check out this new post from Richard Davey with a guide on how to get started - specifically with the CVSDude.com hosting service.

If you use NuSphere's excellent PhpED IDE then you'll know it has built-in CVS support for source control. This is a guide I wrote to using PhpED with the CVSDude.com service, so you can get your projects up and running in no time at all.

He talks about getting a new project set up, configuring the server correctly in the Project Properties, and running an import for all of the files in your application's directory.

With that all in place, he also helps you set up the reverse - a place to check the files back out to be able to work with them easily (in a few simple steps). There's even shortcuts you can assign to help make running the CVS functions simpler.

tagged: nusphere phped ide cvs cvsdude project import export nusphere phped ide cvs cvsdude project import export

Link:

Richard Davey's Blog:
A Guide to using CVS Dude with NuSphere PhpED
Apr 20, 2007 @ 13:39:00

If you're a user of the PhpED IDE in your development work and have had a bit of a hard time with the CVS support, you might want to check out this new post from Richard Davey with a guide on how to get started - specifically with the CVSDude.com hosting service.

If you use NuSphere's excellent PhpED IDE then you'll know it has built-in CVS support for source control. This is a guide I wrote to using PhpED with the CVSDude.com service, so you can get your projects up and running in no time at all.

He talks about getting a new project set up, configuring the server correctly in the Project Properties, and running an import for all of the files in your application's directory.

With that all in place, he also helps you set up the reverse - a place to check the files back out to be able to work with them easily (in a few simple steps). There's even shortcuts you can assign to help make running the CVS functions simpler.

tagged: nusphere phped ide cvs cvsdude project import export nusphere phped ide cvs cvsdude project import export

Link:


Trending Topics: