Trying To get Javascript Code To Function On All Pages.

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
Locked
mralanc
Registered User
Posts: 6
Joined: Tue Sep 20, 2016 12:32 am

Trying To get Javascript Code To Function On All Pages.

Post by mralanc » Mon Sep 26, 2016 7:01 pm

Hello, I am trying to get a javascript code to function on all pages. Here is an example of this javascript.
3.jpg
The Javascript
Here is the javascript itself:

<script type="text/javascript">
var infolinks_pid = 2869060;
var infolinks_wsid = 1;
</script>
<script type="text/javascript" src="//resources.infolinks.com/js/infolinks_main.js"></script>

I have tried inserting the code before </body> in the overall_footer.html as seen below, it is not working.
1.jpg
Where I Have Inserted The Code
I also previously tried putting the code after the </body> as well as in the overall_header.html. Nothing is working for me.

Its really important to me to know how to get these codes functioning correctly. I appreciate your time and help. I've looked through several previous related posts but have not resolved the issue.

The website I am trying to do the install on is: http://Sampily.com

Alan :?

User avatar
Lumpy Burgertushie
Registered User
Posts: 66326
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Trying To get Javascript Code To Function On All Pages.

Post by Lumpy Burgertushie » Mon Sep 26, 2016 8:32 pm

it goes in the footer before the body tag.

the image you show has the link to the javascript incorrect.

//resources/infolinks.com is not a valid url.

I would suggest you contact wherever you got the script from and ask them how to make it work.

I would also suggest that you not use expression web to edit the phpbb files. it most likely will corrupt your files at some point and you will be at a loss as to what the problem is.

use a good text editor only. notepad++ or editpad lite are good ones.



robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
Christian 2.0
Former Team Member
Posts: 4454
Joined: Wed Nov 04, 2009 11:16 pm
Location: UK
Name: Christian
Contact:

Re: Trying To get Javascript Code To Function On All Pages.

Post by Christian 2.0 » Mon Sep 26, 2016 10:56 pm

Hmm, interesting.

The URL referenced in the JS will work fine. Can I ask if any of the other JS you've added to the footer is working correctly?

Also, out of curiosity if you place your JS at the bottom of /styles/phpBB/prosilver/forum_fn.js does it kick in then?

Thanks :)

User avatar
3Di
Former Team Member
Posts: 13772
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Trying To get Javascript Code To Function On All Pages.

Post by 3Di » Mon Sep 26, 2016 11:40 pm

I am strongly suggesting you all in this topic to read the documentation and the wiki for phpBB 3.1.x that's not 3.0.x. ;)

a) do not hard-code anything.
b) achieving that result is quite easy, a simple extension will do. Integrating a js script over all.

Don't keep buried (so to speak) in to the past, have a look ahead and move towards.

edit: see here an example
https://github.com/3D-I/notebbcode
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity ΒΊ PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
πŸ‘¨β€πŸ« | Take a tour to | The Studio | πŸ‘¨β€πŸ«

User avatar
Lumpy Burgertushie
Registered User
Posts: 66326
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Trying To get Javascript Code To Function On All Pages.

Post by Lumpy Burgertushie » Mon Sep 26, 2016 11:52 pm

//resources/infolinks.com

when I put that url into the browser earlier today it went to some completely different site.

when I did it just now, it went to yahoo search with results that linked to the actual website of infolinks.com

not sure what the problem is but that url does not take you to infolinks.com

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

mralanc
Registered User
Posts: 6
Joined: Tue Sep 20, 2016 12:32 am

Re: Trying To get Javascript Code To Function On All Pages.

Post by mralanc » Tue Sep 27, 2016 3:26 am

I've tried changing that piece of javascript top http:// and it looks better but still does not function.

The code that looks wrong is working on another site. However I appreciate you spotting that.

Is there any way to make this javascript work? :( Im trying so hard.

I also tried include thing javascript in the forum_fn.js file. It did not kick in.

We can figure this out guys. :)

User avatar
3Di
Former Team Member
Posts: 13772
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Trying To get Javascript Code To Function On All Pages.

Post by 3Di » Tue Sep 27, 2016 3:27 am

Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity ΒΊ PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
πŸ‘¨β€πŸ« | Take a tour to | The Studio | πŸ‘¨β€πŸ«

mralanc
Registered User
Posts: 6
Joined: Tue Sep 20, 2016 12:32 am

Re: Trying To get Javascript Code To Function On All Pages.

Post by mralanc » Tue Sep 27, 2016 4:10 am

I've achieved the result I was looking for. How I did this was by removing the javascript from the overall_footer and put it in the overall_header. I also had to set the setting to allow php in templates. I hope this post helps people in the future.

:D I would like to thank everyone who replied to this post.

Alan

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21141
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: Trying To get Javascript Code To Function On All Pages.

Post by Mick » Tue Sep 27, 2016 7:52 am

mralanc wrote:I hope this post helps people in the future
If you had requested an extension as was suggested that would have been useful to everyone including those that don't want to alter core code, which isn't recommended. Also, please note, coding questions should not be posted in support.
"The more connected we get the more alone we become" - Kyle Broflovski

mralanc
Registered User
Posts: 6
Joined: Tue Sep 20, 2016 12:32 am

Re: Trying To get Javascript Code To Function On All Pages.

Post by mralanc » Tue Sep 27, 2016 6:37 pm

Whatever.

Locked

Return to β€œ[3.1.x] Support Forum”