Database repair with phpMyAdmin

Sometimes your drupal DB will have problems, and it will cause slow queries, especially when having many nodes. Log to you phpMyAdmin and select all tables in DB and click optimize or repair, this could fix many problems and make your site run smooth again.

User import/Node Import, UTF characters and Excel

Many have encountered this unicode/utf encoding problems in their programming life. It is just a drag to make it right and without knowing all the stuff around it and understanding it you will have bugs and problems. You will usually import data to drupal with CSV files. It's fine until you start using non english alphabet.

Node loading, simple variable passing to flash banner

So in previous post with made drupal custom block now lets make custom block with flash banner where data to banner is passed from node that has CCK fields.Make content type with 4 cck text fields, or just use one field, even body can do and then you can manauly manipulate string with PHP, just have some separator in your input.

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.

Setting a form value with jQuery

If you want to select form value, for example hidden field for subject in mail form you can set the form values with jQuery using the val() function.

If the form element is <input id="subject" name="subject" type="hidden" value="someweb.com" /> you set it with  $('#subject').val(itemId);

so put it in function