Skip to main content

Posts

Showing posts with the label PHP

Theming fckeditor to work with Marinelli Drupal Theme

Marinelli, a nearly flawless Drupal theme has one major flaw. It is not optimized to work with the fckeditor WYSIWYG editor. There are others as well. Some googling located some good tips for configuring modules/fckeditor/fckeditor.config.js to work with Marinelli on http://drupal.fckeditor.net/tricks . This solution is good, but it doesn't work well in multi-site situation or if more than one theme is enabled. Here is a simpler solution: Go to admin/settings/fckeditor and select "edit" next to the profile you want to fix. Make sure under "Style and template files" your Editor CSS is set to "Use theme CSS" Under "Advanced Options", find "Custom javascript configuration" and paste the following: FCKConfig.BodyId = "primary"; FCKConfig.BodyClass = "singlepage"; FCKConfig.EditorAreaStyles = "body{background:#FFFFFF;text-align:left;font-size:0.8em}"; Spank "Save" If you are running...

Using Drupal Feeds Module to Import Content from MS Access

Feeds works brilliantly, but there is a couple weird gotchas when working from MS Access to Drupal that are worth documenting: Seems self-explanatory, but since you are importing as .txt or .csv make sure you remove all carriage returns .  In MS Access this involves writing an update query and doing a replace on all Chr(10) and Chr(13).  e.g. Replace(Replace([myfield],Chr(10),"<br />"),Chr(13),"<br />")   Although CCK Date fields import perfectly as MS Access dates, published dates do not.  This is because the published field in Drupal is a Unix Timestamp which is a quite different than Access dates.  The easiest way I know to fix this is to export your data to Excel and then use the Excel integer date value to convert to a Unix Timestamp. We've all seen this right?  That really long integer you see when you misformat a date?  Anyway, to fix you need to first account for the difference between the start dates of the two time systems and ...

Working with Views Templates in Drupal

Working with Views can be a little confusing for anyone new to Drupal. Don't get me wrong, Views is an absolutely brilliant piece of programming (thanks merlinofchaos!), but there are so many options that finding the correct toggle can be daunting. And no matter how brilliant, eventually you'll discover you've outgrown all available options in rewriting and variable usage and you need to figure out how to modify values via php. The answer? Views templates. And Views helps you out there too! And How For this example we are going to focus on one specific problem: creating a list of image thumbnails. In our hypothetical we have extended a node type via cck to include an image upload called [field_image_value] that we display when viewing the full node.  When each node is created a thumbnail is auto-created via the IMCE Plugin on upload. We've given them a suffix of _thumbnail such that our-image-filename.jpg becomes thumbnail our-image-filename_thumbnail.jpg . ...