 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Gonzalo Ayuso's Blog: Populating datagrid techniques with PHP
by Chris Cornutt July 19, 2011 @ 09:25:46
In a new post to his blog Gonzalo Ayuso looks at the code required to populate a jQuery data grid with the records as pulled from a (MySQL) database.
Today I want to speak about populating datagrid techniques with PHP. At least in my daily work datagrids and tabular data are very common, because of that I want to show two different techniques when populating datagrids with data from our database. Maybe it's obvious, but I want to show the differences.
He uses "old school spaghetti code" rather than a framework to keep things simple and pulls the data from the database with a PDO connection. This information is then manually pushed into an HTML table and the data grid functionality is applied to it. The other method involves a little bit of JSON magic that the data grid library pulls in and populates for you, still appending rows to a table.
He notes that the second method seems faster to the user since the page and table are rendered first, but it also comes at the cost of more than one HTTP request.
voice your opinion now!
datagrid jquery technique preload ajax json
SitePoint PHP Blog: How to Split WordPress Content Into Two or More Columns
by Chris Cornutt February 05, 2010 @ 12:58:00
On the SitePoint PHP blog there's a recent post from Craig Buckler showing how to split up your WordPress content into two or more columns quickly and easily.
WordPress is a great CMS, but implementing some features within your theme can require a little lateral thinking. The content for your page or post is usually output by the theme code using a single function call. But what if you need to split the content into two or more blocks? That might be necessary if your theme requires multiple columns or sections on the page.
There's a built in call WordPress includes, "get_the_content", that returns the content rather than just echoing it out. With this handy function giving you just the content, you're free to split up the content however you want - on certain tags or as they suggest, using the "more..." tag and a few modifications to a few other scripts to split it out into DIV blocks.
voice your opinion now!
wordpress content tutorial split column
Chris Jones' Blog: Inserting and Updating Oracle XMLType columns in PHP
by Chris Cornutt July 13, 2009 @ 08:14:21
All of you Oracle users out there might want to check out this recent post from Chris Jones, especially if you've been using the XMLType columns in your tables.
Today a reader mailed me about manipulating XMLType columns when the data is longer than the 4K limit that character-type handling imposes. My free book (see sidebar) has examples of how to do this using CLOB handling in PHP. I noticed that my xmlinsert.php example in the book does a SELECT and UPDATE, but never actually does an INSERT.
To correct the problem of the missing example he includes example code to connect to the database, push the XML into a bind variable and select the row back out to ensure everything's still structured correctly. You need to set up a new descriptor for the insert to work (CLOB).
voice your opinion now!
clob column xmltype xml oracle insert
Sameer Borate's Blog: Selecting all except some columns in MySQL
by Chris Cornutt March 02, 2009 @ 11:13:08
Sameer Borate shows how to turn things around in your application's SQL statement and, instead of selecting the columns you need, showing how to remove the columns you don't need dynamically.
The MySQL SELECT is a ubiquitous statement. You can select rows using the '˜*' operator or by listing the individual column names. But many times you may require using all the columns from a table except a couple of them. For example you may have a table containing twelve columns from which you require only eleven columns.
Sometimes that extra column can contain larger content you might not need or want. He creates a get_column_names and create_statement functions that grab the column names and, based on an "exclude" array, takes out the unwanted records. The array is then looped through and appended back together as the new column list for the select.
voice your opinion now!
select exception mysql column array remove
Lee Blue's Blog: How To Sort A Zend_Db_Table_Rowset
by Chris Cornutt February 14, 2008 @ 17:11:00
Lee Blue has posted a handy tip for users of the Zend Framework, specifically when sorting the results from a query to tables linked in a Zend_Db_Table setup.
So you figured out how to define the relationships between your Zend_Db_Tables and you have issued a call to findDependentRowset(). You get your Rowset back but you need to sort the results by one of the columns in the dependent table. How do you do that?
Unfortunately, he's found out that you just simply can't - well, not without a custom function (until the 1.5 release of the framework rolls around). He shows his table set up and some sample database classes to relate to the tables (and link between them). The magic comes in with his DU_Utils class that takes in the data and sorts it based on the given column name in the given direction.
voice your opinion now!
zendframework zenddb table relationship sort order column
Zend Developer Zone: Creating Data Tables With PEAR Structures_DataGrid
by Chris Cornutt January 28, 2008 @ 16:19:30
Cal Evans has posted a tutorial on the Zend Developer Zone (posted today) about using the PEAR Structures_DataGrid package to create quick and easy data tables.
In this article, I'll be introducing you to the Structures_DataGrid package, showing you how it can be used to display structured data in tabular form. I'll be showing you how to hook it up to various data sources (including a CSV file, an RSS feed and an Excel spreadsheet), and how to format the resulting output so it's as pretty (or as ugly) as you want it to be.
They talk about what you'll need to get started (the different packages for different kinds of data) and some sample code to help you down the path to more attractive tables. There's even a bit touching on some of the more advanced features like exporting to Excel, pagination and data sorting.
voice your opinion now!
pear package structure datagrid table tutorial
|
Community Events
Don't see your event here? Let us know!
|