If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Sideboxes / Adding .JS files and code into a side box

Adding .JS files and code into a side box

Started by davidandrews on 2 Sep 2014, 4:49 AM · Views: 2,191

Results 1 to 7 of 7
2 Sep 2014, 4:49 AM
#1
davidandrews avatar

davidandrews

Zen Follower

Join Date:
Apr 2006
Posts:
108
Plugin Contributions:
0

Post #1 by davidandrews

Hi ! Long time :-)

I am wanting to add an HTML5 music player into an editable side box

I can do the first bit (editable side box) - e.g., adding twitter etc

What I am struggling with is working out where to put the .js files.
I can see that my .js files need to be appended with "jscript_FILENAME.js"

but what about the header code? Does the
I'm using amazingaudioplayer.com which generates also a .css file

my outputted files look like this in a dir

http://imgur.com/2EUScgt

is it possible ? I have viewed quite a through threads, but not sure if i am asking too much !

thanks for any help/advice

2 Sep 2014, 1:35 PM
#2
picaflor_azul avatar

picaflor_azul

Totally Zenned

Join Date:
Jul 2009
Location:
picaflor-azul.com
Posts:
6,940
Plugin Contributions:
28

Post #2 by picaflor_azul

davidandrews:

Hi ! Long time :-)

I am wanting to add an HTML5 music player into an editable side box

I can do the first bit (editable side box) - e.g., adding twitter etc

What I am struggling with is working out where to put the .js files.
I can see that my .js files need to be appended with "jscript_FILENAME.js"

but what about the header code? Does the
I'm using amazingaudioplayer.com which generates also a .css file

my outputted files look like this in a dir

http://imgur.com/2EUScgt

is it possible ? I have viewed quite a through threads, but not sure if i am asking too much !

thanks for any help/advice

If you check the wiki section of this site, there is a great article that explains how to implement javascript in zen cart.

Thanks,

Anne

2 Sep 2014, 6:08 PM
#3
davidandrews avatar

davidandrews

Zen Follower

Join Date:
Apr 2006
Posts:
108
Plugin Contributions:
0

Post #3 by davidandrews

picaflor-azul:

If you check the wiki section of this site, there is a great article that explains how to implement javascript in zen cart.

Thanks,

Anne

Thanks Anne

I tried that link earlier but could't fathom three things:

  1. where to put the header (of if not needed at all if appending .js files with jscript_ )
  2. where to put the body section
  3. which DIR to put the files (audio, css)

as shown here:

http://amazingaudioplayer.com/how-to-add-html5-audio-player-to-your-webpage/?source=app&os=mac&version=2.8

2 Sep 2014, 6:39 PM
#4
picaflor_azul avatar

picaflor_azul

Totally Zenned

Join Date:
Jul 2009
Location:
picaflor-azul.com
Posts:
6,940
Plugin Contributions:
28

Post #4 by picaflor_azul

davidandrews:

Thanks Anne

I tried that link earlier but could't fathom three things:

  1. where to put the header (of if not needed at all if appending .js files with jscript_ )
  2. where to put the body section
  3. which DIR to put the files (audio, css)

as shown here:

http://amazingaudioplayer.com/how-to-add-html5-audio-player-to-your-webpage/?source=app&os=mac&version=2.8

The jscript files can be called from any where in a page, so you can call them right in your sidebox code. I assume that you are using either the blank or editable sidebox module.

Thanks,

Anne

3 Sep 2014, 5:37 AM
#5
davidandrews avatar

davidandrews

Zen Follower

Join Date:
Apr 2006
Posts:
108
Plugin Contributions:
0

Post #5 by davidandrews

picaflor-azul:

The jscript files can be called from any where in a page, so you can call them right in your sidebox code. I assume that you are using either the blank or editable sidebox module.

Thanks,

Anne

Hi Anne
Many Thanks for your help
yes thats correct, i am using those modules.

Do i need to edit the tpl or php files?

Thanks

David

3 Sep 2014, 2:32 PM
#6
picaflor_azul avatar

picaflor_azul

Totally Zenned

Join Date:
Jul 2009
Location:
picaflor-azul.com
Posts:
6,940
Plugin Contributions:
28

Post #6 by picaflor_azul

davidandrews:

Hi Anne
Many Thanks for your help
yes thats correct, i am using those modules.

Do i need to edit the tpl or php files?

Thanks

David

I would put the calls for the js in whichever file you are adding your sidebox text in. I believe that the editable sidebox module uses a define page for this.

Thanks,

Anne

4 Sep 2014, 8:10 AM
#7
wrickspam avatar

wrickspam

New Zenner

Join Date:
Dec 2011
Location:
Emmen, The Netherlands
Posts:
85
Plugin Contributions:
0

Post #7 by wrickspam

you can load your script/js in the html_header file

located here:
httpdocs/shop/includes/templates/YOUR_TEMPLATE/common/html_header.php

add your code between script tags
before the ending of the code

like this

<script>insert your code here</script> </head> <?php // NOTE: Blank line following is intended: ?>

the stuff which u need in the body would be the sidebox content.

In order to find out where to place your files, just edit the pages then using the page source or inspect element you can find where zencart is trying to find the files!

Im not exactly sure if this is how u are supposed to do it but for me this works...

if you cant get it working you can also take a look at this page which has another method using the override system

http://www.zen-cart.com/content.php?228