How to call for image caption?

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
jakovbak
Forum Members
Forum Members
Posts: 225
Joined: Thu Dec 13, 2012 2:54 pm

How to call for image caption?

Post by jakovbak »

Hello everyone!
I want to call for image caption on img:hover but by coding abilities are not up to this task. So, if anyone can help I would really appreciate it!

This is my current situation:

- There is one 'content block' for general informations on the certain project and four 'content blocks' for images with caption;
- Client wants to be able to change images and captions via Content Manager;
- They want caption to be visible only on img:hover state;

The code looks like this:

Code: Select all

<div class="view efffect">
	<div class="reference-image">
		{content block=photo1}
	</div> 
	<div class="mask text-center">
		<h3>{title}</h3>
		<h4>{ ????? }</h4>
		<a href=" ????? " data-gallery="prettyPhoto"><i class="fa fa-search-plus"></i></a>
	/div>
</div>
There are two problems to be solved and I think the easiest way would be to write a simple UDT and place it where question marks are:
- one for caption call;
- one for another image call in "prettyPhoto" link (since double content block is not allowed).

Looking forward to see how to do it and thank you in advance!
Best regards to all,
jakovbak
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: How to call for image caption?

Post by velden »

What about:

Code: Select all

{content_image block=image_1 assign=image_1 label="Image 1"}
{content block=image_caption_1 assign=image_caption_1 label="Caption image 1"}
...
https://docs.cmsmadesimple.org/tags/cms ... tent_image

Note that it's not guaranteed the blocks will be displayed in Content Manager in the same order as you define them in the template (test it please).
jakovbak
Forum Members
Forum Members
Posts: 225
Joined: Thu Dec 13, 2012 2:54 pm

Re: How to call for image caption?

Post by jakovbak »

Hello velden and thank you for your response!
If I put this {content_image block=image1} or this {content_image block=photo1} it delivers "Error retrieving file list" instead of an image. There is no prompt for choosing image either. However, both tags do deliver TinyMCE frame for 'Caption'. At the same time, this

{content block=photo1_caption assign=photo1_caption label="Caption image 1"}

does not deliver caption text on img:hover. Furthermore, it does not create anything within my <h4> tag.

I have tried with ' and " inside the tags but no difference.
Still stuck.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: How to call for image caption?

Post by velden »

For content_image you need to supply the dir parameter I assume, it's in the help (link I provided)
{content block=photo1_caption assign=photo1_caption label="Caption image 1"}
This will assign the text to the smarty variable {$photo1_caption}
I prefer to define the content blocks like this and use the variable later on in the script.

To prevent wysiwyg use oneline=1 or wysiwyg=0 (or something like that, it's in the help of the content tag)
jakovbak
Forum Members
Forum Members
Posts: 225
Joined: Thu Dec 13, 2012 2:54 pm

Re: How to call for image caption?

Post by jakovbak »

Stupid me... :-[
I've seen there is dir parameter in Help but since only block parameter was listed as 'required' I din't pay much attention to it...
But, it might be another issue thou: Client wants to store images (for his own convenience) in separate folders - one folder=one project. I'll make a test if it works with parent folder path and get back with the results a bit later.
Thank you again!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: How to call for image caption?

Post by velden »

Locked

Return to “The Lounge”