Zen Cart Logo
Forums / General Questions / How do I get custom functions included?

How do I get custom functions included?

Locked

Views: 1,218

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
13 Sep 2010, 10:23 PM
#1
alterego55 avatar

alterego55

New Zenner

Join Date:
Sep 2010
Posts:
28
Plugin Contributions:
0

How do I get custom functions included?

Zencart v1.3.9f

Where do I put my php file so all the functions in the file will be available to the rest of the application. I put it in:
includes/templates/mytemplate/includes/myfile.php

That doesn't seem to work.

13 Sep 2010, 10:45 PM
#2
kobra avatar

kobra

Black Belt

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

Re: How do I get custom functions included?

Where do I put my php file so all the functions in the file will be available to the rest of the application.
Depend upon what the function(s) are
Check the wiki for the developers view

13 Sep 2010, 10:46 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How do I get custom functions included?

Custom functions can go in their own file in /includes/functions/extra_functions/ (no custom template folder).

13 Sep 2010, 10:52 PM
#4
kobra avatar

kobra

Black Belt

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

Re: How do I get custom functions included?

gjh42:

Custom functions should go in their own file in /includes/functions/extra_functions/ (no custom template folder).
If and only if they are structured/written in ZenCart format
You might also need to break out other items

auto_loaders
classes
extra_cart_actions
extra_configures
extra_datafiles
functions
init_includes
languages
modules

13 Sep 2010, 11:06 PM
#5
alterego55 avatar

alterego55

New Zenner

Join Date:
Sep 2010
Posts:
28
Plugin Contributions:
0

Re: How do I get custom functions included?

Thanks guys (gals). I have created a theme from an existing (non zencart) website and I am trying to make it look like the parent site. The menu will appear in the header as I don't intend on using any existing zen cart structure for it (because I don't know how and I'm up against a market window). The menu is based upon a sprite graphic.

Link1 Link2 Link3 Link4 Link5

I created a function called get_main_menu() and it creates ul/li items that are defined in CSS with position: top: and left: properties. The background images are defined in CSS as well. There is no text except the title attribute. The image is the anchor.

Actually, this will be the first of probably several (or many) functions that I would normally put into a lib.php file.

Is the /includes/functions/extra_functions/ still appropriate? Thx.

13 Sep 2010, 11:47 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How do I get custom functions included?

For functions, yes. The other code elements kobra mentioned would be separated out into their own files as well if you have them.

14 Sep 2010, 12:00 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How do I get custom functions included?

To continue, if you are fluent in PHP, tpl_header.php is not difficult to understand, and you can modify or clone some of the nav in that to work within Zen Cart's structure. This thread discusses some of the header nav structure: http://www.zen-cart.com/forum/showthread.php?t=163968

1 Oct 2010, 7:19 PM
#8
alterego55 avatar

alterego55

New Zenner

Join Date:
Sep 2010
Posts:
28
Plugin Contributions:
0

Re: How do I get custom functions included?

Excellent comments all. Thx.