Keyword

Modal box with K2

  • mobeen syed
  • mobeen syed's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #112540 by mobeen syed
Modal box with K2 was created by mobeen syed
Guys,

I am using K2 v2.6.5 with Joomla 2.5. and for the life of me, I can not have a modal box show up in K2 articles. I can add a modal anchor in Joomla articles and it shows up fine. I can use JCE with Mediabox on Joomla articles and the box shows up fine. However, K2 articles are not showing the modal box. I even added JHTML::(_... in K2.php but no good outcome.

Need Help!

Thanks

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago #112541 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Modal box with K2
Hello mobeen,

In order to override and add code to your items you need to modify item.php which is located on your K2 template's folder.

Furthermore the issue can be caused by a JS conflict. Have you checked your console tab for any JS errors?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • mobeen syed
  • mobeen syed's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #112542 by mobeen syed
Replied by mobeen syed on topic Re: Modal box with K2
Hi Krikor,

Thank you for your reply. I will move the code to item.php. (I did not know that articles are called items, my bad)

I have not checked for conflict. Let me check it as well.

Will report my progress in later today.

Thanks again for you help!

Mobeen

Please Log in or Create an account to join the conversation.

  • mobeen syed
  • mobeen syed's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #112543 by mobeen syed
Replied by mobeen syed on topic Re: Modal box with K2
Krikor,

Some more info. a) I have added the code to the item.php in com_k2/templates/defaults/item.php. b) I checked via the webconsole and sure enough there are errors for modal.js. However, the joomla article is not showing these errors. See the links below:

Joomla article with modal anchor - no errors and works fine (click on the image): usmlestrategy99.com/blog/test

K2 item with error: usmlestrategy99.com/blog/medical-professionals/item/37-modal-test
(click the - "click here to see my image" link. It instead opens a new window.)

How do I fix the conflict?

Thanks again
Mobeen

Please Log in or Create an account to join the conversation.

  • mobeen syed
  • mobeen syed's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #112544 by mobeen syed
Replied by mobeen syed on topic Re: Modal box with K2
I am still not able to fix this. Could not figure out a way to fix the conflict. I do see error on the K2 page in modal.js. However, do not know what to do.

Any help?

Mobeen

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago - 11 years 5 months ago #112545 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Modal box with K2
Hello again Mobeen,

You have multiple JS errors on your K2 item, that is why your modal is not working.
From what I can see mooTools is not called in your template, that is possibly producing all these errors.

Search your source code for this: <script src="/media/system/js/mootools-core.js"></script>
It should be on top of your modal.js script.

In your Joomla! article your template uses MooTools, on your K2 items on the other hand does not, so this is a template issue.

Since this is a Gavick template I think the folks over there will be more than happy to help you.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • mobeen syed
  • mobeen syed's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #112546 by mobeen syed
Replied by mobeen syed on topic Re: Modal box with K2
Krikor,

Thank you so much for your help. I appreciate it. I will check the mootools as you suggested. Will also reach out to Gavick folks if need be.

Best
Mobeen

Please Log in or Create an account to join the conversation.

  • mobeen syed
  • mobeen syed's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #112547 by mobeen syed
Replied by mobeen syed on topic Re: Modal box with K2
So I have fixed it - well sort of. I think I did somewhat of a hack, but could not find another better way. Till then here is what I did:

Note I am using gk_music_free template. It does allow in advanced settings to exclude mootools-core.js. However deleting this text does not actually work. It meant there was something hard coded. Also note that this maybe a good design for performance. Also a responsive template does not need a modal box. Keeping this in mind, here is the hack:

Went through the template files and found out that mootools-core.js is removed by a hard coded line in following file:
templates/gk_music_free/lib/framework/helper.mootools.php

Made a copy of the line, commented it out for future reference. Added a comment in my own document for future reference in case something broke. Modified the line and deleted the mootools-core.js.

It fixed two issues for me:
1. Lightbox has started appearing.
2. reCaptcha has started showing up in the comment box.

Warning - this seems to be a hack, do not break your production site by doing this. Find the right solution, and test it thoroughly.

Best
Mobeen

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum