Forums / Templates, Stylesheets, Page Layout / Help, I still don't understand override folders

Help, I still don't understand override folders

Views: 1,290

Results 1 to 12 of 12
24 Oct 2011, 6:52 PM
#1
paulclane avatar

paulclane

New Zenner

Join Date:
Feb 2009
Posts:
23
Plugin Contributions:
0

Help, I still don't understand override folders

hi Clever Zenned ones!

I have tried and tried to understand the override folders, but still don't understand it. I have a live shop, so don't want to rock the boat, but need to update from 1.3.7.

An example of my problem:

I have an override folder here: catalog/includes/languages/my_custom/ and this works great

But what about this custom page, (was page 2): catalog/includes/templates/template_default/templates/tpl_General_Security_Tips_default.php. There seems to be bits of the page config in lots of different folders.

where should this override folder be? Should it be inside
catalog/includes/templates/template_default/my_custom/
or
catalog/includes/templates/my_custom/
or even
catalog/includes/my_custom?

Basically, I don't know what folder level to put my /my_custom/ folders in. Is it in the same level or back one, etc?

Also: this is one of my pages; http://www.cctvireland.ie/catalog/index.php?main_page=General_Security_Tips

At the top of the page it says "Home" then "NAVBAR_TITLE" Which I don't want
The Main heading is: "General_Security_Tips" which looks stupid with the underlines instead of spaces, but if I take them out the page doesn't display.

I have spent ages trying to resolve this, but can't, so any help would be appreciated.

I think one of the main problems is that some of my overrides work, and some don't. One of the biggest mistakes is that when I had an override folder that worked I didn't remove the default folder/file that was no longer needed, so am now totally confused with lots of near identical folders..

24 Oct 2011, 6:55 PM
#2
afo avatar

afo

Totally Zenned

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

Re: Help, I still don't understand override folders

The override folder goes on the same level as the FOLDER of the file you are overriding, so if you are overriding includes/templates/template_default/templates/tpl_General_Security_Tips_default.php, it would go in includes/templates/my_custom/templates/tpl_General_Security_Tips_default.php

This list is a bit outdated, but it'll give you an idea where to start to create a very basic custom template (you can build from there):

  • includes/languages/YOUR_TEMPLATE/english.php
  • includes/languages/english/YOUR_TEMPLATE/index.php
  • includes/languages/english/YOUR_TEMPLATE/meta_tags.php
  • includes/languages/english/YOUR_TEMPLATE/header.php (to change the logo and header text)
  • includes/templates/YOUR_TEMPLATE/template_info.php
  • includes/templates/YOUR_TEMPLATE/common/tpl_header.php <- may not be necessary
  • includes/templates/YOUR_TEMPLATE/common/tpl_footer.php <- may not be necessary
  • includes/templates/YOUR_TEMPLATE/images/logo.gif (or .jpg or .png)
  • 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.

Note: if you've changed the height of the logo in header.php, you may need to change it in your stylesheet as well:

#logoWrapper{
background-image: url(../images/header_bg.jpg);
background-repeat: repeat-x;
background-color: #ffffff;
height:75px; <-adjust this line if necessary
}

Mary Ellen
I came; I saw; I Zenned
Taking over the world... one website at a time
Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

Holzheimer
Fan Odyssey

24 Oct 2011, 7:23 PM
#3
paulclane avatar

paulclane

New Zenner

Join Date:
Feb 2009
Posts:
23
Plugin Contributions:
0

Re: Help, I still don't understand override folders

Very helpful, very clear, very fast, thanks!

now, maybe somebody could help me with the second half of my post.........

24 Oct 2011, 7:54 PM
#4
afo avatar

afo

Totally Zenned

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

Re: Help, I still don't understand override folders

It appears you are editing the files incorrectly.

The original definition of NAV_BAR_TITLE was probably something like this (I colored the single quotes to make it clearer):

define('NAVBAR_TITLE', 'My Account');

To remove the literal, it should look like this:

define('NAVBAR_TITLE', '');

To change the definition, it should look like this:

define('NAVBAR_TITLE', 'Security Tips');

Same applies for General_Security_Tips

Mary Ellen
I came; I saw; I Zenned
Taking over the world... one website at a time
Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

Holzheimer
Fan Odyssey

24 Oct 2011, 8:38 PM
#5
paulclane avatar

paulclane

New Zenner

Join Date:
Feb 2009
Posts:
23
Plugin Contributions:
0

Re: Help, I still don't understand override folders

Ok, so I'm going through each file/folder one by one and I haven't quite got the hang of it:

first:

From:

includes/languages/english/index.php

into:

includes/languages/english/my_custom/index.php

(that doesn't seem right). When I moved this index.php the site still worked, but I then renamed it randomly and it still worked. Is it the right index.php file?

Second:

From:

/includes/languages/english/before_process.php

into:

/includes/languages/english/my_custom/before_process.php

I think this should be the right one:

/includes/languages/CCTVIRELAND/english/before_process.php

(This is a very important file for my CC transactions, is this the right location for the my_custom folder?).

Third:

includes/languages/english/my_custom/meta_tags.php

where do I get this meta_tags.php from?

Fourth:

I moved header.php from:

/includes/languages/english/header.php

to:

/includes/languages/my_custom/english/header.php

It didn't work. Where should my_custom folder go?

On the plus side:

Overrides are now working perfectly for:
english.php
tpl_header.php
tpl_footer.php
template_info.php
logo.jpg
stylesheet.css

Thanks for the help!

24 Oct 2011, 9:02 PM
#6
rescoccc avatar

rescoccc

Totally Zenned

Join Date:
May 2010
Location:
WA State
Posts:
1,700
Plugin Contributions:
2

Re: Help, I still don't understand override folders

I moved header.php from:

/includes/languages/english/header.php

to:

/includes/languages/my_custom/english/header.php

It didn't work. Where should my_custom folder go?

You have this one in the wrong order. Should be english/your_template/

The best way to learn is to try stuff. But, back it up first.

24 Oct 2011, 9:09 PM
#7
paulclane avatar

paulclane

New Zenner

Join Date:
Feb 2009
Posts:
23
Plugin Contributions:
0

Re: Help, I still don't understand override folders

I have really confused myself now!

I can't find: define('NAVBAR_TITLE' (Loads of these, but not the three relevent ones)

I have searched using developers toolkit, all file look-ups

All I can find is:

<div class="centerColumn" id="General_Security_Tips"> <h1 id="pageFourHeading"><?php echo General_Security_Tips; ?></h1>

I feel very stupid now, I really need somebody to hold my hand on this!

24 Oct 2011, 10:01 PM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Help, I still don't understand override folders

One of the biggest mistakes is that when I had an override folder that worked I didn't remove the default folder/file that was no longer neededYou should NEVER remove default files/folders. The whole point of overrides is that Zen Cart will auto-detect and use them instead of the default when they exist. In some cases, I believe the default files are needed to let Zen Cart know that there is something that can be overridden.

The basic rule for override folders is, in /includes/templates/ folders you use /includes/templates/your_template_name/ followed by the exact same folder structure as /template_default/ has; in other areas (like /includes/languages/ and /includes/modules/) you create a mini /your_template/ folder in the same folder where the original file is (alongside the /classic/ folder). The /classic/ folders are guides to where you can use overrides. If there is no /classic/ folder, it is not possible to override the files at that level.

25 Oct 2011, 7:42 AM
#9
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Help, I still don't understand override folders

paulclane:

I have really confused myself now!

I can't find: define('NAVBAR_TITLE' (Loads of these, but not the three relevent ones)

I've just used the dev toolkit myself (to see if I can point you in the right direction) and unlike most of the zencart 'defines' (which are usually only found in one or two files) this particular one gets redefined dependent on which file is being used at any given time. This makes the task a little harder than usual for such settings. I can't explain why you can't see the relevent ones, unless someone has deleted them

The "General_Security_Tips" is a different(?) issue, and I hope I don't offend anyone, but whoever coded this has no regard for coding standards.

paulclane:

<div class="centerColumn" id="General_Security_Tips">

This is used for formatting/layout purposes. Somewhere in you .css files you should find a similar reference that would/should set various display parameters associated with this "id".
If there are none, then the styling is effectively ignored. Defualt values are used.

paulclane:

<h1 id="pageFourHeading"><?php echo General_Security_Tips;

This is where/why you are seeing "General_Security_Tips" rather than "General Security Tips". In simple terms, there isn't a 'define' for this entry, so the code is just displaying what it has (much the same reason why you are seeing "NAVBAR_TITLE" rather than something more useful).

IF this is the only place where this supposed definition is used you can safely change the line to read

<?php echo "General Security Tips" ; However, if it is used elsewhere then a definition will be in order, something along the lines of define('General_Security_Tips', 'General Security Tips'); This is where/why I stated there is little regard to standards, because the "correct" define should be more like define('GENERAL_SECURITY_TIPS', 'General Security Tips'); BUT, for this to work correctly, the code: <?php echo General_Security_Tips; will need to be modified to read: <?php echo GENERAL_SECURITY_TIPS; The same change will need to be made in any other place that uses "echo General_Security_Tips" If you can follow all of this I don't think you'll have too many other problems. If you can't follow it, just keep in mind that a 'define' that hasn't been defined will show the 'key' of the definition (which will almost always be in ALL_CAPS), rather than the text you actually want. Cheers Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

23 Nov 2011, 7:53 PM
#10
paulclane avatar

paulclane

New Zenner

Join Date:
Feb 2009
Posts:
23
Plugin Contributions:
0

Re: Help, I still don't understand override folders

Apologies for being sooooo slow to respond:

RescoCCC, the english.php re-direct is now working perfectly, Thanks!

RodG, when I edit:

<?php echo General_Security_Tips; to <?php echo General Security Tips; the content is blank when I add: define('General_Security_Tips', 'General Security Tips'); I get this at the top of the page: General_Security_Tips define('General_Security_Tips', 'General Security Tips'); So it's just treating it as text This is the entire .php: /** * Page Template * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_page_4_default.php 3464 2006-04-19 00:07:26Z ajeh $ */ ?> <div class="centerColumn" id="General_Security_Tips"> <h1 id="pageFourHeading"><?php echo General_Security_Tips; ?></h1> <?php if (DEFINE_PAGE_4_STATUS >= 1 and DEFINE_PAGE_4_STATUS <= 2) { ?> <div id="pageFourMainContent" class="content"> <?php /** * require the html_define for the page_4 page */ require($define_page); ?> </div> <?php } ?> <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div> </div>

where should I add the define?

23 Nov 2011, 8:12 PM
#11
gjh42 avatar

gjh42

Black Belt

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

Re: Help, I still don't understand override folders

<h1 id="pageFourHeading"><?php echo General_Security_Tips; ?></h1>
```This needs to be```php
<h1 id="pageFourHeading"><?php echo 'General Security Tips'; ?></h1>
```or else```php
<h1 id="pageFourHeading"><?php echo GENERAL_SECURITY_TIPS; ?></h1>
```with ```php
define('GENERAL_SECURITY_TIPS', 'General Security Tips');
``` in a language file like english.php, or a new language file for your custom defines.
23 Nov 2011, 8:40 PM
#12
paulclane avatar

paulclane

New Zenner

Join Date:
Feb 2009
Posts:
23
Plugin Contributions:
0

Re: Help, I still don't understand override folders

Thanks for the help guys, much appreciated!!

I have my overrides working, my custom pages properly titled and my sanity back.

I still have Home :: NAVBAR_TITLE showing at the top of the page, but it's only small, I'll work on it another time.

Now all I have to do is install the latest Zencart version and hope I don't blow up my site in the process! :yes: