
The articles on this page are ComputerMinds' contribution to the Planet Drupal aggregated article feed. Planet Drupal is intended to collate interesting and useful Drupal content from around the web.
There are times when it's necessary to add some additional markup to a particular menu item, for example a link to DrupalMinds might need a strong tag around the Drupal portion. This can be achieved in a couple of ways, both using a very similar theme override. Option 1 The first method is to allow HTML in the title of all menu items - while this is nice and easy, it does mean that you...
A quick one that came up today, we all know about the login redirect module, which automatically redirects the user to a specific page when they login ... but what about at logout? Its a common scenario, you want to display a nice 'come back soon' message when one of your lovely users does the unthinkable and logs out. One solution would be to create a new module, implement hook_user and then invoke a drupal_goto...
By default the Drupal event module will provide a nice calander block, listing the days of the week accross the top using 3 letter abbreviations (mon, tue etc). This little theme snippet will override this default behaviour and display the first letter of each day of the week (i.e. M T W) etc. Pop the following into your template.php file and you should be in business function phptemplate_event_calendar_month($op, $header, $rows, $attributes = array(), $caption =...
TinyMCE has a habit of popping up right where you don't want it - the log field on a node edit page is a good example. Lucklily it is a relatively easy job to theme out tinymce for a particular textarea. The following theme override should go into your template.php file function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) { switch($textarea_name){ case 'nodewords-description': case 'edit-nodewords-description': unset($init); return $init; break; default: return theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running); } } Just...
We have had a few sites recently on which TinyMCE was playing up on narrow themes. The buttons where not breaking onto new lines, causing the TinyMCE textarea to be much too wide. We solved the problem with the following snippet of CSS .mceToolbarTop * { float:left; } .mceToolbarTop select { width:auto!important; } .mceToolbarTop option { float:none; }
Adding new custom regions (areas into which you can place blocks) to a Drupal template is dead easy ... Simply add the following to your template.php file : function YOUR_THEME_NAME_regions() { return array( 'content_top' => t('content top'), 'content_bottom' => t('content bottom'), 'left' => t('left sidebar'), 'right' => t('right sidebar'), 'content' => t('content'), 'header' => t('header'), 'footer' => t('footer'), 'new_region1'=>t('A new region') ); } Make sure you change the YOUR_THEME_NAME bit to match the name of...
Drupal 5.2 was released last night, containing a couple of quite importants ecurity patches and some other minor bug fixes. http://drupal.org/drupal-5.2 We will be upgrading our client's sites over the next couple of days
Just a quick one this - you will probably find that when you use Tinymce and the standard Filtered HTML input format, all your text bunches up and doesn't break correctly. Once solution to this is to use Full HTML - fine for the admin user but not so good for your average member of the great unwashed. So, the solution is to goto admin/settings/filters and configure the "filtered HTML" filter. You then want to...
There is nothing worse than having your browsing flow interrupted by a login screen that does not return you to your origional destination. Drupal manages to get around this problem by allowing you to append a "destination=XXX" query string parameter to the 'user' login URL. This is excellent and works well, except what happens if the user clicks the register tab while on the login screen - the destination query string is lost and the...
Putting together an upload form in Drupal 5 is easier than you think - there are just a couple of things you need to remember ... The form is built like this: function build_upload_form(){ $form['#attributes'] = array('enctype' => "multipart/form-data"); $form['file_upload']=array('#type'=>'file','#title'=>'Filename'); $form['submit']=array('#type'=>'submit','#value'=>'Upload file'); return $form; } And the submit is handled like so, note - the value passed into file_check_upload is the name (terminal array key) of the form element defined in your form building function...