How to add multiple images with text for custom slideshow?
Permalink
HI all
A new client of mine came with an old Concrete 5 CMS and I need to update several parts. Have never heard of Conrete 5, so no idea how everything works. However, the back-end editing seems to be easy.
But I need a slideshow (~3 photos + text). Perhaps I would like the template to produce something like
<ul>
<li><img><span>text</></li>
<li><img><span>text</></li>
<li><img><span>text</></li>
</ul>
I found a slideshow build in, but I can't see how to add text or edit it.
I hope you guys can give me a quick start :) How do I add a field to store multiple images with related text?
(I couldn't find the exact version, but I guess it is old enough to be 5.7, definitely not the current branch)
Thanks all!
A new client of mine came with an old Concrete 5 CMS and I need to update several parts. Have never heard of Conrete 5, so no idea how everything works. However, the back-end editing seems to be easy.
But I need a slideshow (~3 photos + text). Perhaps I would like the template to produce something like
<ul>
<li><img><span>text</></li>
<li><img><span>text</></li>
<li><img><span>text</></li>
</ul>
I found a slideshow build in, but I can't see how to add text or edit it.
I hope you guys can give me a quick start :) How do I add a field to store multiple images with related text?
(I couldn't find the exact version, but I guess it is old enough to be 5.7, definitely not the current branch)
Thanks all!
Many thanks! Yes, the Slideshow is a block and it works. But it can only show a series of images. I need to add a caption to each image.
There is no straightforward way of doing what you want, you're going to have to code your way through it.
First, know that you are using the core "slideshow" block so the files are inside concrete/blocks/slideshow unless
1- your site was updated in which case it will be in the updates folder
2- somebody used an override of your block or a template in which case it's in blocks/slideshow (no "concrete")
Then, when you look at view.php you will see how the slideshow is created, and it's mostly all JavaScript.
You will also see that at the bottom of the view.php file there is a PHP loop using data from $images to create the JS $imgInfos array of object. Then $imgInfos is used in JS to create the slideshow.
One of the lines in that PHP loop is
So $f is a Concrete5 image object from which you can get extra data.
For each image of your slideshow, you would have to add your caption to the image title or description field. That is done from the core file manager in the dashboard.
Then once you have your image object ($f) you get the caption or description from it doing $f->getTitle() or $f->getDescription()
Then you add that text to your $imgInfo array.
Then you modify your JS code to add the caption to the slideshow and write some CSS to make it look good.
Which brings me to the question, and sorry to be blunt, but what kind of wizardry do you use to convince your clients that hiring someone who doesn't know the platform is the best course of action? Seriously, whatever it is please tell me, I want to use it too :)
First, know that you are using the core "slideshow" block so the files are inside concrete/blocks/slideshow unless
1- your site was updated in which case it will be in the updates folder
2- somebody used an override of your block or a template in which case it's in blocks/slideshow (no "concrete")
Then, when you look at view.php you will see how the slideshow is created, and it's mostly all JavaScript.
You will also see that at the bottom of the view.php file there is a PHP loop using data from $images to create the JS $imgInfos array of object. Then $imgInfos is used in JS to create the slideshow.
One of the lines in that PHP loop is
$f = File::getByID($imgInfo['fID']);
So $f is a Concrete5 image object from which you can get extra data.
For each image of your slideshow, you would have to add your caption to the image title or description field. That is done from the core file manager in the dashboard.
Then once you have your image object ($f) you get the caption or description from it doing $f->getTitle() or $f->getDescription()
Then you add that text to your $imgInfo array.
Then you modify your JS code to add the caption to the slideshow and write some CSS to make it look good.
Which brings me to the question, and sorry to be blunt, but what kind of wizardry do you use to convince your clients that hiring someone who doesn't know the platform is the best course of action? Seriously, whatever it is please tell me, I want to use it too :)
Cool, this is helpful. Wasn't expecting that much :-)
Will look at the code now. But, mainly, I was wondering how do I add something like a text field to my images? Or is there some kind of relation (another set of block?) I have to build?
Unfortunately I am not an acquisition Harry Potter :-) No wizards involved.
This is a rather small and old website and not the main site. Thus the client won't invest much into it at this time. I am rebuilding the main site and he wanted me to just add a small slideshow into the header.
Perhaps, I will take time to update the CMS and play with it. Don't get paid for it, but if it looks promising it's worth my spare time :-)
Will look at the code now. But, mainly, I was wondering how do I add something like a text field to my images? Or is there some kind of relation (another set of block?) I have to build?
Unfortunately I am not an acquisition Harry Potter :-) No wizards involved.
This is a rather small and old website and not the main site. Thus the client won't invest much into it at this time. I am rebuilding the main site and he wanted me to just add a small slideshow into the header.
Perhaps, I will take time to update the CMS and play with it. Don't get paid for it, but if it looks promising it's worth my spare time :-)
Files in the dashboard's file manager already have a "title" and "description" field you can edit to your liking. You also can add what is known as attributes. By default, C5 offers file, page, and users attributes. Attributes can be text values, select boxes, other files, dates... ANything.
If you're going to play with C5, I strongly suggest the latest versions, it is a totally different experience.
If you're going to play with C5, I strongly suggest the latest versions, it is a totally different experience.
Thanks mnakalay!
I got it working. Was easy with your help.
Actually I don't know if Concret5 and I fit together. It looks like it is building a lot of content for you. I really do like to be in full control of the output code.
I got it working. Was easy with your help.
Actually I don't know if Concret5 and I fit together. It looks like it is building a lot of content for you. I really do like to be in full control of the output code.
I assume you know how to log in and here's a video for C5's old version showing you how editing content on a page works:https://www.youtube.com/watch?v=Ysmvy7ikcSU...
If the website interface doesn't look like that, then you have a newer version, starting from 5.7. In which case it's pretty much the same but here's an updated video to helphttps://www.youtube.com/watch?v=Y1VmBVffLM0...