News:

Join the Facebook Fan Page.

Main Menu

Java on forum

Started by Don Houston, August 27, 2016, 10:14:27 PM

Previous topic - Next topic

Don Houston

Yes I am starting a business and I need to know if I can put a java script on the board.  The script is to follow:

Quote<!-- mibew button --><a id="mibew-agent-button" href="/chat/chat?locale=en" target="_blank" onclick="Mibew.Objects.ChatPopups['57c248c84fb94c0d'].open();return false;"><img src="/chat/b?i=mibew&amp;lang=en" border="0" alt="" /></a><script type="text/javascript" src="/chat/js/compiled/chat_popup.js"></script><script type="text/javascript">Mibew.ChatPopup.init({"id":"57c248c84fb94c0d","url":"\/chat\/chat?locale=en","preferIFrame":true,"modSecurity":false,"width":640,"height":480,"resizable":true,"styleLoader":"\/chat\/chat\/style\/popup"});</script><div id="mibew-invitation"></div><script type="text/javascript" src="/chat/js/compiled/widget.js"></script><script type="text/javascript">Mibew.Widget.init({"inviteStyle":"\/chat\/styles\/invitations\/default\/invite.css","requestTimeout":10000,"requestURL":"\/chat\/widget","locale":"en","visitorCookieName":"MIBEW_VisitorID"})</script><!-- / mibew button -->

Thanks for the help

Kindred

Well, it CAN be added... You would have to add it in index.template.php for every theme
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Don Houston

I am not good at php is there a way I can send the file over and have someone add it.  I imagine it won't take that long

Illori

you have not even told us where you want it, so no one would know where to add the code if you did provide the file.

Don Houston

Sorry, I want it at the top of the forum.  Maybe where the news goes?  Somewhere at the top

Don Houston


Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters


Sir Osis of Liver

Depends where you want it.  Without the css and image, can only approximate it, but you can try this for starters -

index.template.php



function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;

echo '
<div id="fwidth">';

if ($context['user']['is_logged'] && $context['in_maintenance'] && $context['user']['is_admin'])
echo '
<div id="fnotice" class="themepadding">' , $txt['maintain_mode_on'] , '</div>';

echo '
<div id="ftop">
<div id="fheader"><div class="bwgrid">
<div class="bwcell6"><div class="themepadding">
<a href="' , $scripturl , '"><img src="' , !empty($settings['header_logo_url']) ? $settings['header_logo_url'] : $settings['images_url'].'/theme/logo.png' , '" style="max-width: 100%;" alt="*" /></a>
' , !empty($settings['site_slogan']) ? '<div class="subtitle">' . $settings['site_slogan'] . '</div>' : '' , '
</div></div>

<div style = "float: right;">
<!-- mibew button -->

<a id="mibew-agent-button" href="/chat/chat?locale=en" target="_blank" onclick="Mibew.Objects.ChatPopups[\'57c248c84fb94c0d\'].open();return false;"><img src="/chat/b?i=mibew&amp;lang=en" border="0" alt="" /></a>

<script type="text/javascript" src="/chat/js/compiled/chat_popup.js"></script>

<script type="text/javascript">Mibew.ChatPopup.init(\{"id":"57c248c84fb94c0d","url":"\/chat\/chat?locale=en","preferIFrame":true,"modSecurity":false,"width":640,"height":480,"resizable":true,"styleLoader":"\/chat\/chat\/style\/popup"});</script><div id="mibew-invitation"></div><script type="text/javascript" src="/chat/js/compiled/widget.js"></script><script type="text/javascript">Mibew.Widget.init({"inviteStyle":"\/chat\/styles\/invitations\/default\/invite.css","requestTimeout":10000,"requestURL":"\/chat\/widget","locale":"en","visitorCookieName":"MIBEW_VisitorID"\})</script>
<!-- / mibew button -->
</div>

<div class="bwcell10"><div class="themepadding">
<div id="qsearch" class="bwfloatright">
<form id="search_form" class="floatright" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="" id="qsearch_search" class="input_text" />
<input type="hidden" name="advanced" value="0" />';

// Search within current topic?



Places it far right over search widget.

Don't forget to add backslashes here, to escape single quotes -



Mibew.Objects.ChatPopups[\'57c248c84fb94c0d\'].


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

Can I send you the file so you can do it?  I am not good with php coding and I do not want to mess it up.  I can pm you the file.  I would like it in the top right corner of the forum

Sir Osis of Liver

Can't really do much with it without the accompanying css and button image, there's more to it than just that code block.  Backup the file and try inserting the code where indicated.  Search for the code just above it and copy the js just below it.  Without the rest of the package, I get a broken image and a bad link.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

would it help if I gave you access to the site and make you an admin so you could get to the code.  I can give you FTP access to

Sir Osis of Liver

Not really.  I'll d/l the Mibew package and see if I can get it running on a test install.  Are you using 2.1.2?

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston


Sir Osis of Liver

    This requires an involved installation, including it's own database.  If you attach your index.template.php from Shelflife theme, I'll insert the code and you can tinker with the formatting from there.  Make a backup of the file.

2.1.2 is current version of Mibew Messenger.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

OK give me a moment and I will do just that

Don Houston

How do I upload the file? 

Don Houston

Here is the attachment

Sir Osis of Liver

Ok, try this.  I ballparked the location, you can adjust the formatting.  Search the template for 'mibew button' to find the code.  Going off shortly, if you can't get it, I'll be on again for a while tomorrow night.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

Thank you it works perfectly

Kindred

glad you got it worked out.

However - if you plan to run a site for even a limited amount of time, you really should learn to do some basic coding.
Always take a backup before you do anything - that way, if you do screw it up, you can restore the backup...
but really, something simple like this could probably have been done by you in minutes instead of the back and forth that it did take..
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Don Houston

OK I have another question,  I installed  the forum on our sister site.  But now the live chat is not working.  Is there something I can do to resolve that or do I need to create it's own chat system?

Sir Osis of Liver

It should work if you replace all the paths in the button code with complete urls to the existing installation.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

I'll Send you a copy of what i did.  I tried but no luck.  Maybe it is just something small to fix.  I tried to replace the URL's but it is still not working

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

Thanks but what did I do wrong?

Sir Osis of Liver

You have to change all the paths, including http:// in url, and paths inside parts of the script require escape code (backslash \ ) before all forward slashes.  Javascript is
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston


Don Houston

 Sir Osis of Liver,

I had to reinstall my board, and re downloaded the file above but it is not working?  Any suggestions

Sir Osis of Liver

Did it work when you first installed the file?  Which forum did you reinstall, the original or the sister site?  Did you reinstall in same directory?  Can you post or pm links to both forums?

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

The link is kdsupport.info and I am going to reinstall Mibew on the site,  it worked when you gave me the file, but not now so I am going to reinstall mibew to see if that works

Sir Osis of Liver

The sister site is using the Mibew install from the original forum, that was the purpose of changing the urls in the button code from relative to absolute links.  If it's working on the original board, it should work on the second board with the above index template.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston


Sir Osis of Liver

The urls of the two chat links are different, the one on the main site is https (works), the link on the forum is http (404 error).  If you change the code on one, you have to change the other.  Try the attached.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

OK I checked and it installed, however; when I turn on the support system, it shows offline on the forum.

I reinstalled it to https://kdtechnology.info/chat/

Here is the code it gave me

<!-- mibew button --><a id="mibew-agent-button" href="/chat/chat?locale=en" target="_blank" onclick="Mibew.Objects.ChatPopups['57d874e41ff991f2'].open();return false;"><img src="/chat/b?i=mibew&amp;lang=en" border="0" alt="" /></a><script type="text/javascript" src="/chat/js/compiled/chat_popup.js"></script><script type="text/javascript">Mibew.ChatPopup.init({"id":"57d874e41ff991f2","url":"\/chat\/chat?locale=en","preferIFrame":true,"modSecurity":false,"width":640,"height":480,"resizable":true,"styleLoader":"\/chat\/chat\/style\/popup"});</script><!-- / mibew button -->

Sir Osis of Liver

Seems to be working now.  Only difference is homepage link opens in popup, forum link loads full page.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Don Houston

Where would I find the footer file.  I have a new chat system and it needs to go to the footer not the index

Kindred

the footer is a section within index.template.php
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Don Houston


Advertisement: