You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#113191 Can't get Mediabox 2 working in own component

Posted in ‘Mediabox’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Thursday, 09 March 2023 15:04 GMT

loft33
How can I get JCE Mediabox 2 working in my own component? I can't get it to load images in a popup. It adds the zoom icon, so I guess it's loading, but all images just open in a new window.
I've tried

<a class="jcepopup" data-mediabox="1" href="https://www.joomlacontenteditor.net/<? echo $imgURL; ?>"><img src="https://www.joomlacontenteditor.net/<? echo $imgURL; ?>" alt="Screenshot"/></a>

as well as

<a class="wfpopup wf-zoom-image" href="https://www.joomlacontenteditor.net/<? echo $imgURL; ?>"><img src="https://www.joomlacontenteditor.net/<? echo $imgURL; ?>" alt="Screenshot"/></a>

as well as

$cpex = '<a class="jcepopup" data-mediabox="1" href="https://www.joomlacontenteditor.net/'.$imgURL.'"><img src="https://www.joomlacontenteditor.net/'.$imgURL.'" alt="Screenshot"/></a>';
echo JHtml::_('content.prepare',$cpex);

But neither seem to work. JCE Mediabox is set to load on the component page (and does afaik).
It does work in regular articles.

Ryan
But neither seem to work. JCE Mediabox is set to load on the component page (and does afaik).
It does work in regular articles.


Please post a link to an example page.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

loft33
Here

There's 3 images under the media tab.

Attachments

Ryan
Mediabox is initialized when the page loads. If you load content dynamically, then any popup links in that content won't be initialized. You need to re-initialise MediaBox so that it will convert popup links in the dynamic content. You can do this by running the script:

WfMediabox.create();
or you can also specify exactly which items to create as popups, eg:

WfMediabox.create(jQuery('a[href]'));

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.