Forums / General Questions / Where should I put my php/javascript files?

Where should I put my php/javascript files?

Locked
Results 1 to 6 of 6
This thread is locked. New replies are disabled.
09 Nov 2008, 18:42
#1
seifer987 avatar

seifer987

New Zenner

Join Date:
Nov 2008
Posts:
27
Plugin Contributions:
0

Where should I put my php/javascript files?

As we know, there are 3 user folders: languages, modules, templates.

I want to know which best folder to put my php or javascript files that contain functions or business logic?

For example, I modify the tpl_header.php by adding this code:
<table border="0">
<tr>
     <td valign="bottom" align="right" class="time">
          <?php include('time.php'); ?>
     </td>
</tr>
</table>


You could see that I've include 'time.php'. It contains javascript codes to display the current time.

So, where should I put the 'time.php' and what zen cart function to include the file?
09 Nov 2008, 23:05
#2
kobra avatar

kobra

Black Belt

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

Re: Where should I put my php/javascript files?

Scrap the tables!!!

All you need is this in a div where you want it to appear
?php echo time
10 Nov 2008, 05:19
#3
seifer987 avatar

seifer987

New Zenner

Join Date:
Nov 2008
Posts:
27
Plugin Contributions:
0

Re: Where should I put my php/javascript files?

You got me wrong. It's not about to display time but where should I put my php files that will be included by another files.
10 Nov 2008, 05:34
#4
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Where should I put my php/javascript files?

There are various places

The modules/ is a good place for modules
functions/ is a good place for functions
for js, you can put it in modules/pages/somepage/(check the default pages for example)
Otherwise, if the js is global, just place it in the js folder in the template folder.
10 Nov 2008, 06:48
#5
seifer987 avatar

seifer987

New Zenner

Join Date:
Nov 2008
Posts:
27
Plugin Contributions:
0

Re: Where should I put my php/javascript files?

yellow1912:

There are various places

The modules/ is a good place for modules
functions/ is a good place for functions
for js, you can put it in modules/pages/somepage/(check the default pages for example)
Otherwise, if the js is global, just place it in the js folder in the template folder.


Thanks. That's clear my doubt. I thought it's not recommended to add files in that folder (especially modules/ and functions/).
10 Nov 2008, 07:10
#6
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Where should I put my php/javascript files?

In functions, you have extra_functions folder, in modules you can use override if you have to.