tags:

views:

77

answers:

4

I'm using Drupal for the first time for a project at work. I'm finally getting my head wrapped around some of the core concepts, but when it comes to customizing output I'm unsure of how to proceed.

I have to build a fairly specialized image gallery. I've managed to cobble something workable together using Views2, but it's not quite where it needs to be. I'd like to write it from scratch, using SQL and actual PHP, rather than working through this web UI.

I figure I'll put this functionality in a new module. Is that right? Or is that an abomination to the Drupal world?

Edit:

Here's what I've got so far. I've created Image Gallery and Image content types with CCK. Images can be assigned to multiple galleries, via nodereference. I've got imagecache creating two sizes for each uploaded image - a thumbnail size and a gallery size.

Two gallery formats are required, but let's assume I'm going to have a carousel style for now, with some custom JQuery and CSS to match the rest of the site's look and feel. Clicking a thumb in the carousel-style navigator will load the full sized image above it.

Now, assuming such a thing does not exist, what is the recommended approach for creating it? Not how to code it, but where would this code live within the Drupal system?

A: 

Well since it is free software you are free to do (almost) whatever you want with it.

A good practice to decide if you should do it is:

Will the benefits that I will get from a custom module divided by the time I'm going to invest in it. Outweigh the benefits / over time of a solution that isn't ideal?

Or if you prefer to look it this way:

Custom Development Benefits             Not 'ideal' solution benefits
---------------------------    >    -----------------------------------
      Development Time                      Time to install and adapt

Since normally the Time to install and adapt normally is smaller than the time to develop something from scratch, the common conclusion is to just use what is already there.

But by all means if you want to develop your own thing and have enough time, go ahead.

elviejo
+1  A: 

Yep, I'd put this in a module. I often wind up writing custom ones for specialised use cases.

ceejayoz
+4  A: 

It seems like views will do the job of creating the data you need - a list of all the images for the galleries, based on whatever criteria you need (taxonomy,author or whatever) and that the carousel part - adding the jquery and css could be done by using drupal's themeing system to change the output. So as ar as 'where would the code live' I would say in your theme, rather than a module.

The views theming system is pretty comprehensive, if possibly a little overwhelming at first. This looks like a good starting reference: http://www.group42.ca/theming%5Fviews%5F2%5Fthe%5Fbasics

Andrew
It might be a custom module, in the sense of a "glue module" to theme a combination of CCK Fields and Views together. A new module that replicates the structural functionality of a gallery would be redundant.
Grayside
+2  A: 

You can do this. Views is great but will often only get you 90% of what you need out of the box.

You can do views theming, which can take you further, and you can write extentions to the views functionality (but that is not always easy).

There is nothing wrong with writing your own module in stead of views, in some cases it can increase performance. One tip if you are doing this is that you can see use the query that views creates in your custom module, this can save you having to work it out and write it yourself.

Jeremy French