Jonas Construction
Gathering the data needed to abuse field formatters-- disable and combine and change per node settings set by user
For old times sake... this is one of the last outputs like this before I use a properly integrated development environment, Eclipse PDT (for PHP) with xdebug, which will show all the variables without the Drupal set messaging and such.
Field_placement displaying using CCK field formatters
Fastest way to get just one result from a database table in Drupal
To get a single value result – one row from a just one column – the Drupal function for that is db_result(), which takes the result of db_query() as an argument.
http://api.drupal.org/api/function/db_result/5
So the fastest way to get a single result (please pardon the awkwardly named function) would look like this:
<?php
Functions needed to define a new CCK field; Field placement module thoughts
If we were to implement Field Placement's imagecache preset option as a CCK field itself, here are (a lot of) the parts we would have to implement, drawn from imagefield itself. Many helper functions left out, but the below code is the gist of defining a CCK field type.
Fieldsets in Drupal forms: FAPI 5 syntax
Drupal fieldsets can also have a description.
<?php
$form['placement_imagecache'] = array(
'#type' => 'fieldset',
'#title' => t('Imagecache settings per content type'),
Apache access control the Agaric way
Clients don't like their test site competing with their live, production site for Google results. Therefore, we have put our entire set of test sites behind a pop-up requiring basic Apache authentication.
For ongoing maintenance — adding new people to access the test environment behind the authorization wall — the operative command is:
Roughly following the instructions here:
http://httpd.apache.org/docs/2.2/howto/auth.html
sudo mkdir /etc/apache2/passwd
sudo htpasswd -c /etc/apache2/passwd/passwords dan
New password:
Re-type new password:
Adding password for user dan
sudo htpasswd /etc/apache2/passwd/passwords benjamin
New password:
Re-type new password:
Adding password for user benjamin
I love that no matter how many times I do it
I love that no matter how many times I do it – leave off a semicolon, have more opening than closing parentheses, or have an extra curly brace – the PHP parser still finds my error unexpected.
It's that kind of unconditional confidence that a coder needs to get through the day... and the night.
With XAMPP, permission denied for MySQL user with % (all) host access but works for localhost
For reasons not known to man nor beast, on XAMPP on Mac OS X (and not XAMP but another all in one WAMP stack, but not that name either) will not work with the wildcard availability host name (%). It will work (or anyhow may work for you, it worked for Agaric!) with the @localhost for host name.
Update or commit: See what's changed in a version-controlled file with svn diff
When you run
sudo svn status -u
and see
M 6549 www/.htaccess
you can see exactly what's up with those changes with
svn diff www/.htaccess
Showing something like:
Index: www/.htaccess
===================================================================
--- www/.htaccess (revision 6549)
Agaric Utility function: set default values in an array
the original line is almost as short as the function, but if we want to add checking on "empty()" or need to change anything else, it's all in one place
/**
* Set a default value for an array key if that key does not exist.
*
* The _au_ namespace stands for agaric utility, and are things
* we may reuse in so many modules we'll want to put in a helper
Forward Drupal path to an external URL
UPDATE: A better, universal approach which should be all you need is immediately here--
Simply provide the internal path that really belongs to the old site (in 'path', and the URL you want to send things with this path to, in the 'url' value of 'callback arguments').
