By Vic96 on
I've got image/imagefield/imagecache and CCK installed. I've created a view which displays a story's teaser text and the thumbnail image created with imagecache. The image is below the text. I need it to be next to the text like you can see on http://libcom.org/news . This person has come up with a solution at http://drupal.org/node/82473 but that was for an older version. Is there a way to handle this with CCK?
I also need the 'thumbnail:' label to disappear. Can some expert here guide me. Thanks.
Comments
to remove the thumbnail
to remove the thumbnail label, go to content types>>display fields and change the label as hidden instead of above or inline
Live hard, Ride harder
You just need to edit
You just need to edit node.tpl.php to include your cck field. Wrap it in div and give it a css float:left property. If you need any further help, I can post you my piece of code. This way you can add caption field as well.
float image to left
If you could post your code, I'll appreciate it. I'm not an expert at PHP and it would be very helpful. Thanks.
Here it is
Here it is :
(node.tpl.php)
As you can see, I have separated body and teaser, for easier control.
In (teaser) line
I have used News Photo and News Caption fields, just change with the name of your fields. field_news_photo[0] means first photo in your post, field_news_photo[1] would be the second etc. Same goes for body. Now just add appropriate css to your style.css. Mine is:
You got the idea. Just adjust to your needs.
Hope this helps.
Please help me... I'm an absolutel newbie too
I have cck installed with image_field and I use a modified version of the Garland theme. I have tried to adapt your code to my needs, but I guess I'm not smart enough... I can't get my image to show up inline. I tried Contemplate, and I can do it quick and dirty by using tables (I have), but it is not really pretty (see http://yourgametap.com, games list)
Here is the contents of the node.tpl.php file:
This is my contemplate code:
Now how would I adapt your code to create a proper inline image instead of using a table? Thanks ever so much in advance, any help is really appreciated.
----------
http://yourgametap.com - Your Ultimate GameTap Games Reviews Site
Please help me... I'm an absolutel newbie too
Done it again... double post :)
----------
http://yourgametap.com - Your Ultimate GameTap Games Reviews Site
Simply ... Go to [Content
Simply ...
Go to [Content management] > [Content types] > [Manage fields] and make sure yiour image field is LIGHTER than [body] eg -2
this will force the image above your teaser but not yet inline
then go to modules > system > defaults.css
and add
.field-type-image img {
float: right;
margin-left: 1em;
border: 0px solid red;
}
nb - my cck image field is called "image" and I choose to float it right, adjust yours accordingly
see www.venturacottage.com for the result
Regards
Joe
How come i cannot find
How come i cannot find modules>>system>> default.css. I do not have a system module, do I need to install it? thanks
Live hard, Ride harder
Thanks artatac, i just
Thanks artatac, i just pasted your CSS code as it is in my theme's style.css and i am done. Now i am getting inline images.
------------
Volvo, Video, Velcro. (I came, I saw, I stuck around.)
Hi Encho, This is stunning
Hi Encho,
This is stunning ... it's been days trying to make this work.
I've included your code exactly, and have created a thumbnail and largeimage in content as an image field.
That's all good, but the images are below the article .. please how do I float left the thumbnail and the large picture.
Would most appreciate any help, and thank you.
Lilian
hello, I have been using
hello,
I have been using encho's solution as well, but the problem is that now the thumbnail shows up twice, once in the content and once because i of the solution above. I only want it to appear next to the title, and not in the content. How can that be done?
thanks!
Matt
u find a fix for this? i
u find a fix for this? i have the same problem
the code
Try excluding the:
if ($picture) print $pictureAlso this code is meant to work with cck/imagecache combination
Thinkk about this
Will do.
Solved
A good way to do this is as follows:
First, you want to set up your Display Fields so that the correct imagecache preset is chosen for the teaser. However, you should click 'Exclude' for both the teaser and the full node. This will mean that the preset will be rendered in the node object but not added to the $content variable.
Then, add the following function to your template.php:
If you wanted to do this only for the teaser, say, then you could only add this if $variables['teaser'] == true
Don't forget to refresh the Theme Registry to test!