Main menu

12 Apr

The Quest for the Best HTML Style Guide

Published by Mark W. Breneman

 

This post it intended to be documentation of my quest for a workable style guide for my team and the graphics team.

Needs:

  • Document and communicate design decisions between the graphics team and the development team
  • Simple so that both teams can make edits
  • HTML / CSS based to reflect reality of the medium of html and CSS

First up:

16 Jan

15 minute php - Day 2

Published by Mark W. Breneman

Let's dive in a little deeper. I find it handy to know not only how to use the tools, but also the oddities and pit falls. Today we are going to take a deeper look at php index arrays.

 

How do you update a value in an array?

$foo = array('red',"blue","green");

$foo[0] = 'silver'; 

$foo[1] = 'white'; 

$foo[2] = 'purple'; 

 

15 Jan

15 minute php - Day 1

Published by Mark W. Breneman

Indexed Arrays

Indexed arrays in PHP are really simple. They are arrays that are referenced numerically by position starting with 0 as first position.

 

Create an indexed array:

$foo = array('red',"blue","green");

 

Item at position 1 can be addressed  by:

$foo[0]  (echo $foo[0];)

 

Item at position 2 can be addressed  by:

$foo[1]

01 Aug

Drupal IF in a role, but not other roles

Published by Mark W. Breneman


$roles =content_access_get_per_node_settings($node);
if (in_array(4,$roles['view']) and !in_array(1,$roles['view']) and !in_array(2,$roles['view'])){return true;}
?>

30 Jul

fix An HTTP error 0 occurred when autocomplete is interrupted by form submit

Published by Mark W. Breneman

Or at least make the error not pop up a javascript alert.

autocomplete.js pipes all errors to a javascript alerts even simple ajax did not complete, because YOU hit the button too quickly messages. In my case, I did not want a user to see the error message just because they clicked the search button before the auto suggest did its thing. So after a bit of research via google and a tip a coworker gave me, I found that a simple tweak to the autocomplete.js to redirect the alerts to the firebug console was a good solution.

around line 284 in /misc/autocomplete.js (Drupal 6)

20 Jun

Sometimes Drupal Complex array filled Objects just kill me

Published by Mark W. Breneman

dpm($contexts); Returns this: "url" is string and is the first item in the array"field_connect_facebook", that is contained in a object "data", that is contained in an object "argument_nid_1", that is contained in an array "context" So to get the URL you use: $contexts[argument_nid_1]->data->field_connect_facebook[0][url]

12 Jun

Drupal computed field recalculate with taxonomy

Published by Mark W. Breneman

Ok, I just fought an issue for a while where I used a computed field to append a taxonomy list to the title. All worked fine, when the node was saved the computed field populated correctly. But, now I have lots of nodes that need to be updated. I did not want to do them one by one. So View Bulk Operations to the rescue, or so I thought. Turns out VBO seems to not do a full node_load, so it does not load the taxonomy into the $node object. (I bet there is a way to do that if I spent enough time).

29 May

Bootstrap from twiiter

Published by Mark W. Breneman

Ok, ah err wow! is all I got to say. Here is a large library of prebuilt interface elements and styles all wrapped up into a framework all with a nod to Object Oriented CSS.
http://twitter.github.com/bootstrap/index.html

02 May

Show if content has Content Access set for a role but not other roles

Published by Mark W. Breneman

Yeah, this is a rather interesting snippet that has value to me, but does not seem like it would have value to others. Perhaps if a context trigger was based on this code.

The basic idea here is to check if staff role is the only role that has access to this content, if so do something.

<?php
$roles =content_access_per_node_setting('view',$object);
//dsm($roles);
if (in_array(4,$roles) and !in_array(19,$roles)){echo 'staff only';}
?>

Pages