Navigation
 
 

admin's blog

Nice Views argument trick

I finally figured out what the View's Argument Handling Code block is for. Here is a trick to use the same view to get both the all time popular content, and the recent popular content:

 

if( $args[1] == 'today' ) {

  $view->sort[0]['field'] = 'node_counter.daycount';

  $view->sort[0]['id'] = 'node_counter.daycount';

Last Updated: April 28, 2008 - 4:22pm

Drupal Modal Dialogs and CCK

<!-- Flash movie tag -->
Last Updated: January 31, 2008 - 12:03pm

Setting up Eclipse PDT and XDebug

I decide to move into the word of real-time debugging today. I have been using the PHPEclipse plug in, but I could not find a 5.1.4 version of the debugger it uses, but I was able to get the eclipse PDT (formally PhpIDE) working with XDebug.
  • Pull down the PDT 0.7RC2 all-in-one (includes Eclipse 3.2) - http://download.eclipse.org/tools/php/downloads/
  • Get XDebug to match my php (Windows, 5.1.4) - http://xdebug.org/link.php?url=xdebug200rc3-512-win
  • Install XDebug - I am using xampp, so I save the XDebug dll in xampp_path\php\extentions.
  • Enable XDebug - Modified xampp_path\apache\bin\php.ini - comment out existing zend_extension_ts and add
    [xdebug]
    xdebug.remote_enable=1
    xdebug.remote_host="localhost"
    xdebug.remote_port=9000
    xdebug.remote_handler="dbgp"
    zend_extension_ts="xampp_path\php\extentions\php_xdebug-2.0.0rc2-5.1.2.dll"
  • Restart apache, and check phpinfo() to make sure XDebug has been successfully installed
  • Get Dave Kelsey's XDebug for PDT plugin - https://bugs.eclipse.org/bugs/show_bug.cgi?id=169408
  • Copy plug-in files into Eclipse plugin directory
  • I needed to convert my phpeclipse projects into PDT projects. Close the projects, and edit their .project files, changing their natures to org.eclipse.php.core.PHPNature, then reopen the projects
  • Lastly, follow the excellent directions in the XDebugPHPIDEGuide.pdf to set up a Debug web launch and debug away.

ISSUES with PDT

Last Updated: February 7, 2007 - 5:58pm

First Drupal Module

I just released my first drupal module: Flexinode to CCK Converter Sadly, it is a big old hack - but it was useful to me, and when I posted the code to the forum, someone else was able to use it successfully. Too cool.

I was nifty to use the new project publishing system that Derek has been working so hard on. Seems really slick.  Unfortuantely, the eclipse cvs isn't flexible enough to do the branching and tagging the system requires (it adds crap to your tag name, which seems braindead), but it is not much trouble to use WinCVS for that bit.

Last Updated: January 31, 2007 - 12:15pm

Westling with the Form API

  • Hook call order
    1. _load
      • inputs: &$node, but ignore it - nothing useful in it yet, and any changes are rejected.  Pull data from db.
      • outputs: object(hash) that will get merged with node.
      • goal: move data from db into node
      • ? why not just allow you to modifiy $node?
    2. _prepare
      • inputs: &$node with info from _load.  Pull data from $_POST and $_SESSION
      • outputs: changes to $node persist down chain.
      • goal: make changes to $node based on non-submit actions
    3. _form (does not go to _nodeapi, now use _form_alter)
      • inputs: &$node - now fully loaded with $_POST['edit'] array (and data from _load and _prepare)
      • outputs: returns the bad-ass form array. Can modify $node, but that would be odd(?)
Last Updated: October 13, 2006 - 3:58pm

The problem with testing

The problem with testing is that you find bugs.

  • Some events (especially CCS days) are missing titles
  • Content links jump out of campus themes (need %base_dir filter, especially given coming 4.7 base change). 
  • Per event 'calendar' link jumps out of campus theme.
  • Citris content types are not showing up on rep's content add page.
  • Some events/presentation missing images (and some just ugly!)
  • _qa getting added to Citris People URL.
Last Updated: June 9, 2006 - 11:09am

Drupal, Images & HTMLArea

I am going to transistion from HTMLArea to TinyMCE once we upgrade to 4.7.  And I will be moving to the Filemanager module to manage public vs private uploads. However, in the mean time, I the images the folk in the office associate with news items is embedded in the form "image/view/nid", which is amazingly unreliable.

So what can I do?  Ah ha, I can hack up the UploadImage plugin in the htmlarea module (modules/htmlarea/plugins/UploadImage/popups/insert_image.php) to access the filename and use that instead of "image/view/nid".  Ah the wonders of open source.

Last Updated: June 2, 2006 - 2:02pm