Hello again. First off, great module. I've created a custom theme and it's coming along really well. I'm a little green when it comes to PHP and I've been trying to figure out how to make the image clickable and the title of the slide link to the associated node like the "read more" button does.
I assume this functionality would be done in the preprocess functions.
$slider_items[$key1]['slide_read_more'] = l('READ MORE', 'node/' . $result->nid);
$slider_items[$key1]['slide_node'] = 'node/' . $result->nid
I assume the second line of the above code is what creates the link to the node. But I'm not sure how to get the title and image field to link to the node as well. Does anyone have any advice? Thanks.
Comments
Comment #1
ppblaauw commentedI hope you use version 6.x-1.x-rc6.
The l() functions makes the link of the read more button.
First parameter is the link text, the second parameter is the URL to link to
For linking the title to the node you can use
For linking the image to the node you can use
Hope this helps you further, please let me know.
Comment #2
Anandyrh commentedTake a look at this:
http://drupal.org/node/480532
Comment #3
dgautsch commentedThank you everyone for the help. This helps immensely. ppblaauw you do a great job maintaining this module.
Comment #4
ppblaauw commented@ logicalriot
Did you solve your issue?
If you did, can you set the status to fixed.
added tags
Comment #5
jsimonis commentedWhere do you put the code to be able to link the image as well? Is it in place of something?
I've been trying to figure that out and get errors that keep the site from showing.
Comment #6
ppblaauw commentedYou need to replace:
I copied also the last } which maybe causes the issue
Comment #7
jsimonis commentedYea, that's the part I replaced. And I get an error.
Parse error: syntax error, unexpected T_STRING in /home/username/public_html/sites/all/themes/lininger/template.php on line 46
Comment #8
ppblaauw commentedCan you attach your template.php file?, so I can help you better.
Comment #9
jsimonis commentedComment #10
ppblaauw commentedThe code in #1 missed a quote (') after the end of the first <a> tag. Sorry for the mistake. Changed it in #1.
So your template.php becomes like the attached file.
Hope this helps you further, please let me know.
Comment #11
dgautsch commentedComment #13
Sinan Erdem commentedThe code for image in comment #1 works nicely. But it links to unaliased URL. Is it possible to link to an aliased path? Example:
İnstead of "node/34", I need "content/title"
Thanks...
Comment #14
ppblaauw commented#13
You can have a look at the issue http://drupal.org/node/513362
Hope this helps you further please let me know.
Comment #15
Sinan Erdem commentedThe code on the page you have given works perfect! Thanks for your generous help ppblaauw...
Comment #16
ppblaauw commentedWelcome.
Changed issue title.
Comment #18
Sinan Erdem commentedJust a suggestion:
I already did what is told here and it works OK. But after that, I found another solution with just CSS. I just enlarged the area of the "read more" button to include the whole image area with changing the paddings, margins and positions etc. The class I wrote CSS code for is:
div.ddblock-cycle-plain-list30l div.slide-read-more-horizontal a{
}
Now the whole area on the image including the title, describtion etc. links to the node...
Hope it helps someone...
Comment #19
Anandyrh commentedHi,
Check out the below link..., would help you out.
http://drupal.org/node/480532
Regards,
AnANd