Main menu

Bookmark

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';}
?>

26 Apr

set CCK default value from query (Multi-Value)

Published by Mark W. Breneman

Just in case you may need to populate a CCK field from a db query OR more to the point, next time I have to:

global $user;
$qdata= 'db_query(SELECT field_school_studyareas_value
FROM
content_field_school_studyareas
where nid in (select nid from node WHERE node.type in ("exhibitor_profile") and uid ='.$user->uid.')) ' ;

while ($row=db_fetch_array($qdata))
{
$var[]=array('value' =>$row['field_school_studyareas_value']);
}
return $var;

Yes a join would have been far better. I'll fix that soon.

26 Apr

Mobile website Resources

Published by Mark W. Breneman

Over the next few weeks or more likely months, I'm digging in deep to learn more about building good mobile sites. A lot has transpired in the mobile world while I have been working heads-down the desktop web world.

I am blowen away with responsive design and how it can bridge the desktop and mobile world.

The Drupal Omega Theme is very impressive right out of the box. It is going to take me a while to work through all of the options and

One thing that I have not seen in many responsive designs is good mobile menu support.

08 Mar

On Line 16:9 ratio caculator

Published by Mark W. Breneman

Just in case you have not yet had your morning coffee, or just do not want to do the math, here is a quick tool to figure image sizes to keep a 16 by 9 ratio.
http://size43.com/jqueryVideoTool.html

09 Jan

Make sprite based nav ez

Published by Mark W. Breneman

From the site:
Single sprite (What's that?) navigation is great, but we all know it can get a little bit tedious. All that measuring of pixel perfect photoshop slices, careful coding of your CSS and subsequent calculator bashing is enough to drive anyone to start microwaving fluffy kittens. Wouldn't it be great to have a fancy online tool to take care of all the boring stuff for you in a few simple clicks?

http://labs.engageinteractive.co.uk/nav-o-matic/

04 Jan

Show / Hide paragraph under heading: jquery

Published by Mark W. Breneman

I was looking to make a really simple FAQ page that consisted of questions in h2 headers and answers under the h2s in simple paragraphs. I could not find this exact solution so after a bit of research I made my own.

jquery:

$(document).ready(function(){
$(".faq h2").nextUntil("h2").slideToggle();
$(".faq h2").click(function() {$(this).nextUntil("h2").slideToggle();});
});

HTML:

Pages