Forums / Templates, Stylesheets, Page Layout / Inserting Code into tpl_header.php

Inserting Code into tpl_header.php

Locked

Views: 5,657

Results 1 to 20 of 38
This thread is locked. New replies are disabled.
18 Jan 2010, 8:18 AM
#1
drymetal avatar

drymetal

New Zenner

Join Date:
Jan 2010
Location:
Columbus, Ohio
Posts:
19
Plugin Contributions:
0

Inserting Code into tpl_header.php

Hey,

I have a quick question that I am sure is easy for someone to answer. I have zencart running on a site:

ZenCart Store

...and the template I started with does not have the html_header.php file in it. So I need to insert some javascript into the tpl_header.php so I can have a popup menu at the top.
(I did modify the template heavily in graphics but no changes outside of colors, graphics, etc.)

How do I do this? The Javascript code is:

<script language="javascript">var MenuFolderName="";</script><script charset="UTF-8" language="javascript" src="sftmp6arrays.js"></script><script charset="UTF-8" language="javascript" src="sfmenutmp6ie.js"></script>

I imagine this can't be all that difficult as I added a chat client to the header easily. I just don't know how to get the javascript to work in this file. Thanks!

Here is all the information about it:

Zen Cart 1.3.8a
Database Patch Level: 1.3.8
Fresh Installation

18 Jan 2010, 10:01 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Inserting Code into tpl_header.php

Should be no need to edit as ZenCart loads all js that is in the js folder
Place it in a jscript folder in your template - create folder if there isn't one

Zen-Venom Get Bitten

18 Jan 2010, 10:24 AM
#3
drymetal avatar

drymetal

New Zenner

Join Date:
Jan 2010
Location:
Columbus, Ohio
Posts:
19
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

Ok, so what would I call this folder? And I don't have to put anything in the header to call the jscript files to make the menu show up?

18 Jan 2010, 10:42 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Inserting Code into tpl_header.php

drymetal:

Ok, so what would I call this folder?
Quoting Myself
Place it in a jscript folder in your template - create folder if there isn't one

Zen-Venom Get Bitten

19 Jan 2010, 1:27 AM
#5
2600strangeave avatar

2600strangeave

New Zenner

Join Date:
Dec 2009
Posts:
9
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

I'm having a similar issue as the one that drymetal's having. I'm trying to use the shadowbox javascript code to display images, so I need the javascript to load in the <head>. I've tried putting the shadowbox.js file in the js folder, but ZC isn't loading it automatically. Is there something else I need to do? Hope this isn't a hijack, since we're both just trying to load extra javascript into the <head> tag.

19 Jan 2010, 1:45 AM
#6
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,672
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

Read the readme text file that is in the js folder ...

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

19 Jan 2010, 2:14 AM
#7
2600strangeave avatar

2600strangeave

New Zenner

Join Date:
Dec 2009
Posts:
9
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

Got it! Thanks for the help, Kim.

19 Jan 2010, 11:57 AM
#8
drymetal avatar

drymetal

New Zenner

Join Date:
Jan 2010
Location:
Columbus, Ohio
Posts:
19
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

Ok I did that. I created a jscript folder in the template directory. I then created a a file called: jscript_{unique_name}.php with the code just as it is in my first post inside of it.

I read the readme file in the jscript folder of the default template - it told me to read the JavaScript Override How-To in Docs. So I read that. And it does not tell me what I need to do to get this menu to load in a specific place on the header.

So can someone pretty, pretty please tell me what I need to do?

19 Jan 2010, 9:22 PM
#9
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Inserting Code into tpl_header.php

I created a jscript folder in the template directory. I then created a a file called: jscript_{unique_name}.php with the code just as it is in my first post inside of it.
Is your file java script or a php file?

js files extention is filemame.js not filemane.php
The code language is also js and not php

Zen-Venom Get Bitten

19 Jan 2010, 9:29 PM
#10
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

and let it dive straight into the javascript... as you are not embedding anything into a page, you do not need TAGS at the start or end of the jscript file, such as <SCRIPT type="text/javascript">

20 years a Zencart User

19 Jan 2010, 9:39 PM
#11
drymetal avatar

drymetal

New Zenner

Join Date:
Jan 2010
Location:
Columbus, Ohio
Posts:
19
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

Yeah well I actually created both. The .JS extension where I pasted what I thought would be the right code without the <script> stuff. And then I made one in a .php file that kept the tags in it.

Here is another thing - the template didn't have the jscript or even a html_header.php file. Can I just copy those from a different template and paste them in this templates folder?

And what do I need to put in the tpl_header.php file so that the site knows exactly where the menu is to go?

You know...when I finally get this...I'm probably going to do a cartwheel huh? lol

19 Jan 2010, 9:45 PM
#12
drymetal avatar

drymetal

New Zenner

Join Date:
Jan 2010
Location:
Columbus, Ohio
Posts:
19
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

So for the JS file - it would like this?:

<script language="javascript">var MenuFolderName="";</script><script charset="UTF-8" language="javascript" src="sftmp6arrays.js"></script><script charset="UTF-8" language="javascript" src="sfmenutmp6ie.js"></script>

To look like:

var MenuFolderName="";
charset="UTF-8" 
language="javascript" 
src="sftmp6arrays.js"
src="sfmenutmp6ie.js"

That is the other thing - it is calling to js files also. So should all three of them be in the jscript folder? I am sorry. Just set me on fire and roll me down a hill. :(

19 Jan 2010, 9:50 PM
#13
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

No... you must load up the actual code - not "references" to it.

The .js file must be just that... JS code...

20 years a Zencart User

19 Jan 2010, 9:54 PM
#14
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Inserting Code into tpl_header.php

Here is another thing - the template didn't have the jscript or even a html_header.php file. Can I just copy those from a different template and paste them in this templates folder?
You ONLY need to copy them to your template IF you change them from default
Otherwise those in template_default are used

And what do I need to put in the tpl_header.php file so that the site knows exactly where the menu is to go?
Is this "menu" run with js?
You would need to add the php to tpl_header,php
Looking at one of the signup forms might guide you some

So for the JS file - it would like this?:
You do not add this code
Just place a valid js file in the jscript folder and Zen Cart loads it

DITTO - on schoolboy's Post

Zen-Venom Get Bitten

19 Jan 2010, 9:58 PM
#15
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

The CONTENT of sfmenutmp6ie.js will look like this:

var tmp6isthereicon=0;var tmp6istheremoicon=0;var tmp6istherearrow=1;var tmp6istheremoarrow=1;tmp6ver_hor=1;var tmp6pgi_co=2;
var tmp6zminx=120;var tmp6preimg1;var tmp6preimg2;var tmp6preimg3;var tmp6preimg4;
function tmp6mimgpre(){
tmp6preimg3=new Image();tmp6preimg3.src=tmp6MFN+"arrow_black1.gif>";tmp6preimg4=new Image();tmp6preimg4.src=tmp6MFN+"arrow_y2.gif";}uagent = window.navigator.userAgent.toLowerCase();IEB=(uagent.indexOf('msie') != -1)?true:false;OPB=(uagent.indexOf('opera') != -1)?true:false;CRB=(uagent.indexOf('chrome') != -1)?true:false;SFB=(uagent.indexOf('safari') != -1)?true:false;IES=false;var FFB=false;if((IEB==false)&&(OPB==false)&&(SFB==false)){FFB=true;}var scompat = document.compatMode;if(scompat != "BackCompat"){IES=true;}else{IES=false;}var i=0;imgpx=0;imgpy=0;var lll=null;var tmp6timepop=null;var tmp6timepop2=null;var tmpobj=null;var tmpobj2=null;var tmpobj3=null;var tmpobj4=null;var tmpobj5=null;var tmpobj6=null;var tmp6MFN="";var tmp6effvarmiki=0;var tmp6TheLastItem=null;var llllll=0;var lllllll=0;var llllllll=0;var lllllllll=0;var llllllllll=0;var lllllllllll=0;var tmp6tgsdurum=1;var HeaderHeight=0;var HeaderWidth=0;var FooterHeight=0;var FooterWidth=0;function HideObjs(tagname){var tg=document.getElementsByTagName(tagname);for(i=0;i<tg.length;i++){tg[i].style.visibility="hidden";}}function ShowObjs(tagname){var tg=document.getElementsByTagName(tagname);for(i=0;i<tg.length;i++){tg[i].style.visibility="visible";}}function tmp6CreateHorMenu(){arrtxt="";llllllll=0;lllllllllll=0;lll=document.getElementById('tmp6sfmenu');if(!lll){setTimeout('tmp6CreateHorMenu()',50);return;}lll.sagbak=1;if(tmp6ver_hor==1){if((IEB==true)&&(IES==false)){lll.style.height=""+26+"px";}else{lll.style.height=""+(26-1-1)+"px";}}lll.style.top="0px";lll.style.left="0px";lll.mainmi=1;if(0!=1){lll.style.backgroundColor="#5871B3";}lll.style.borderLeftWidth=""+1+"px";lll.style.borderTopWidth=""+1+"px";lll.style.borderRightWidth=""+1+"px";lll.style.borderBottomWidth=""+1+"px";lll.style.borderStyle="dashed";lll.style.borderColor="#6D81D8";if(0==1){lll.style.backgroundImage=MainBlockBgTileImage;lll.style.backgroundRepeat=MainBlockBgTileRepeat;lll.style.backgroundPosition=""+MainBlockBgTilePositionY+"px "+MainBlockBgTilePositionX+"px";}lll.ChildCount=tmp6hma_in0.length;lll.artx="";if(tmp6ver_hor==1){llllllllll=1;lllllllllll=1;}else{llllllllll=0;lllllllllll=0;}lllllll=26-1-1-1-1;if((IEB==true)&&(IES==false)){}else{lllllll=lllllll-4-0-0;}if(tmp6ver_hor==1){HeaderHeight=26-1-1;FooterHeight=HeaderHeight;}else{HeaderWidth=180-1-1;FooterWidth=HeaderWidth;}if(0==1){ll = lll.appendChild(document.createElement("DIV"));    ll.style.position="absolute";    ll.style.visibility="inherit";    ll.style.overflow="hidden";ll.style.cursor='default';if(tmp6ver_hor==1){ll.style.top=""+0+"px";ll.style.left=""+0+"px";ll.style.width="auto";ll.style.height=""+HeaderHeight+"px";}else{ll.style.top=""+0+"px";ll.style.left=""+0+"px";ll.style.width=""+HeaderWidth+"px";ll.style.height="auto";}lllll=ll.appendChild(document.createElement("IMG"));lllll.style.position="relative";lllll.style.zIndex=0;lllll.style.visibility="inherit";lllll.src=tmp6MFN+"";lllll.style.top="0px";lllll.style.left="0px";ll.onmouseover = tmp6headerover;}if(0==1){ll = lll.appendChild(document.createElement("DIV"));    ll.style.position="absolute";    ll.style.visibility="inherit";    ll.style.overflow="hidden";ll.style.cursor='default';if(tmp6ver_hor==1){ll.style.top=""+0+"px";ll.style.left=""+0+"px";ll.style.width="auto";ll.style.height=""+FooterHeight+"px";}else{ll.style.top=""+0+"px";ll.style.left=""+0+"px";ll.style.width=""+FooterWidth+"px";ll.style.height="auto";}lllll=ll.appendChild(document.createElement("IMG"));lllll.style.position="relative";lllll.style.zIndex=0;lllll.style.visibility="inherit";lllll.src=tmp6MFN+"";lllll.style.top="0px";lllll.style.left="0px";ll.onmouseover = tmp6headerover;}eval("tmp6ma_rr"+arrtxt+"obj=lll");lll.onmouseover = tmp6mblockover;lll.onmouseout = tmp6mblockout;lll.tmp6jjjjj=tmp6jjjjjfunc;for(i=0;i<(tmp6hma_in0.length);i++){if(tmp6ver_hor==1){if((IEB==true)&&(IES==false)){llllll=parseInt(tmp6hma_in0[i][4]);}else{llllll=parseInt(tmp6hma_in0[i][4])-0-0-4-4;}}else{if((IEB==true)&&(IES==false)){llllll=180-0-0-1-1;}else{llllll=180-0-0-0-0-4-4-1-1;}}ll = lll.appendChild(document.createElement("DIV"));    ll.id="tmp6pgiid"+i;    ll.style.position="absolute";    ll.style.visibility="inherit";if(0!=1){ll.style.backgroundColor="#5871B3";}    ll.style.overflow="hidden";ll.innerHTML="<span style=\"position:relative;z-index:2;\">"+tmp6hma_in0[i][0]+"</span>";    ll.style.color="#FFFFFF";    ll.style.fontFamily="Verdana";ll.style.fontSize="11px";    ll.style.fontStyle="normal";    ll.style.fontWeight="bold";ll.style.textAlign="center";    ll.style.textDecoration="none";    ll.style.paddingTop=""+4+"px";ll.style.paddingLeft=""+4+"px";    ll.style.paddingRight=""+4+"px";if(tmp6ver_hor==0){ll.style.paddingBottom=""+4+"px";}ll.style.borderLeftWidth=""+0+"px";ll.style.borderTopWidth=""+0+"px";ll.style.borderRightWidth=""+0+"px";ll.style.borderBottomWidth=""+0+"px";    ll.style.borderStyle="solid";ll.style.borderColor="#000000";    if(tmp6hma_in0[i][1].length<3){ll.style.cursor='default';}else{ll.style.cursor='pointer';}    ll.sinex=i;ll.hassub=parseInt(""+tmp6hma_in0[i][9]);ll.hastext="_"+i;ll.artx="";eval("tmp6submi"+arrtxt+"_"+i+"obj=ll");    ll.style.top=""+lllllllllll+"px";ll.style.left=""+llllllllll+"px";    ll.style.width=""+llllll+"px";   if(tmp6ver_hor==1){ll.style.height=""+lllllll+"px";}if(0==1){    ll.style.backgroundImage=MainItemBgTileImage;    ll.style.backgroundRepeat=MainItemBgTileRepeat;ll.style.backgroundPosition=""+MainItemBgTilePositionY+"px "+MainItemBgTilePositionX+"px";}    ll.imgvar=0;    if(tmp6hma_in0[i][5].length>3)    {    lllll=ll.appendChild(document.createElement("IMG"));    lllll.id="tmp6bir"+i;    lllll.style.position="absolute";lllll.style.zIndex=1;    lllll.style.visibility="inherit";    lllll.src=tmp6MFN+tmp6hma_in0[i][5];    lllll.style.top=""+tmp6hma_in0[i][8]+"px";lllll.style.left=""+tmp6hma_in0[i][7]+"px";    ll.imgvar=1;    }    ll.linktx=tmp6hma_in0[i][1];ll.targtx=tmp6hma_in0[i][2];ll2 = lll.appendChild(document.createElement("DIV"));    ll2.id="tmp6pgiidR"+i;    ll2.style.position="absolute";    ll2.style.visibility="hidden";if(0!=1){ll2.style.backgroundColor="#2B385E";}    ll2.style.overflow="hidden";ll2.innerHTML="<span style=\"position:relative;z-index:2;\">"+tmp6hma_in0[i][0]+"</span>";    ll2.style.color="#D3D3D3";    ll2.style.fontFamily="Verdana";ll2.style.fontSize="11px";    ll2.style.fontStyle="normal";    ll2.style.fontWeight="bold";ll2.style.textAlign="center";    ll2.style.textDecoration="none";    ll2.style.paddingTop=""+4+"px";ll2.style.paddingLeft=""+4+"px";    ll2.style.paddingRight=""+4+"px";if(tmp6ver_hor==0){ll2.style.paddingBottom=""+4+"px";}ll2.style.borderLeftWidth=""+0+"px";ll2.style.borderTopWidth=""+0+"px";ll2.style.borderRightWidth=""+0+"px";ll2.style.borderBottomWidth=""+0+"px";    ll2.style.borderStyle="solid";ll2.style.borderColor="#000000";    if(tmp6hma_in0[i][1].length<3){ll2.style.cursor='default';}else{ll2.style.cursor='pointer';}    ll2.sinex=i;ll2.hassub=parseInt(""+tmp6hma_in0[i][9]);ll2.hastext="_"+i;ll2.artx="";eval("tmp6submiH"+arrtxt+"_"+i+"obj=ll2");    ll2.style.top=""+lllllllllll+"px";ll2.style.left=""+llllllllll+"px";    ll2.style.width=""+llllll+"px";    if(tmp6ver_hor==1){ll2.style.height=""+lllllll+"px";}if(0==1){    ll2.style.backgroundImage=MainItemMOBgTileImage;    ll2.style.backgroundRepeat=MainItemMOBgTileRepeat;ll2.style.backgroundPosition=""+MainItemMOBgTilePositionY+"px "+MainItemMOBgTilePositionX+"px";}    ll2.imgvar=0;    if(tmp6hma_in0[i][5].length>3)    {    lllll=ll2.appendChild(document.createElement("IMG"));    lllll.id="tmp6birR"+i;    lllll.style.position="absolute";lllll.style.zIndex=1;    lllll.style.visibility="inherit";    lllll.src=tmp6MFN+tmp6hma_in0[i][6];    lllll.style.top=""+tmp6hma_in0[i][8]+"px";lllll.style.left=""+tmp6hma_in0[i][7]+"px";    ll2.imgvar=1;    }    ll2.linktx=tmp6hma_in0[i][1];ll2.targtx=tmp6hma_in0[i][2];if(tmp6ver_hor==1){llllllllll=llllllllll+parseInt(tmp6hma_in0[i][4])+1;}else{prevh=ll.offsetHeight;lllllllllll=lllllllllll+prevh+1;}    ll.onmouseover = tmp6ItemOver;ll2.onmouseover = tmp6Item2Over;ll2.onclick= tmp6itemclick;}if(tmp6ver_hor==1){if((IEB==true)&&(IES==false)){llllllll=llllllllll-1+1+1+1;}else{llllllll=llllllllll-1+1;}}else{if((IEB==true)&&(IES==false)){llllllll=180;}else{llllllll=180-1-1;}if((IEB==true)&&(IES==false)){lllllllll=lllllllllll-1+0+1+1;}else{lllllllll=lllllllllll-1+0;}lll.style.height=""+lllllllll+"px";}lll.style.width=""+llllllll+"px";}function tmp6CreateSubMenu(arrobj,arrtxt){llll = document.createElement("DIV");llll.style.position="absolute";llll.style.visibility="hidden";tmp6tutwi=eval("tmp6ma_rr"+arrtxt+"objw");if((IEB==true)&&(IES==false)){llll.style.width=""+tmp6tutwi+"px";}else{llll.style.width=""+(parseInt(tmp6tutwi)-1-1)+"px";}llll.Iwidth=tmp6tutwi;llll.sagbak=1;llll.mainmi=0;llll.style.zIndex=(tmp6zminx++);if(0!=1){llll.style.backgroundColor="#FFFFFF";}llll.style.left=""+imgpx+"px";llll.style.padding=0;llll.style.borderStyle="solid";llll.style.borderWidth="1px 1px 1px 1px";llll.style.borderColor="#4F7CD2";if(IEB==true){llll.style.filter="";}else{llll.style.opacity=1.00;}llll.innerHTML="";if(0==1){llll.style.backgroundImage=SubBlockBgTileImage;llll.style.backgroundRepeat=SubBlockBgTileRepeat;llll.style.backgroundPosition=""+SubBlockBgTilePositionY+"px "+SubBlockBgTilePositionX+"px";}llll.onmouseover = tmp6mblockover;llll.onmouseout = tmp6mblockout;llll.tmp6jjjjj=tmp6jjjjjfunc;document.body.appendChild(llll);llll.artx=""+arrtxt;llll.ChildCount=arrobj.length;eval("tmp6ma_rr"+arrtxt+"obj=llll");prevh=0;addh=3;subbh=0;for(i=0;i<arrobj.length;i++){arrowposx=tmp6tutwi-parseInt(1)-parseInt(1)-3-3-(12)-1-1;ticont="<span style=\"position:relative;z-index:2;\">"+arrobj[i][0]+"</span>";ll = llll.appendChild(document.createElement("DIV"));    ll.id="tmp6pgiid"+arrtxt+"_"+i;ll.style.position="absolute";ll.style.visibility="inherit";if((IEB==true)&&(IES==false)){llllll=(tmp6tutwi-parseInt(1)-parseInt(1)-3-3);}else{llllll=(tmp6tutwi-1-parseInt(1)-3-3-14-6-parseInt(1)-parseInt(1));}ll.style.width=""+llllll+"px";ll.style.left=""+3+"px";ll.style.top=""+addh+"px";if(0!=1){ll.style.backgroundColor="#FFFFFF";}ll.style.color="#000000";ll.style.fontFamily="Tahoma,Verdana,Helvetica";ll.style.fontSize="11px";ll.style.fontStyle="normal";ll.style.fontWeight="normal";ll.style.textAlign="left";ll.style.textDecoration="none";ll.style.padding=""+4+"px "+6+"px "+4+"px "+14+"px";ll.style.borderStyle="solid";ll.style.borderWidth="1px 1px 1px 1px";ll.style.borderColor="#FFFFFF";if(arrobj[i][1].length<3){ll.style.cursor='default';}else{ll.style.cursor='pointer';}ll.hassub=arrobj[i][3];ll.artx=""+arrtxt;ll.sinex=i;ll.hastext=""+arrtxt+"_"+i;eval("tmp6submi"+arrtxt+"_"+i+"obj=ll");ll.linktx=arrobj[i][1];ll.targtx=arrobj[i][2];ll.innerHTML=ticont;if(0==1){    ll.style.backgroundImage=SubItemBgTileImage;    ll.style.backgroundRepeat=SubItemBgTileRepeat;ll.style.backgroundPosition=""+SubItemBgTilePositionY+"px "+SubItemBgTilePositionX+"px";}if(tmp6isthereicon==1){    lllll=ll.appendChild(document.createElement("IMG"));    lllll.style.position="absolute";lllll.style.zIndex=1;    lllll.style.visibility="inherit";    lllll.src=tmp6MFN+"sequire6.gif";    lllll.style.top=""+7+"px";lllll.style.left=""+3+"px";}if(arrobj[i][3]==1){if(tmp6istherearrow==1){lllll3=ll.appendChild(document.createElement("IMG"));lllll3.style.position="absolute";lllll3.style.zIndex=3;lllll3.style.visibility="inherit";lllll3.src=tmp6MFN+"arrow_black1.gif";lllll3.style.top=""+7+"px";lllll3.style.left=""+arrowposx+"px";}}ll2 = llll.appendChild(document.createElement("DIV"));    ll2.id="tmp6pgiidR"+arrtxt+"_"+i;ll2.style.position="absolute";ll2.style.visibility="hidden";ll2.style.width=""+llllll+"px";ll2.style.left=""+3+"px";ll2.style.top=""+addh+"px";if(0!=1){ll2.style.backgroundColor="#C1D2EE";}ll2.style.color="#0F1231";ll2.style.fontFamily="Tahoma,Verdana,Helvetica";ll2.style.fontSize="11px";ll2.style.fontStyle="normal";ll2.style.fontWeight="normal";ll2.style.textAlign="left";ll2.style.textDecoration="none";ll2.style.padding=""+4+"px "+6+"px "+4+"px "+14+"px";ll2.style.borderStyle="solid";ll2.style.borderWidth="1px 1px 1px 1px";ll2.style.borderColor="#316AC5";if(arrobj[i][1].length<3){ll2.style.cursor='default';}else{ll2.style.cursor='pointer';}ll2.hassub=arrobj[i][3];ll2.artx=""+arrtxt;    ll2.sinex=i;ll2.hastext=""+arrtxt+"_"+i;eval("tmp6submiH"+arrtxt+"_"+i+"obj=ll2");ll2.linktx=arrobj[i][1];ll2.targtx=arrobj[i][2];ll2.innerHTML=ticont;if(0==1){    ll2.style.backgroundImage=SubItemMOBgTileImage;    ll2.style.backgroundRepeat=SubItemMOBgTileRepeat;ll2.style.backgroundPosition=""+SubItemMOBgTilePositionY+"px "+SubItemMOBgTilePositionX+"px";}if(tmp6istheremoicon==1){    lllll2=ll2.appendChild(document.createElement("IMG"));    lllll2.style.position="absolute";lllll2.style.zIndex=1;    lllll2.style.visibility="inherit";    lllll2.src=tmp6MFN+"sequire2.gif";    lllll2.style.top=""+7+"px";lllll2.style.left=""+3+"px";}if(arrobj[i][3]==1){if(tmp6istheremoarrow==1){lllll4=ll2.appendChild(document.createElement("IMG"));lllll4.style.position="absolute";lllll4.style.zIndex=3;lllll4.style.visibility="inherit";lllll4.src=tmp6MFN+"arrow_y2.gif";lllll4.style.top=""+7+"px";lllll4.style.left=""+arrowposx+"px";}}prevh=ll.offsetHeight;ll.onmouseover = tmp6ItemOver;ll2.onmouseover = tmp6Item2Over;ll2.onclick= tmp6itemclick;if(i==(arrobj.length-1)){addh=addh+prevh;}else{addh=addh+prevh+1;}}if((IEB==true)&&(IES==false)){llll.style.height=""+(addh+3+1+1)+"px";}else{llll.style.height=""+(addh+3)+"px";}llll.skh=addh+3+1+1;}function llllllllllllllllllllll(o){var n=0;var jjjjjjj;n=parseInt(o.offsetLeft);while(o.offsetParent!=null){jjjjjjj = o.offsetParent;n=n+jjjjjjj.offsetLeft;if((IEB!=true)||((IEB==true)&&(IES==true))){if(!isNaN(jjjjjjj.clientLeft)){n=n+parseInt(jjjjjjj.clientLeft);}}o = jjjjjjj;}return n;}function lllllllllllllllllllllll(o){var n=0;var jjjjjjj;n=parseInt(o.offsetTop);while(o.offsetParent!=null){jjjjjjj = o.offsetParent;n=n+jjjjjjj.offsetTop;if((IEB!=true)||((IEB==true)&&(IES==true))){if(!isNaN(jjjjjjj.clientTop)){n=n+parseInt(jjjjjjj.clientTop);}}o = jjjjjjj;}return n;}function tmp6jjjjjfunc(){this.d1=0;this.d2=0;for(this.d1=0;this.d1<this.ChildCount;this.d1++){tmpobj2=eval("tmp6submi"+this.artx+"_"+this.d1+"obj");if(tmpobj2.hassub==1){tmpobj3=eval("tmp6ma_rr"+tmpobj2.hastext+"obj");if(tmpobj3){if(tmpobj3.style.visibility!="hidden"){tmpobj2.style.visibility="inherit";tmpobj4=eval("tmp6submiH"+this.artx+"_"+this.d1+"obj");tmpobj4.style.visibility="hidden";tmpobj3.style.visibility="hidden";for(this.d2=0;this.d2<tmpobj3.ChildCount;this.d2++){tmpobj6=eval("tmp6submi"+tmpobj3.artx+"_"+this.d2+"obj");tmpobj6.style.visibility="inherit";tmpobj6=eval("tmp6submiH"+tmpobj3.artx+"_"+this.d2+"obj");tmpobj6.style.visibility="hidden";}tmpobj3.tmp6jjjjj();}}}}}function tmp6Item2Over(e){subvarmi=parseInt(""+this.hassub);if(subvarmi==1){tmpobj5=eval("tmp6ma_rr"+this.hastext+"obj");if(tmpobj5){tmpobj5.tmp6jjjjj();}}}function tmp6ItemOver(e){tmp6TheLastItem=this;tmpobj=null;this.parentNode.tmp6jjjjj();j=0;for(j=0;j<this.parentNode.ChildCount;j++){if(this.sinex!=j){gobj=eval("tmp6submi"+this.artx+"_"+j+"obj");gobj.style.visibility="inherit";gobj2=eval("tmp6submiH"+this.artx+"_"+j+"obj");gobj2.style.visibility="hidden";}}llllllllllll=eval("tmp6submiH"+this.hastext+"obj");llllllllllll.style.visibility="inherit";this.style.visibility="hidden";subvarmi=parseInt(""+this.hassub);if(subvarmi==1){tmpobj=eval("tmp6ma_rr"+this.hastext+"obj");if(!tmpobj){tmp6CreateSubMenu(eval("tmp6ma_rr"+this.hastext+""),""+this.hastext);}}if(subvarmi==1){tmpobj=eval("tmp6ma_rr"+this.hastext+"obj");var xpos=0;var ypos=0;var lllllllllllll=0;if(this.parentNode.mainmi==1){if(IEB==true){var obj= event.srcElement;xpos=parseInt(event.clientX)-parseInt(event.x)+parseInt(document.body.scrollLeft)-parseInt(document.body.clientLeft);}else{xpos=llllllllllllllllllllll(this.offsetParent)-(document.body.offsetLeft)-(document.body.offsetLeft);}lllllllllllll=xpos;}else{lllllllllllll=parseInt(this.parentNode.style.left);}var llllllllllllllllll=0;if(this.parentNode.mainmi==1){if(IEB==true){var obj= event.srcElement;ypos=parseInt(event.clientY)-parseInt(event.y)+parseInt(document.body.scrollTop)-parseInt(document.body.clientTop);}else{ypos=lllllllllllllllllllllll(this.offsetParent)-(document.body.offsetTop)-(document.body.offsetTop);}llllllllllllllllll=ypos;}else{llllllllllllllllll=parseInt(this.parentNode.style.top);}     var g3=parseInt(this.parentNode.style.top); var g8=parseInt(this.parentNode.offsetTop);        var llllllllllllll=parseInt(this.parentNode.offsetWidth);        var lllllllllllllllllllll=parseInt(this.parentNode.offsetHeight);var lllllllllllllll=parseInt(this.style.top);var lllllllllllllllllll=parseInt(this.style.left);var llllllllllllllll=0;if(this.parentNode.mainmi==1){ypos=lllllllllllllllllllllll(this.offsetParent);if(tmp6ver_hor==0){llllllllllllllll=ypos+lllllllllllllll;}else{llllllllllllllll=ypos+parseInt(this.parentNode.style.height);}}else{llllllllllllllll=parseInt(this.style.top);}var lllllllllllllllll=parseInt(tmpobj.style.width);var llllllllllllllllllll=parseInt(tmpobj.offsetWidth);    var g1=parseInt(document.body.scrollTop);      var g4=parseInt(document.body.clientWidth);var g5=parseInt(document.body.clientHeight);    var g6=parseInt(document.body.scrollLeft);          tmpobj.style.overflow="hidden";    var yd=this.parentNode.sagbak;if(this.parentNode.mainmi==1){if((llllllllllllllllll-g1+1+lllllllllllllll+parseInt(tmpobj.skh)+(0))<g5)    {if(tmp6ver_hor==0){tmpobj.style.top=""+(llllllllllllllllll+1+lllllllllllllll+(0))+"px";}else{    tmpobj.style.top=""+(llllllllllllllllll+lllllllllllllllllllll+(0))+"px";}    }    else    {    if(parseInt(tmpobj.style.height)<(g5-4))    {    tmpobj.style.top=""+(g1+g5-parseInt(tmpobj.skh)-(0))+"px";}    else    {    tmpobj.style.height=""+(g5-4)+"px";    tmpobj.style.overflowX="hidden";tmpobj.style.overflowY="scroll";    var sdeg=parseInt(tmpobj.Iwidth)-parseInt(tmpobj.clientWidth)-(parseInt(1)+parseInt(1));    tmpobj.style.width=""+(parseInt(tmpobj.Iwidth)+parseInt(sdeg))+"px";    tmpobj.style.top=(g1+2)+"px";}    }}else{    if((g8-g1+lllllllllllllll+parseInt(tmpobj.skh)+(0))<g5)    {tmpobj.style.top=""+(llllllllllllllllll+lllllllllllllll+1+(0))+"px";    }    else{    if(parseInt(tmpobj.style.height)<(g5-4))    {    tmpobj.style.top=""+(g1+g5-parseInt(tmpobj.skh)-(0))+"px";}    else    {    tmpobj.style.height=""+(g5-4)+"px";    tmpobj.style.overflowX="hidden";tmpobj.style.overflowY="scroll";    var sdeg=parseInt(tmpobj.Iwidth)-parseInt(tmpobj.clientWidth)-(parseInt(1)+parseInt(1));    tmpobj.style.width=""+(parseInt(tmpobj.Iwidth)+parseInt(sdeg))+"px";    tmpobj.style.top=(g1+2)+"px";}    }}if(this.parentNode.mainmi==1){if(tmp6ver_hor==0){    if(yd==1)    {    if((lllllllllllllllll+lllllllllllll+llllllllllllll+(0))< (g4+g6)){    tmpobj.sagbak=1;tmpobj.style.left=""+(lllllllllllll+llllllllllllll+(0))+"px";    }else    {    tmpobj.sagbak=0;    tmpobj.style.left=""+(lllllllllllll-lllllllllllllllll-(0))+"px";}}    else    {    if((lllllllllllll-lllllllllllllllll)>(g6+2)){tmpobj.sagbak=0;    tmpobj.style.left=""+(lllllllllllll-lllllllllllllllll-(0))+"px";    }    else{    tmpobj.sagbak=1;    tmpobj.style.left=""+(lllllllllllll+llllllllllllll+(0))+"px";    }    }}else {    if(yd==1)    {if((lllllllllllll-g6+lllllllllllllllllll+llllllllllllllllllll+(0)) < g4){    tmpobj.sagbak=1;tmpobj.style.left=""+(lllllllllllll+lllllllllllllllllll+1+(0))+"px";    }else    {    tmpobj.sagbak=0;tmpobj.style.left=""+(g4+g6-llllllllllllllllllll)+"px";}}    else    {    if((lllllllllllll-lllllllllllllllll)>(g6+2)){tmpobj.sagbak=0;    tmpobj.style.left=""+(lllllllllllll-lllllllllllllllll-(0))+"px";    }    else{    tmpobj.sagbak=1;    tmpobj.style.left=""+(lllllllllllll+llllllllllllll+(0))+"px";    }    }}}else {    if(yd==1)    {    if((lllllllllllllllll+lllllllllllll+llllllllllllll+(0))< (g4+g6)){    tmpobj.sagbak=1;tmpobj.style.left=""+(lllllllllllll+llllllllllllll+(0))+"px";    }else    {    tmpobj.sagbak=0;    tmpobj.style.left=""+(lllllllllllll-lllllllllllllllll-(0))+"px";}}    else    {    if((lllllllllllll-lllllllllllllllll)>(g6+2)){tmpobj.sagbak=0;    tmpobj.style.left=""+(lllllllllllll-llllllllllllllllllll-(0))+"px";    }    else{    tmpobj.sagbak=1;    tmpobj.style.left=""+(lllllllllllll+llllllllllllll+(0))+"px";    }    }}tmpobj.tmp6jjjjj();if((IEB==true)&&(tmp6effvarmiki==1)){tmpobj.filters[0].apply();}tmpobj.style.visibility="visible";if((IEB==true)&&(tmp6effvarmiki==1)){tmpobj.filters[0].play();}}}function tmp6jjjjjj(){if(tmp6TheLastItem!=null){tmpobj2=eval("tmp6submi"+tmp6TheLastItem.artx+"_"+tmp6TheLastItem.sinex+"obj");tmpobj2.style.visibility="inherit";tmpobj2=eval("tmp6submiH"+tmp6TheLastItem.artx+"_"+tmp6TheLastItem.sinex+"obj");tmpobj2.style.visibility="hidden";lllTemp=document.getElementById('tmp6sfmenu');lllTemp.tmp6jjjjj();}if(tmp6tgsdurum==0){tmp6tgsdurum=1;}}function tmp6ItemOut(){}function tmp6itemclick(){ }function tmp6mblockover(){clearTimeout(tmp6timepop);if(tmp6tgsdurum==1){tmp6tgsdurum=0;}}function tmp6headerover(){clearTimeout(tmp6timepop);tmp6jjjjjj();}function tmp6mblockout(){clearTimeout(tmp6timepop);tmp6timepop=setTimeout('tmp6jjjjjj()',1000);}function tmp6InitMenu(){tmp6MFN=MenuFolderName;document.write('<div id="tmp6sfmenu" style="position:relative;margin:0px;padding:0px;display:block;left:0px;top:0px;overflow:hidden;zoom:1;"></div>');setTimeout('tmp6CreateHorMenu()',50);}tmp6InitMenu();

... and the file will be called: jscript_sfmenutmp6ie.js

and will then be saved in your template's jscript folder

20 years a Zencart User

19 Jan 2010, 10:05 PM
#16
drymetal avatar

drymetal

New Zenner

Join Date:
Jan 2010
Location:
Columbus, Ohio
Posts:
19
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

Ok. Let's see if I am following here. Hard to believe but I never went to Woodstock...

Ok so the template_default folder is where I need to put the JS files in template_default/jscript/ (A lightbulb went off. Aren't ya sorta happy?)

All that does is load js so it is already there when the browser loads.
I don't know how the heck you know what sfmenutmp6ie.js looks like. I hadn't opened it yet. You guys must have taken the blue pill.
That's pretty cool actually...

Yes the menu is ran with JS.

So the only thing I don't get is this php I need to put in the TPL_header thing. I am going to go look for signup forms to figure this out. :) I'll let you know what happens. :)

19 Jan 2010, 10:13 PM
#17
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Inserting Code into tpl_header.php

drymetal:

Ok so the template_default folder is where I need to put the JS files in template_default/jscript/ (A lightbulb went off. Aren't ya sorta happy?)
No No....
schoolboy:

and will then be saved in your template's jscript folder
kobra:

Place it in a jscript folder in your template - create folder if there isn't one

Zen-Venom Get Bitten

19 Jan 2010, 10:16 PM
#18
drymetal avatar

drymetal

New Zenner

Join Date:
Jan 2010
Location:
Columbus, Ohio
Posts:
19
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

Oh wait, I think another lightbulb just went off. So the code it told me to put in the "body" of my html file:

<script language="javascript">var MenuFolderName="";</script><script charset="UTF-8" language="javascript" src="sftmp6arrays.js"></script><script charset="UTF-8" language="javascript" src="sfmenutmp6ie.js"></script>

I don't need to create a JS file with that code in it - because that is just loading the two JS files mentioned and that is what the jscript folder does anyway. Right?

So then all I need is the right code for the tpl_header file that tells where the menu will go? Which, is the php thing you mentioned?

19 Jan 2010, 10:19 PM
#19
drymetal avatar

drymetal

New Zenner

Join Date:
Jan 2010
Location:
Columbus, Ohio
Posts:
19
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

kobra:

You ONLY need to copy them to your template IF you change them from default
Otherwise those in template_default are used

Well...so the jscript folder is used in my template and the html_header is used in the default one?

Maybe I should have went to Woodstock...

19 Jan 2010, 10:22 PM
#20
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Inserting Code into tpl_header.php

Zencart is really very obedient... trust it to do what it says on the tin...

You should have a jscript folder in your CUSTOM TEMPLATE override system...

... basically, the directory structure that exists in template_default is "mirrored" in your custom template.

So, where you see:

includes/templates/template_default/jscript/

... you should have:

includes/templates/YOUR_TEMPLATE/jscript/

... as your "over-ride" (custom) template directory structure.

If you do NOT have a folder called jscript in:

includes/templates/YOUR_TEMPLATE/...

... then you create one... and THAT is where you store your own jscript files.

Following the tutorial, you need to NAME the .js files properly (see above).

The MODULE or FEATURE you are calling at any given point should have embedded within its own code, a reference to all js files it needs.

If the module / feature you are wanting to use is properly loaded into the folder and file structure of zencart, then the js file it needs will be automatically loaded when it needs it.

You need do nothing, other than collect the js files, re-name them (as indicated), load them into your templates jscript folder, load up the files for the appropriate module/function/feature... and away you go...

20 years a Zencart User