Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / custom template woes

custom template woes

Locked

Views: 3,451

Results 1 to 20 of 21
This thread is locked. New replies are disabled.
4 Sep 2007, 6:40 PM
#1
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

custom template woes

I am having a hard time working out what I need to do to solve my problem with custom templates and files and I need someone to put me back on the right track....please!!!!!

I am making changes to files and uploading them and nothing is happening.

What I cannot get my head around is how, if I make a folder called "custom" and slot it in say includes/languages/CUSTOM/english how is the program supposed to "find" it when it has been moved???

I am sure this is a lot simpler than I am making it but I am really very confused.
I recognise it is not a good thing to edit the "core files" because of future upgrades but I dont understand how the template overriddes work.

I have tried on a numerous occasions to work out how to add a custom template and right now I have 3 templates in my admin.

one called "custom" which when previewed results in this error
cart/includes/templates/custom/images/scr_template_default.jpg

one called "newfiles" which when previewed, results in this error
cart/includes/templates/newfiles/images

and the default template which is now called MY classic contemporary green. I do remember adding the word "my" when I was trying to "clone" the classic green template so I could edit that without touching the original as per a suggestion from someone on the forum.

Right now I have custom folders added to different folders EVERYWHERE and 3 custom templates of which only one works (the one that was there already) and I don't know how to delete the faulty ones and I am getting increasingly frustrated.

Can anyone explain the concept to me in easier terms than I am reading so I can find the files I need, makes the changes, upload them back to the correct folder while NOT changing any of the existing files??????

It's a minefield to me and my head hurts :)

Thanks in advance.

4 Sep 2007, 7:40 PM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: custom template woes

The simplest description of override files is that Zen Cart is programmed, every time it needs to run a file, to look in the current template's directory for a copy of that file. If it doesn't find one, it uses the default copy.

4 Sep 2007, 8:24 PM
#3
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: custom template woes

To create a very basic custom template (you can build from there), you need:

  • includes/languages/YOUR_TEMPLATE/english.php
  • includes/languages/english/YOUR_TEMPLATE/index.php
  • includes/languages/english/YOUR_TEMPLATE/header.php (to change the logo)
  • includes/templates/YOUR_TEMPLATE/template_info.php
  • includes/templates/YOUR_TEMPLATE/common/tpl_header.php
  • includes/templates/YOUR_TEMPLATE/common/tpl_footer.php
  • includes/templates/YOUR_TEMPLATE/images/logo.gif
  • includes/templates/YOUR_TEMPLATE/css/stylesheet.css

Anywhere you see a /classic/ folder, you can create a folder for your custom template. You can copy the necessary files from either the /classic/ folder, the /template_default/ folder or the parent folder.

Edit includes/templates/YOUR_TEMPLATE/template_info.php to give your template identifying information so you'll recognize it in the admin under tools->template selection.

Once you select your template in the admin, ZC will know where to look for the custom information you created.

4 Sep 2007, 8:47 PM
#4
tshooters avatar

tshooters

Totally Zenned

Join Date:
Dec 2005
Posts:
1,037
Plugin Contributions:
2

Re: custom template woes

If you're like me, a visual aid helps a lot in understanding the overrides system!
Go here and print out the page, or to the link at the bottom of that page for a chart in the downloads section:

https://www.zen-cart.com/tutorials/index.php?article=143

4 Sep 2007, 9:28 PM
#5
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

gjh42:

The simplest description of override files is that Zen Cart is programmed, every time it needs to run a file, to look in the current template's directory for a copy of that file. If it doesn't find one, it uses the default copy.
Thank you, thank you, thank you!!!!!!

That helps sooo much in one area!

4 Sep 2007, 9:31 PM
#6
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

afo:

To create a very basic custom template (you can build from there), you need:

  • includes/languages/YOUR_TEMPLATE/english.php
  • includes/languages/english/YOUR_TEMPLATE/index.php
  • includes/languages/english/YOUR_TEMPLATE/header.php (to change the logo)
  • includes/templates/YOUR_TEMPLATE/template_info.php
  • includes/templates/YOUR_TEMPLATE/common/tpl_header.php
  • includes/templates/YOUR_TEMPLATE/common/tpl_footer.php
  • includes/templates/YOUR_TEMPLATE/images/logo.gif
  • includes/templates/YOUR_TEMPLATE/css/stylesheet.css

Anywhere you see a /classic/ folder, you can create a folder for your custom template. You can copy the necessary files from either the /classic/ folder, the /template_default/ folder or the parent folder.

Edit includes/templates/YOUR_TEMPLATE/template_info.php to give your template identifying information so you'll recognize it in the admin under tools->template selection.

Once you select your template in the admin, ZC will know where to look for the custom information you created.

Thanks for your help. I need to re-read this a couple of times and I am sure it will be very valuable

thanks again.

4 Sep 2007, 9:32 PM
#7
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

TShooters:

If you're like me, a visual aid helps a lot in understanding the overrides system!
Go here and print out the page, or to the link at the bottom of that page for a chart in the downloads section:

https://www.zen-cart.com/tutorials/index.php?article=143

Thanks :D:D:D:D:D

5 Sep 2007, 3:16 AM
#8
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: custom template woes

Hi Peggy,

If you duplicate my list, you can play with the files in the YOUR_TEMPLATE directory to your heart's content. If you make a major oopsie :shocking:, you can simply copy the original file and start over. That's the great beauty of the template system. There's definitely a learning curve involved, but once you get past it, you'll wonder why you thought it was so difficult.

Good Luck and Happy Zenning! :D

6 Sep 2007, 6:07 PM
#9
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

afo:

Hi Peggy,

If you duplicate my list, you can play with the files in the YOUR_TEMPLATE directory to your heart's content. If you make a major oopsie :shocking:, you can simply copy the original file and start over. That's the great beauty of the template system. There's definitely a learning curve involved, but once you get past it, you'll wonder why you thought it was so difficult.

Good Luck and Happy Zenning! :D
Yes your post was invaluable. I finally got it figured out.
I think I was doing it correct (mostly..lol) all along
I think the frustrations came because my editor seemed to have a bug. I could never find the corresponding files in it.
However if I found them in windows first then opened them from there I was SURE to have the correct file to edit.

thanks again

6 Sep 2007, 7:53 PM
#10
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: custom template woes

I have a copy of ZC (multiples, actually) unzipped on my local drive. I can't run ZC locally, but I find it much easier to locate, create and edit folders and files locally and then upload (FTP) them to the appropriate place on the website. Since the folder/file structure is the same, it's pretty easy to match them up.

Always use a text editor to edit php files. Notepad and Crimson Editor are fine. If you have CPanel as your webmaster interface, NEVER use the CPanel editor to edit php files. It messes them up. :blink:

6 Sep 2007, 8:01 PM
#11
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

afo:

I have a copy of ZC (multiples, actually) unzipped on my local drive. I can't run ZC locally, but I find it much easier to locate, create and edit folders and files locally and then upload (FTP) them to the appropriate place on the website. Since the folder/file structure is the same, it's pretty easy to match them up.

Always use a text editor to edit php files. Notepad and Crimson Editor are fine. If you have CPanel as your webmaster interface, NEVER use the CPanel editor to edit php files. It messes them up. :blink:
Yes that is what I do too...I was using htmlkit which I love/d but for some reason it is not matching up the files correctly...Maybe I need to delete and reinstall...I proved the issue by editing the files in notepad and uploading and got the changes I desired for the first times in days...argghhhhh
Thank you for your help...one issue out the way...many more too follow:lookaroun

6 Sep 2007, 8:24 PM
#12
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: custom template woes

You'll get there. :thumbsup:

6 Sep 2007, 8:43 PM
#13
gjh42 avatar

gjh42

Black Belt

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

Re: custom template woes

Peggy, I like Notepad++ (download free from https://www.sourceforge.net) for editing files. It has built-in highlighting and simple error detection features.

6 Sep 2007, 8:59 PM
#14
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

gjh42:

Peggy, I like Notepad++ (download free from https://www.sourceforge.net) for editing files. It has built-in highlighting and simple error detection features.
Thanks...wow... I love it!!!!!

7 Sep 2007, 3:01 AM
#15
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: custom template woes

I haven't tried Notepad++, but I think Crimson Editor is pretty cool for php. Whatever works for you is the best thing to use. :smile:

12 Sep 2007, 9:43 AM
#16
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

afo:

To create a very basic custom template (you can build from there), you need:

[*]includes/languages/YOUR_TEMPLATE/english.php
I was tidying up the custom files I created and moved but when I deleted a file

includes/languages/english.php I got 3 warning messages at the top of my page. (all had init In them)

I did/do have the custom folder set up as above.

includes/languages/custom/english.php

So basically I had the english.php file in both places.

When I added the file english.php back to includes/ languages, the error messages disappeared.

I probably had it set up wrong in the first place but didn't know because it was working ok?

Any views?

12 Sep 2007, 1:40 PM
#17
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: custom template woes

It's not necessary to delete the default files. It's fine to have multiples of the same file. Some folks have different templates for different seasons and simply switch them in the admin as desired. Each template would have an english.php file.

12 Sep 2007, 1:50 PM
#18
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

afo:

It's not necessary to delete the default files. It's fine to have multiples of the same file. Some folks have different templates for different seasons and simply switch them in the admin as desired. Each template would have an english.php file.
yes I know

but what I mean is that the cart is not "reading" the file I created in the custom file

I could delete that (includes/languages/custom/english.php) and it would work form the file in includes/languages.english.php I think.

doesn't this mean that when I upgrade things will go awry?

I obviously still havent got a handle on the custom templates have I?

12 Sep 2007, 2:47 PM
#19
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: custom template woes

Is there a url where I can see the cart? You can send it in a PM if you don't want to post it here.

12 Sep 2007, 2:52 PM
#20
peggy avatar

peggy

Zen Follower

Join Date:
Jul 2007
Location:
UK? US?
Posts:
115
Plugin Contributions:
0

Re: custom template woes

afo:

Is there a url where I can see the cart? You can send it in a PM if you don't want to post it here.

I sent you a PM