Forums / Templates, Stylesheets, Page Layout / How to add labels to new fields

How to add labels to new fields

Locked

Views: 1,247

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
1 Feb 2007, 10:05 AM
#1
kappaluppa avatar

kappaluppa

New Zenner

Join Date:
Nov 2006
Posts:
68
Plugin Contributions:
0

How to add labels to new fields

I'm adding new fields to the checkout page. With a combo of instructions from various posts, I'm half way there.

I'm using the following to create the text box:
<?php echo zen_draw_input_field('NEW_LAUDER_FIELD'); ?>
That works, I can make lots of text boxes/input fields.

I found where to define NEW_LAUDER_FIELD In the: /includes/templates/custom/templates/checkout_shipping.php

This is how I defined it:
[COLOR=Red]define('NEW_LAUDER_FIELD', 'New Lauder Field');

Next I need to put the label for the text box/input field next to it (so people know what info to enter into the text box/field.)

I found this code:
<label class="inputLabel" for="firstname"><?php echo ENTRY_FIRST_NAME; ?></label>

<?php echo zen_draw_input_field('firstname'); ?>

When I use the code above a text box/input field with the label First Name appears next to it. That is good.

So I can figure out where ENTRY_FIRST_NAME is defined (includes/languages/custom/english.php), but I don't know where "firstname" (lower case, no spaces) is defined. This seems to be key to creating my label for the box.

I've duplicated the whole thing that works with firstname and replaced 'firstname' with the NEW_LAUDER_FIELD info like so:
<label class="inputLabel" for="newlauderfield"><?php echo NEW_LAUDER_FIELD; ?></label>

<?php echo zen_draw_input_field('newlauderfield'); ?>

But what I get is
NEW_LAUDER_FIELD [ empty field box ]

I want it to be:
New Lauder Field [ empty field box ]
as defined in checkout_shipping.php

** I don't know where 'newlauderfield' is supposed to come from or where it is defined, or if that is even right. I think this is the key to my problem.**

I know I went a little overboard on the description, but I wanted to be real clear. I hope I didn't make it more confusing in the process!

It seems like I'm missing something VERY simple.

Thanks for any help you can give!
Kathy

1 Feb 2007, 3:39 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: How to add labels to new fields

Template files are not the right place to define your language components

I found where to define NEW_LAUDER_FIELD In the: /includes/templates/custom/templates/checkout_shipping.php
That constant should be defined in includes/languages/english/custom/checkout_shipping.php, or if you want it used on more than just the checkout shipping page, add it in to includes/languages/custom/english.php

The value 'firstname' for the input field isn't defined anywhere - it's simply the name for the input box, and is used to identify the POST data when processing the form (to perform an action with the input data you'd perform some action with $_POST['firstname'])

Neville
An assumption is what you arrive at when you get tired of thinking...

1 Feb 2007, 3:53 PM
#3
kappaluppa avatar

kappaluppa

New Zenner

Join Date:
Nov 2006
Posts:
68
Plugin Contributions:
0

Re: How to add labels to new fields

Actually, I have it in
includes/languages/custom/english/custom_shipping.php

"custom" is my custom template folder I've created so I can use the overrides.

(" Custom" could actually be called "mytemplate")

I've defined NEW_LAUDER_FIELD there but it is not showing up correctly. Could it by I put my custom folder in the wrong directory? Your instruction was that I change this file:
includes/languages/english/custom/checkout_shipping.php

this is the structure I have:
includes/languages/custom/english/custom_shipping.php

1 Feb 2007, 5:41 PM
#4
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: How to add labels to new fields

Your override structure is incorrect. Put the new define in includes/languages/english/custom/checkout_shipping.php

Neville
An assumption is what you arrive at when you get tired of thinking...

3 Feb 2007, 5:33 AM
#5
kappaluppa avatar

kappaluppa

New Zenner

Join Date:
Nov 2006
Posts:
68
Plugin Contributions:
0

Re: How to add labels to new fields

hooray! that worked!

So are you telling me that in the overrides folder I don't keep the same file structure that would be in place if i wasn't using overrides?

3 Feb 2007, 6:16 PM
#6
gjh42 avatar

gjh42

Black Belt

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

Re: How to add labels to new fields

There are two different places for override folders in the /languages folder.
Look at the locations of /classic folders.

Generally you use an override folder just above the file. The exception is in the /template folder which is intended to hold overrides, so it is set up to allow folders under your /custom folder.