David Shaw's blog

Posted by David Shaw

A long-standing frustration for any Mac web developer has been testing our sites in Internet explorer.

To run our sites in Internet Explorer developers need to either:

Read the rest of this entry »

Posted by David Shaw

When writing CSS most people use short hand because it saves space and thought.
For instance below says make a white backgorund with a horizontally repeating background image body_bgrd.png

background: #FFFFFF url(../images/body_bgrd.png) 0 0 repeat-x;
That works fine for your site's CSS but paste that into your HTML Mail template and your in for a surprise. :)
Instead you have to write the CSS out in long hand.

Read the rest of this entry »

Posted by David Shaw

Setting the length of teasers in Drupal 6 is easy when you have only one layout. Go to "Post Settings"  on the admin page:

/admin/content/node-settings

Set the "Length of trimmed posts" to  your desired length 200 characters , 600 characters etc.

If you have two different layouts on your site you have to get a bit trickier and use code.
I've created this could in a new block set to allow PHP input.

Read the rest of this entry »

Posted by David Shaw

First enable user profile pictures built into the drupal core.

triberising.com/admin/user/settings
  • Under pictures select "Enabled"
  • Hit 'Save Configuration'

Now set drupal's theme to display profile pictures on your nodes: Administer > Themes > Configure tab > Global Settings

Read the rest of this entry »

Posted by David Shaw

So you want to create a longtext field in your custom schema.
You've noticed node revisions use this to store the long text in descriptions.
So, you've changed the type in the schema to read 'type' => 'longtext' but no luck. The table doesn't install and you have an error in your face.
 
You could try 'type' => 'blob' which works but this isn't what you want either. Blobs aren't the same as text in mysql. Blobs are binary so they are case sensative. Searching for 'drupal' will not return 'Drupal'.
 

Read the rest of this entry »

Posted by David Shaw

Coding along minding your own business syncing to your repository using svnX on your Mac you may hit an error saying:
 
svn: Working copy locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
 
You look through the svnX menu items and commands in vain. Where do you click? Where is this cleanup? Right click doesn't work. How do I remove these locks?
 
The answer is there is no where to click.
Instead you must open the terminal.
 

Read the rest of this entry »

Posted by David Shaw

As documented here: http://www.php.net/manual/en/mysqli-result.num-rows.php
 
To count how many elements are returned by a call against your database simply use:
$result->num_rows;
 
For example:
$result = db_query ("SELECT * from {node});
$row_cnt = $result->num_rows;
 
$row_cnt will equal the total number of nodes in your Drupal MySQL database.

Posted by David Shaw

Previously node_save() returned the $nid but not anymore... so what do we do?
 
It's deceivingly simple.
You have just saved a variable as your node.
$n In this example:
node_save($n);
Now call $n->nid :) its that easy!
$nid = $n->nid;

Posted by David Shaw
  1. As a basic rule use normal english sentences with full punctuation.
  2. Don't repeat words like "free free free"
  3. Avoid spammy terms like "special offer", "huge discount", "free gift" and obvious things like "viagra" and sexual innuendos.
  4. Don't write anything in ALL CAPITAL LETTERS. This is the internet equivalent of shouting and people tire of it very quickly.

Read the rest of this entry »

Posted by David Shaw
  1. Short engaging subject line: Your message can be the best in the world but if you don't catch people with your subject line most people will never see the message.
  2. Keep the message short.
  3. Have 1 ask. Not 5 not 3, 1!
  4. 1 big obvious button recipients can click to fulfill your ask.

Read the rest of this entry »