News Feed
Sections




News Archive
feed this:

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

Chris Hartjes' Blog:
Sorting Relationship Results In Doctrine 1.2
February 05, 2010 @ 10:51:32

Doctrine allows you to set up relationships to link data in various tables together. Unfortunately, those aren't always in the order they need to be in. In a new post to his blog Chris Hartjes shows you how to sort these relationship results just by adding a simple line to your request.

I started digging around via search engine. Took me about an hour to find the solution. First, it took me half the time to dive deep enough to find out WHERE I can define the default sort order. Surprisingly, it was in an area that made total sense but I could not find before.

You can see an example of it in the "hasMany" call in his code snippet - the addition of the "orderBy" option and the value showing the sorting order. Here's the StackOverflow page that gave him the answer he needed.

0 comments voice your opinion now!
relationship doctrine sort tutorial orderby


DevShed:
Customizing WordPress Search Results to Sort by Title
May 06, 2009 @ 09:30:09

DevShed has a new tutorial posted today looking at two methods that you can use to sort the search results from your WordPress blog my title instead of by date - a bit of code and a plugin.

Sorting search results by post title in WordPress is often useful, if your website needs its entries to be sorted alphabetically. As a quick background, WordPress is the most popular open source, free blogging/CMS platform. However, the default search results are sorted by date, so there is no easy way to sort them alphabetically except to edit the core WordPress search functionally source code.

Here's the two options:

  • Updates to the Query.php file to change up the "order by" value to work for the post_title and ascending/descending sort orders
  • The Sort Search Results by Title plugin that lets you keep away from the WordPress source and change the results order with a drop-in plugin
0 comments voice your opinion now!
wordpress search results title tutorial plugin query orderby


Markus Wolff's Blog:
ActiveRecord enhancements
September 11, 2006 @ 08:16:27

Markus Wolff finally got the time to work on a project he's developed but hasn't had the time to enhance - CWAC_ActiveRecord.

After two weeks I finally managed to find a bit of time to continue working on CWAC_ActiveRecord. Requested by my friend Arnaud was the setConnection() method, that allows to reuse existing PDO objects with CWAC_ActiveRecord. Before this, you could only pass a DSN with the config array and a new connection would always be created.

He also added limit() and orderby() methods to help narrow down your queries.

0 comments voice your opinion now!
activerecord ehancements cwac project setconnection limit orderby pdo activerecord ehancements cwac project setconnection limit orderby pdo



Community Events





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


community unittest language podcast api testing introduction threedevsandamaybe install wordpress refactor interview opinion list laravel code series release framework developer

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