I would like to create a slideshow block which is the same as the one in the left block with title "Example sites" at http://ddblock.myalbums.biz/. I can create slideshow without any problem, but I would like to get rid of the "Read more ..." button and the slide text completely, and also would like that if I click on an image in the slideshow, I will be led to the node. I cannot find any instruction to accomplish what I would like to do. Would you please explain to me how I can create such a block with title "Example sites" at http://ddblock.myalbums.biz/? Thank you in advance.

Kit

Comments

ppblaauw’s picture

Status: Active » Postponed (maintainer needs more info)

The example sites slideshow block the ddblock.myalbums.biz is a basic slideshow with a link to other pages.

The tutorial: How to create a basic dynamic display block image slideshow with links to other pages explains how you make a slidshow like the example sites slideshow.

Hope this helps you further, please let me know.

franceslui’s picture

Thank you for your quick response. However, I need to use advanced slideshow because each image is in its own node. Would you please tell me how I can create advanced slideshow with the same features as the left block with title "Example sites" at http://ddblock.myalbums.biz/?

ppblaauw’s picture

Have a look at the: How to create a basic dynamic display block image slideshow with links to other pages tutorial how to link other pages. ( you can use that for the imageslide also) There are support request in the issue queue asking the same(linking from an image, search on all issues, including the closed ones). Have a look there.

Time to go home here, sorry.

Hope this helps you further, please let me know.

ppblaauw’s picture

The other issue about linking to a node from the image in the slide is: How to link slide to a custom node?

Hope this helps you further, please let me know.

franceslui’s picture

Thank you for the link. I have followed http://drupal.org/node/480532#comment-1666436 to use the following:

            $slider_items[$key1]['slide_image'] =
            '<a href="' . check_url($result->node_data_field_pager_item_text_field_url_value) . '">' .theme('imagecache',
                  $vars['imgcache_slide'],
                  $filepath,
                  $result->node_title). '</a>';
          }
          else {         
            $slider_items[$key1]['slide_image'] =
              '<a href="' . check_url($result->node_data_field_pager_item_text_field_url_value) . '"><img src="' . base_path() . $filepath .
              '" alt="' . $result->node_title .
              '"/></a>';    
          }     

The link of the image is just my website's root (i.e. http://www.mywebsite.com).

If I use your code from http://drupal.org/node/482214#comment-1666504

        if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
            $slider_items[$key1]['slide_image'] =
            '<a href="node/' . $result->nid . '">' . theme('imagecache',
                  $vars['imgcache_slide'],
                  $filepath,
                  $result->node_title) . '</a> ;
          }
          else {         
            $slider_items[$key1]['slide_image'] =
              '<a href="node/' . $result->nid . '"><img src="' . base_path() . $filepath .
              '" alt="' . $result->node_title .
              '"/></a>';    
          }         
        }

The link of the image is correct. However, the link looks something like http://www.mywebsite.com/node/18. I prefer to use its alias. Is it possible?

Kit

ppblaauw’s picture

Status: Postponed (maintainer needs more info) » Needs review

Yes, it is possible to get the alias from the path module.

Edit: Looked again an I think it's a little bit more complicated. (Don't use the code)
Will try to find another solution

You can use the following code:

        // get alias from node if available
        if (module_exists('path') && path_load($result->nid)) {
          $path = path_load($result->nid));
        }
        elseif (isset($result->nid)){
          $path = 'node/' . $result->nid;
        }
        if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
            $slider_items[$key1]['slide_image'] =
            '<a href="' . $path . '">' . theme('imagecache',
                  $vars['imgcache_slide'],
                  $filepath,
                  $result->node_title) . '</a> ;
          }
          else {         
            $slider_items[$key1]['slide_image'] =
              '<a href="' . $path . '"><img src="' . base_path() . $filepath .
              '" alt="' . $result->node_title .
              '"/></a>';    
          }         
        }

Hope this helps you further, please let me know if the code works.

franceslui’s picture

Thank you for your reply. The argument for the function path_load is pid but not nid. So, your code does not work. Would you please give me further help? Many thanks.

Kit

ppblaauw’s picture

Status: Needs review » Postponed (maintainer needs more info)

Yeah saw this later.

You can also search yourself to find a solution for:
How to get the path of a node when you have the nid?

It's not really Dynamic display block module related.

ppblaauw’s picture

Status: Postponed (maintainer needs more info) » Needs review

drupal_get_path_alias($path, $path_language = '') is a better candidate

        // get alias from node if available (not using language settings)
        $path = drupal_get_path_alias('node/' . $result->nid);
        if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
            $slider_items[$key1]['slide_image'] =
            '<a href="' . $path . '">' . theme('imagecache',
                  $vars['imgcache_slide'],
                  $filepath,
                  $result->node_title) . '</a> ;
          }
          else {         
            $slider_items[$key1]['slide_image'] =
              '<a href="' . $path . '"><img src="' . base_path() . $filepath .
              '" alt="' . $result->node_title .
              '"/></a>';    
          }         
        }

Hope this helps you further, please let me know.

franceslui’s picture

Status: Needs review » Postponed (maintainer needs more info)

Thank you for your further help.

Actually, before I asked you if it was possible to use alias, I have done some research myself and tried to use drupal_get_path_alias() to write my code similar to your suggested code above, but I was not successful.

I tried again using your code and had the same problem. Finally, after some experiment, I could solve it by adding

'/' . 

in front of drupal_get_path_alias().

So, the complete working code is as follows:

        // get alias from node if available (not using language settings)
        $path = '/' . drupal_get_path_alias('node/' . $result->nid);
        if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
            $slider_items[$key1]['slide_image'] =
            '<a href="' . $path . '">' . theme('imagecache',
                  $vars['imgcache_slide'],
                  $filepath,
                  $result->node_title) . '</a>' ;
          }
          else {        
            $slider_items[$key1]['slide_image'] =
              '<a href="' . $path . '"><img src="' . base_path() . $filepath .
              '" alt="' . $result->node_title .
              '"/></a>';   
          }        

Thank you again for your generous help.

ppblaauw’s picture

Title: How to create a block similar to the left block with title "Example sites" at http://ddblock.myalbums.biz? » How to link from slide image to a node using node alias in an advanced slideshow?
Status: Postponed (maintainer needs more info) » Fixed
Issue tags: +Advanced slideshow, +preprocess functions

Thanks for the working solution.
Change the issue text, so it is more useful for other users.
Set status to fixed
Added tags

giozzz’s picture

hello, since I have the same issue, I post here: I have read everything, but still can't understand: where should I put the code wrote in #10????? I hope to find some help cause I'm totally clueless..thanx!

franceslui’s picture

Hello giozzz,

You need to put the code from #10 to the template.php file of your theme.

To fully understand, you need to read the Advanced slideshow tutorial at http://ddblock.myalbums.biz/node/747. Specifically, in http://ddblock.myalbums.biz/node/765, it explains how preprocess functions are placed in the template.php file of your theme.

I hope it helps. Wish you all the best.

Kit

giozzz’s picture

hello kit and thanks for your help! I finally managed to make it work, adding that slash ( /.) where it should be put. now I've the advanced ddblock slideshow with the pager button linked to every node, even with renamed urls with pathauto!

thank again for all the support, and for creating and sharing this module, which works wonderfully and looks perfect on my site!!!! drupal rocks!

Status: Fixed » Closed (fixed)
Issue tags: -Advanced slideshow, -preprocess functions

Automatically closed -- issue fixed for 2 weeks with no activity.