Drupal Dump

Drupal Snippets, Hacks and more....

495 posts since 2011

Anatomy of perfect landing page

Sometimes i will post just interesting things for web design in general. For example, this is good link with visual how your front page should look. Unfortionatly not much drupal themes look like this. I only know of this two

Glossify Internal Links Auto SEO vs Link Inteligence

Both of this modules are still work in progress but you can make good use of them. Currently Glossify is my favourite because it links to taxonomy terms when needed. Link inteligence has maybe a bit better perspective and whole architetture behind SEO Tools module looks very promising but when you use it you won't be satisfied so much with results and links it makes, although there is high level of customization present and also bulk generating of links.

Remove new comments link in links section

Often you want to remove something from links section of nodes, best way is to intercept it in template.php and use UNSET on it, for example look here:

 

Use first image in imagefield gallery as teaser image or headline image

When you create imagefield gallery you can easily use first image to set it as teaser image if you use Views and Fields for row style but if you use NODE than you have a problem. Also with views you usually override or make lists of nodes but for full node display you need to use something else like Panels, or you can also try overriding nodes with views but that's not best practice.

CSS for iphone

When you decide to make page for iphone, or maybe just make additional css to change how its views on iphone you should add this code, as iphones ignore other code. With this you set it depending on the size of the screen, so you hide sidebar for all devices that have screen smalled than 480px (widescreen iphone format). More info can be found on linke below

Custom field available data - Views

To find out which fields are available in custom fields in views, put following code in custom PHP field.

print var_export($data, false);

Online site when transfered to offline(localhost) doesn't work

Few times i transfered online site to my localhost and site wouldnt work, no response form page. What i realized is that main problem were cache tables in database. After clearing them everything was fine. Best way to do that would be to use backup and migrate module and just select all cache tables to be emptied in advanced settings and then backup database and import it to your localhost.

Views and Global:Null argument

Today I made a view from which 3 menu links derive, problem was that all had the same title as it was only one view. Way to solve this was to pass argument to view trough Global that would be ignored in query.