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.
Suggested Hosts
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 »

Hello, I am trying to get a javascript code to function on all pages. Here is an example of this javascript.
The Javascript
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.
Where I Have Inserted The Code
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: 68294
Joined: Mon May 02, 2005 3:11 am
Contact:

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

Post by Lumpy Burgertushie »

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.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
PlanetStyles.net
Former Team Member
Posts: 4700
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 PlanetStyles.net »

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: 16052
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 - Frankfurt 🇩🇪
Name: Marco
Contact:

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

Post by 3Di »

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
To request support for our extensions you can also contact me here: phpBB Studio

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
🚀 Looking for a specific feature or alternative option? We will rock you! 🚀
User avatar
Lumpy Burgertushie
Registered User
Posts: 68294
Joined: Mon May 02, 2005 3:11 am
Contact:

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

Post by Lumpy Burgertushie »

//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.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
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 »

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: 16052
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 - Frankfurt 🇩🇪
Name: Marco
Contact:

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

Post by 3Di »

To request support for our extensions you can also contact me here: phpBB Studio

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
🚀 Looking for a specific feature or alternative option? We will rock you! 🚀
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 »

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: 22919
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket probably.

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

Post by Mick »

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 »

Whatever.
Locked

Return to “[3.1.x] Support Forum”