Addon Timelines - Question | JoomShaper
Black Friday sale is live with flat 50% OFF. Sale ends soon! Grab your deal now!

Addon Timelines

E8

Easy Connect 83

SP Page Builder 3 years ago

Hello,

I want to adapt the timelines addon for my needs via overriding. How to add in the code of the view the possibility of inserting an image under the date of the chronology?

Thanks

0
8 Answers
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 3 years ago #80214

Thanks a lot.

And congratulation, you made it alone.

0
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 3 years ago #79891

Hi,

yes, you have to override timeline addon. General guide you will find here (tip 7.) >> https://www.joomshaper.com/documentation/sp-page-builder/sp-page-builder-3/how-to-tips

You have to edit both files:

  • admin.php - to add extra media field
  • site.php - to display that media as image

Whole rest is on your hands. As you know code customization is beyond JoomShaper support.

0
E8
Easy Connect 83
Accepted Answer
3 years ago #79912

Thanks.

I started modifying the admin.php file to add the image/alt file, ... fields for each item in the timeline. It works.

But how to call on the front side in the site.php file the url of each image?

Thanks.

0
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 3 years ago #79913

check how it was made inside image addon. Basic php/html

compare code!

0
E8
Easy Connect 83
Accepted Answer
3 years ago #79922

That's what I'm doing. I'm inspired by the Image addon ;)

0
E8
Easy Connect 83
Accepted Answer
3 years ago #79954

I managed to call the first image of the array but not the following via this command: $image_item = $timeline->image; $output .= '<img src="'.$image_item->src.'"/>';

The command is in the foreach loop.

If you can give me a tip thank you.

0
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 3 years ago #79972

Support Policy = No php code/customization help.

0
E8
Easy Connect 83
Accepted Answer
3 years ago #80193

I understand so I will provide the answers. It may help others.

In the admin.php file of the Timeline addon I added this:

'image'=>array(
                    'type'=>'media',
                    'title'=>JText::_('COM_SPPAGEBUILDER_ADDON_IMAGE_SELECT'),
                    'desc'=>JText::_('COM_SPPAGEBUILDER_ADDON_IMAGE_SELECT_DESC'),
                    'show_input' => true,
                    'std'=> array('src' => 'sppagebuilder.com/addons/image/image1.jpg','height' => '','width' => ''),
),

'alt_text'=>array(
                    'type'=>'text',
                    'title'=>JText::_('COM_SPPAGEBUILDER_GLOBAL_ALT_TEXT'),
                    'desc'=>JText::_('COM_SPPAGEBUILDER_GLOBAL_ALT_TEXT_DESC'),
                    'std'=>'Picture',
                    'depends'=>array(
                    array('image', '!=', ''),
                    ),
),

between the lines 'content'=>array(...) and 'date'=>array(...)

This allows the admin side to have 2 additional fields per item: a file field and an Alt field for the image.

On the side of the site.php file that i overide i have added these lines:

$image_timeline = isset($timeline->image) && $timeline->image ? $timeline->image: '';
$image_timeline_src = isset($image_timeline->src) ? $image_timeline->src: $image_timeline;

$output .= '<img src="'.$image_timeline_src.'" alt="'.$timeline->title.'">';

after the foreach loop to display each image of each item.

I have not yet succeeded in recovering the ALT variable of the image so by default I recover the title of the item.

Have a good day

0