Is it possible to replace links in component...

Search
Other Pre-Sale questions
Forum

Is it possible to replace links in component solidres with modals using rereplacer and modals?

Manos Mantzas's Avatar Manos Mantzas
Hi,

I have used both rereplacer and modals before so I have managed to make them work fine for my projects.

Recently, I tried to use rereplacer and modals to replace solidres component's links ( www.solidres.com/ ) to Terms of Service to a modal tagging, however it didn't work. I also altered the code and added the links to modals tag, however that just shows the tag code on the screen. Is it because I used the free versions of the extensions, or this is not possible? PS: I added a modal tag in an article and it worked fine. I would gladly purchase them extensions if there is the possibility to make this work.

Thank you in advance.
Peter van Westen's Avatar Peter van Westen ADMIN
It is probably due to the system plugin ordering. Try changing the ordering of the plugins in question.
See: regularlabs.com/blog/242-plugin-order-is-important
Please post a rating at the Joomla! Extensions Directory
Manos Mantzas's Avatar Manos Mantzas
Hi Peter,

Thank for getting back to me.
I played around with the plugin ordering but it didn't seem to work, so I bought your bundle offer, in order to use Modals Target Blank Auto-Convert. Here is my configuration: nimb.ws/V67sdM
The thing is that it still opens links in new tab. Could you please shed some light here?
Confidential information:
(hidden)

Thank you in advance. 🙂
Peter van Westen's Avatar Peter van Westen ADMIN
As far as I can see you are trying to open facebook and Instagram inside the modals.
For me, the modal popups do open, but the websites inside do not load.
This is because these external websites have code that prevent you from loading them inside an iframe on your site. This is a security thing that you cannot get around.
Maybe facebook and Instagram offer special 'embed' URLs for this use. But I don't expect so.

In other words: You cannot open facebook and Instagram pages inside modal popups on your website.
Please post a rating at the Joomla! Extensions Directory
Manos Mantzas's Avatar Manos Mantzas
Hey Peter,

I apologize for the confusion. Obviously I don't want the social media pages to open into a modal window.
Could you please check out the video I made? These are the only two links I want to open with modals (Privacy Policy and Booking Conditions), in component solidres:
Confidential information:
(hidden)

Thank you in advance. 🙂
Peter van Westen's Avatar Peter van Westen ADMIN
It looks like the content of those parts is loaded by the booking component through javascript (ajax).
The links are therefore not in the HTML output on pageload, and Modals cannot find them.

The only way to get that to work, is to have those links contain the necessary modal_link classname. And then trigger the Modals init() function through javascript after the content with those links is loaded into the page.

That requires some work on the component. Can maybe be done via a template override. Not sure.
Please post a rating at the Joomla! Extensions Directory
Manos Mantzas's Avatar Manos Mantzas
Update: I turned off Target Blank Auto-Convert and use URL Match.
Here is my configuration.
Confidential information:
(hidden)

However that doesn't seem to be working either.
Any ideas?
Thank you in advance.
Peter van Westen's Avatar Peter van Westen ADMIN
See previous reply.
Please post a rating at the Joomla! Extensions Directory
Manos Mantzas's Avatar Manos Mantzas
Man, that's why you are who you are! I didn't even think of ajax! 😁
It can only be done by a component hack. I know the place in the code to perform the change and just did it.
Here is what I did:
<p>
                                        <input type="checkbox" id="termsandconditions" data-target="finalbutton">
										I agree with                                                                                 <a class="modals" target="_blank" href="/booking-conditions">Terms, Conditions &amp; Disclaimer</a>
                                        
                                                                                and                                        
                                                                                <a class="modals" target="_blank" href="/privacy-policy">Privacy Policy</a>
                                                                            </p>
Still not working though! 🙁
Any ideas?
Manos Mantzas's Avatar Manos Mantzas
I just saw that I need to trigger Modals init() function. Could you please give me a code example?
Thank you in advance.
Peter van Westen's Avatar Peter van Westen ADMIN
RegularLabsModals.init();

Just adding the class "modals" is not enough. You need to make it the same as the HTML output the {modal} tag would generate.
The easiest way to do that is to just put this in an article:
{modal url="/privacy-policy"}Privacy Policy{/modal}
Then check the HTML output on the frontend.
Please post a rating at the Joomla! Extensions Directory
Manos Mantzas's Avatar Manos Mantzas
Hey thanks, I know that article should work great, unfortunately I need to make those links open in a modal from within the component.
Here are my code modifications:
Confidential information:
(hidden)

However I get a javascript error: VM3754:1 Uncaught ReferenceError: RegularLabsModals is not defined
Any ideas?
Manos Mantzas's Avatar Manos Mantzas
Update:
I used this approach as well:
regularlabs.com/forum/modals/44537-link-...-a-particular-module
with a module containing the trigger code, but I still get the javascript error:
Uncaught ReferenceError: RegularLabsModals is not defined
Any ideas?
Peter van Westen's Avatar Peter van Westen ADMIN
The idea of creating the link in an article, is so that you can copy/paste the correct HTML for the modal link to your component file.


After that, instead of the RegularLabsModals.init() line, do:
<?php
JHtml::_('script', 'modals/script.min.js', ['version' => 'auto', 'relative' => true]);
?>

If that still won't work, then I am afraid you will have to conclude that you can't do what you want with Modals.
Please post a rating at the Joomla! Extensions Directory
Manos Mantzas's Avatar Manos Mantzas
Got you! I'm gonna try it and let you know.
Manos Mantzas's Avatar Manos Mantzas
Hi again,

Here is my code:
Confidential information:
(hidden)

No Javascript errors.
Peter van Westen's Avatar Peter van Westen ADMIN
Sorry, I don't think I can help you with this any further.
Please post a rating at the Joomla! Extensions Directory
Manos Mantzas's Avatar Manos Mantzas
I understand. So you think it is not possible, right?
Do you think it can be done with rereplacer maybe?
Peter van Westen's Avatar Peter van Westen ADMIN
Just adding the class "modals" is not enough. You need to make it the same as the HTML output the {modal} tag would generate.
The easiest way to do that is to just put this in an article:
{modal url="/privacy-policy"}Privacy Policy{/modal}
Then check the HTML output on the frontend.
The idea of creating the link in an article, is so that you can copy/paste the correct HTML for the modal link to your component file.
Please post a rating at the Joomla! Extensions Directory
Manos Mantzas's Avatar Manos Mantzas
Oops, so sorry I didn't understand you earlier. I will try it and let you know. 🙂
You can only post on this forum if you log in