I have been trying to do this with cck for a while now but I am having some problems. I am trying to create a content type which will be a link to another site. The intention is for them to be affiliate type links that I can add to the site but could later maybe be used as payed links by a user. I found http://drupal.org/node/60530 and I want to do a similar thing. The article references flexinode which as far as I can make out is now gone in favour of the cck (I hope). So I tried to create it with cck and to be fair got the different elements I need. I have a content type called affiliates with a link field and an image field but I cannot make them into an image link.

Is there a way to make this happen through cck or does this require a module (new content type) to do.

Comments

Anonymous’s picture

You should be able to create a list of however many 'ad' nodes you want. If you set the view type to 'list view' and select the appropriate imagefield in the 'Fields' options, you should get a listing of just the images. You can add the link field in as well if you like. If you want the image to be externally linking to the link field's url, then that will require some custom theming. With the imagecache module you can even have the images scaled and/or cropped to the size you need.

If you describe exactly how you want the ads to work, I can give you more details.

-Mike Goodwin
http://www.not2us.net
http://www.redleafmedia.com

Anonymous’s picture

By the way...you are correct that CCK replaced flexinode

-Mike Goodwin
http://www.not2us.net
http://www.redleafmedia.com

leonglass’s picture

Thanks for replying.

I have got to the point where I can output the items I need (with fields) with a view and it is advice on the custom theming bit I need. Yes I do want the image to be externally linking to the url field. Is this going to be a case of node-content-type.tpl.php and creating the page exactly as I need it or would it be better to use contemplate (just installed it and like the look of it).

I want the ads to work as a content type that can be selected (only admin originally but later may allow a user to post a link as a chargeable item). The user enters the link details (currently using link.module) having to input the title and the url. They also have to enter the image details (currently using imagefield) which uploads the image. I am also currently using a seperate text field for a site description instead of the body. The body pulled everything in and all I wanted it to hold was the description but when I added it as a field it reproduced all elements of the type two of which I had already added through fields.

So all I need initially is to replace the link title with the img tag of the image. I would very much appreciate your advice on how to do this.

Anonymous’s picture

There are several way that this can be done. You can create a custom node-content-type.tpl.php, as you mentioned. You can use a print_r($node) statement in the file to show you what is available to you as a themer. You can then organize those parts as you wish...writing HTML with the image src and link href being supplied via PHP.

You could also use Contemplate, as you mentioned. Contemplate does something similar to creating a custom node template. It just stores the information in the database rather than in an actual template file. One nice thing that Contemplate does is show you the available variables. This is similar to using the print_r() function with a custom template. I actually use contemplate occasionally just to see the available variables. Another nice thing about Contemplate is its ability to affect the node's look for teasers and RSS feeds.

-Mike Goodwin
http://www.not2us.net
http://www.redleafmedia.com

leonglass’s picture

I managed to do this and you can see my attempt here.

In the end I used a content template to replace the title and made my view display full nodes.

Amix’s picture

I needed a simillier feature on drupalbased.com. I simply used Contemplate module to achieve this.
__________________________________________________________________________________
www.DrupalBased.com - Showcasing Drupal Powered Sites.