0

As a novice in Drupal php & hooks, I have a question about content type. It is all about Drupal 7 with all up-to-date modules installed.

I have a content type for hotels (about 400 hotels). This content type has lots of fields. One of field is for image (unlimited values). I have user request for image slider in this content type based on images from another node (same content type). Some kind of “We also recommend..:”

My approach was with Advanced Link module where user can enter link to node and this link is then show as field in view (I have view to catch this). Programmatically, I’m then able to take nid from that link and extract image I want from node. But now I’m stuck with putting this image dynamically into this view. Is this approach good anyway?

In the beginning I was thinking about to add textarea field to content type and give a user ability to insert image from server (image that is already uploaded) with ckeditor uploader. Only problem with this approach is that all images names from hotel node are in special format (TH-023.jpg…), so they would be in big trouble to find image.

My second thought was to write a module to push image into some kind of field inside content type, immediately after user get link from advanced link field (in edit state of content type node). Is this possible?

Anyway, what would be the best way to do this?

Thanks in advance.

2

I presume that the "We also Recommend" is manually entered by the user and that you are not using any specific logic to do it.

If that is the case then your approach would be to add an entity reference field in the content type and reference the nodes you want from there.

Once you have that setup you can create a view to get the images from the nodes related the current view using relationship.

If you don't want to add the recommendations manually the you can use taxonomy to categories the contents and then display the images from the nodes tagged with the came taxonomy term.

  • Thanks for your suggestion. Yes, ‘we also recommend’ will be manually entered by user. I was ‘sniffing’ around this module. So, I will try this out. – innundo Jan 25 '13 at 10:51
  • I personally feel you are going the wrong way with advanced links. But if that works for you then well and good. there are different ways to get the same result in drupal and that is the beauty of it :-). I have updated the answer to get you to automate the process as well. – Mohammed Shameem Jan 25 '13 at 10:58
  • Yes, taxonomy beauty is all over the site, in search and some other image sliders. But this task is based on targeted and manually entered values (references), so it is kind of different and new to me. After 2 days of foggy googling this suggestion is 5+. Thanks – innundo Jan 25 '13 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.