Tag Archives: code

Twitter Cards

As you may or may not have seen in the Twitter feed on the homepage, I’ve been having a devil of a time figuring out Twitter Cards, which are awesome and head-bang-y all at the same time. Adding a headline and image to a tweet that DOESN’T count towards the 140 character limit is pretty awesome, but figuring out why the description wasn’t also showing up was, well, troublesome.

Fortunately, thanks to this lovely website, I now know there’s a card type called “summary_large_image”, which fixed my problem lickety-split! Funny how none of the other websites I’d been researching on had thought to mention it. Hmph.

Take THAT, z-index! Pyew! Pyew!

Solved a bitch of a coding problem that I’d wasted way too much time on before Christmas. It was a CSS problem where a tooltip box couldn’t transcend its parent div’s z-index, and therefore kept falling behind the neighboring div. I spent a lot of time trying to figure out how to raise the child above the parent, until someone else needed help with an onmouseover, and bam! The answer hit me–elevate the parent.

<div onMouseover="this.style.zIndex = 100" onMouseout="this.style.zIndex = 1">

Ta da! Problem fixed. Woo!

Kicking Drupal ass today

It’s Drupal day again, and import data problem continues to piss me off (migrate refuses to pass properly export my tables to View, and eventually just stopped importing my table rows at all; and node-import keeps failing at step 7, line 668). So instead of beating that dead horse some more, I moved on to problems I could actually solve, and solve them I did!

First, the breadcrumbs. I needed to a) include breadcrumbs, and b) style them to match the design. I used the Menu Breadcrumb module to solve the first problem, so that the breadcrumb would draw from Primary Links instead of Navigation. For the second, I first turned to Pro Drupal Development by John K. VanDyk–page 181 had the advice I needed, i.e. to add the following function to my theme’s template.php to change the breadcrumb separator from ‘>’ to ‘: :’ :

function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return ''. implode(' : : ', $breadcrumb) .'';
}
}

But that wasn’t enough. I needed to remove “Home” as the first item of the breadcrumb, so I changed the above code to this:

function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
unset($breadcrumb[0]);
return ''. implode(' : : ', $breadcrumb) .'';
}
}

And that fixed that problem! The rest was just updating the css in the breadcrumb call in my page.tpl.php file:

For some reason, my css wasn’t working on the “: :”, so I fonted them, but otherwise this worked perfectly! Breadcrumb success!

Except, then the client wanted the breadcrumb changed for one content type. No problem!

(shoot, can’t put the code here without serious edits, due to its extreme php-ness. Damn! But there’s good info on hiding blocks for specific node types here.)

Seriously, I was on fire today!

Next problem, the drop down menus were appearing under the flash slideshows on six pages. I thought it had something to do with Nice Menus, but after much googling, I found the fix to this was actually in the Flash embed code, so I added this code to the swfobject code for each:

so.addParam("wmode", "transparent");

And those are the things I fixed today. Woot!