Addon Timelines - Forum | JoomShaper
Solved SP Page Builder

Addon Timelines

Asked by Easy Connect 83 4 years ago Last activity 4 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

Accepted answer

Marked as the solution
Paul Frankowski Senior Staff

Thanks a lot.

And congratulation, you made it alone.

7 more replies

Easy Connect 83 Asked this

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.

Paul Frankowski Senior Staff
4 years ago · edited

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

compare code!

Easy Connect 83 Asked this

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

Easy Connect 83 Asked this

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.

Paul Frankowski Senior Staff

Support Policy = No php code/customization help.

Easy Connect 83 Asked this
4 years ago · edited

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' => 'https://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

Log in to reply.