Drupal Dump

Drupal Snippets, Hacks and more....

495 posts since 2011

Views Arguments validation "Gotcha"

People usually set argument and often don't mind about validation. Just leave basic validation thinking most will pass. But that is not the case. For example you can use User ID ad argument and think both UID and User Name would pass, but that is not the case. You have to go and select "User" Validator and use "Allow both numeric UIDs and string usernames" for this to work.

CSS in IE8 list tag(LI) in one row

I just encontured stupid problem with IE and listing LI tags in one a row, If you want to list them properly and not skip into second you need to add some
white-space: no-wrap; to work to LI or in fact A tag inside LI. Those having that problem will know what I am talking about.

Theming filters in Views 2.x differently

Most will use views 3.x in future and they should as they are really better, from UI point of view to other parts but for some old sites that are not updated and you want to theme exposed filters differently, you can't from default. You need to change some template as all your filters have the same classes.

Views Fluid Grid - jQuery Masonry Fix for images

There is a great module currently to simulate pinterest tiles on drupal views. Unfortionatly it's not properly maintaind and most import thing, image tileing is currently not working.

Converting Date timestamp to proper Date

If you have some variable in your node object or somewhere else like [created] = 1328281634 then you need to convert this to date format you like, so you can do it
with line like this, where you choose custom date format

format_date($timestamp, 'custom', 'D, j M, Y \a\\t G:i' );

or use some predefined date format on your site like

Imagecache output in template.php

Sometimes when theming on some level you need to output some image through imagecache, so here is how to do it. Usually in some function in template.php you will write this

Fusion theme classes for node add and node edit pages

I almost always use Fusion theme as my base theme, one thing its missing and developers of it seem not to care is a class that is in body and is different for node add and node edit pages, so I usually go to template.php and around line 64, after

Box Shadow in IE7 and IE8

Finally in IE9 MS started to support proper and useful CSS tags. But at this moment in time you still need to have support for IE7 and IE8. So If you want to make some nice box shadows, you are in a problem. Luckly this page comes to help http://css3pie.com/
works as it should, donate to those people, they made your life much easier :-)

Facebook-style Micropublisher change link of attachment

Facebook-style Micropublisher works great with Facebook-style Statuses and is one of the coolest "new" drupal modules. Statuses are lightweight for database but statuses also can have their own page like nodes. Problem is that in my case this is not out of the box solution. So again i made some hacking :-)