Listing Input Form Modification

Top  Previous  Next

In this section you will learn how to:

 

 

By default, there are two listing input forms in the system:

1.

The /templates/[Theme Name]/classifieds/input_form_HomesForSale.tpl file is used to display the input form for 'Homes for Sale' listing type.

2.

The /templates/[Theme Name]/classifieds/input_form_HomesForRent.tpl file is used to display the input form for 'Homes for Rent' listing type.

 

See the default listing input form for 'Homes for Sale' listing type on the Pic.1. The listing input forms use the syntax which you can see in the notes (Pic.1.) to display the fields.

 

The administrator can change field names, add new fields to this form and modify the look and feel of a field.

 

add_listing1

 

Pic.1. Default Listing Input Form.

 

 

 

Change a Caption of a Field

 

For instance, you want to change 'Price $' to 'Selling Price $' and 'Baths' to 'Number of Baths' on the 'Add Listing' page (Pic.1.).

 

 

The 'Baths' field is a common field for all listing types.

 

To find common fields:

Go to Admin Panel -> Listing Management -> Listing Fields

To edit a field caption:

Open Edit listing field

Change the caption

The field caption will change automatically in the template (see Pic.2).

 

 

The 'Price' field is a specific field for the 'Homes for Sale' listing type.

 

To find specific fields:

Go to Admin Panel -> Listing Management -> Listing Types

To edit a field caption:

Open Edit Listing Type Info

Click the Edit button against the field name

Change the caption

The field caption will change automatically in the template (see Pic.2).

 

Notice: If you change IDs of the existing fields, you will have to change them in the templates, where these IDs are used.

 

          add_listing2

 

Pic.2. Changed Names of the Existing Listing Fields.

 

 

Add New Listing Fields

 

 

To add a new field, e.g., 'Distance to Downtown' field (float type):

Go to Admin Panel -> Listing Management -> Listing Fields

Add the new field ('ID'='DistanceToDowntown', 'Caption'='Distance to Downtown', 'Type'='Float')

 

 

To display this field after the 'Baths' field on the listing input form:

Open the file /templates/[Theme Name]/classifieds/input_form_HomesForSale.tpl

Locate the following code:

 

    <tr>

            <td>{$form_fields.Baths.caption}:</td><td colspan="5">{input property=Baths}</td>

    </tr>

 

    This code displays the 'Baths' field (its caption and input box). (Pic.3.)

After it, insert the following lines:

 

    <tr>

            <td>{$form_fields.DistanceToDowntown.caption}:</td><td>{input property=DistanceToDowntown}</td>

    </tr>

 

These lines display the 'Distance to Downtown' field (its caption and input box). (Pic.3.)

 

If you don't specify your own template for this field, this field will be displayed like in the default template (float.tpl). Pic.3 shows how the field will look like:

 

add_listing3      

 

Pic.3. Added Listing Field.

 

 

Modify the Look and Feel of a Field

 

The look and feel of a field is determined by templates of a relevant field type. These templates are located at /templates/[Theme Name]/field_types/input . This folder contains a set of templates for each database field type.

 

 

To display input form fields, use the following syntax:

 

{input property = [Listing Field ID] template = [Your Template Name]}

 

If you do not specify the template (template = [Your Template Name]), the system will display the default template of a type.

 

E.g., the 'Price' field is the integer type and you specify {input property = Price}. As a result, the 'Price' field will be displayed according to its default template: /templates/[Theme Name]/field_types/input/integer.tpl.

 

 

To alter the way a listing field  looks like, e.g., 'Drive Type' field (list type):

Create a new file of  '.tpl' format in the folder   /templates/[Theme Name]/field_types/input/ (e.g.'list_radio.tpl')

Add the code to this file:

 

{foreach from=$list_values item=list_value}

 

    <input type="radio" name='{$id}' value='{$list_value.id}' {if $list_value.id == $value}checked{/if} > {$list_value.caption}

 

{/foreach}

 

Specify the newly created file as a template for the 'Beds' field:

Open /templates/[Theme Name]/classifieds/input_form_HomesForSale.tpl

In it, locate the code:

<td colspan="5">{input property=Beds}</td>

Replace it with following:

<td colspan="5">{input property=Beds template='list_radio.tpl'}</td>

 

The 'Beds' field will be displayed as on Pic.4.

 

          add_listing4

 

Pic.4. Alter the Way a Listing Field Looks Like

 

 

Note: The above changes to the 'Add Listing' page (the listing input form) will be also displayed on the 'Edit Listing' page.