Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Don Houston on August 27, 2016, 10:14:27 PM

Title: Java on forum
Post by: Don Houston on August 27, 2016, 10:14:27 PM
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
Title: Re: Java on forum
Post by: Kindred on August 28, 2016, 08:28:27 PM
Well, it CAN be added... You would have to add it in index.template.php for every theme
Title: Re: Java on forum
Post by: Don Houston on August 28, 2016, 08:47:16 PM
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
Title: Re: Java on forum
Post by: Illori on August 28, 2016, 08:50:44 PM
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.
Title: Re: Java on forum
Post by: Don Houston on August 28, 2016, 08:54:40 PM
Sorry, I want it at the top of the forum.  Maybe where the news goes?  Somewhere at the top
Title: Re: Java on forum
Post by: Don Houston on August 28, 2016, 10:39:12 PM
Forum I want to install is http://www.kdtechnology.tech/forum
Title: Re: Java on forum
Post by: Sir Osis of Liver on August 28, 2016, 10:54:47 PM
That's a 404.
Title: Re: Java on forum
Post by: Don Houston on August 28, 2016, 10:58:55 PM
Sorry it should be http://www.kdtechnology.tech/support
Title: Re: Java on forum
Post by: Sir Osis of Liver on August 28, 2016, 11:31:20 PM
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\'].


Title: Re: Java on forum
Post by: Don Houston on August 28, 2016, 11:40:54 PM
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
Title: Re: Java on forum
Post by: Sir Osis of Liver on August 28, 2016, 11:46:16 PM
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.
Title: Re: Java on forum
Post by: Don Houston on August 28, 2016, 11:48:13 PM
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
Title: Re: Java on forum
Post by: Sir Osis of Liver on August 28, 2016, 11:51:10 PM
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?

Title: Re: Java on forum
Post by: Don Houston on August 28, 2016, 11:55:47 PM
2.0.11
Title: Re: Java on forum
Post by: Sir Osis of Liver on August 28, 2016, 11:59:02 PM
  (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Feek.gif&hash=47a7f570d6bf6d5cfe83418f6485d47ce689555d)  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.
Title: Re: Java on forum
Post by: Don Houston on August 29, 2016, 12:00:41 AM
OK give me a moment and I will do just that
Title: Re: Java on forum
Post by: Don Houston on August 29, 2016, 12:03:00 AM
How do I upload the file? 
Title: Re: Java on forum
Post by: Don Houston on August 29, 2016, 12:05:14 AM
Here is the attachment
Title: Re: Java on forum
Post by: Sir Osis of Liver on August 29, 2016, 12:15:30 AM
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.
Title: Re: Java on forum
Post by: Don Houston on August 29, 2016, 12:21:28 AM
Thank you it works perfectly
Title: Re: Java on forum
Post by: Kindred on August 29, 2016, 09:38:19 AM
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..
Title: Re: Java on forum
Post by: Don Houston on September 09, 2016, 10:37:26 PM
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?
Title: Re: Java on forum
Post by: Sir Osis of Liver on September 09, 2016, 10:48:45 PM
It should work if you replace all the paths in the button code with complete urls to the existing installation.
Title: Re: Java on forum
Post by: Don Houston on September 09, 2016, 11:15:30 PM
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
Title: Re: Java on forum
Post by: Sir Osis of Liver on September 09, 2016, 11:34:52 PM
Try this.
Title: Re: Java on forum
Post by: Don Houston on September 09, 2016, 11:45:12 PM
Thanks but what did I do wrong?
Title: Re: Java on forum
Post by: Sir Osis of Liver on September 09, 2016, 11:50:03 PM
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 (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Fhairpull1.gif&hash=d1684c7b73ef4c7cc773994cfce0795f18f1c1d9)
Title: Re: Java on forum
Post by: Don Houston on September 09, 2016, 11:50:58 PM
ok
Title: Re: Java on forum
Post by: Don Houston on September 13, 2016, 03:33:52 PM
 Sir Osis of Liver,

I had to reinstall my board, and re downloaded the file above but it is not working?  Any suggestions
Title: Re: Java on forum
Post by: Sir Osis of Liver on September 13, 2016, 04:06:04 PM
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?

Title: Re: Java on forum
Post by: Don Houston on September 13, 2016, 04:09:17 PM
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
Title: Re: Java on forum
Post by: Sir Osis of Liver on September 13, 2016, 04:12:58 PM
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.
Title: Re: Java on forum
Post by: Don Houston on September 13, 2016, 04:14:46 PM
sent you a PM
Title: Re: Java on forum
Post by: Sir Osis of Liver on September 13, 2016, 04:24:34 PM
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.
Title: Re: Java on forum
Post by: Don Houston on September 13, 2016, 05:53:23 PM
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 -->
Title: Re: Java on forum
Post by: Sir Osis of Liver on September 14, 2016, 12:39:44 PM
Seems to be working now.  Only difference is homepage link opens in popup, forum link loads full page.
Title: Re: Java on forum
Post by: Don Houston on September 20, 2016, 06:28:43 AM
Where would I find the footer file.  I have a new chat system and it needs to go to the footer not the index
Title: Re: Java on forum
Post by: Kindred on September 20, 2016, 07:22:42 AM
the footer is a section within index.template.php
Title: Re: Java on forum
Post by: Don Houston on September 20, 2016, 07:23:27 AM
I got it thanks