Jump to content
thirty bees forum
  • 0

Default contact form subject heading


Jeffrey de Bruijn

Question

Hello,

The default subject heading in the Niara theme is created with

<option value="0">{l s='-- Choose --'}</option>

I do not like this.

All other subject headings are built with a smarty foreach loop.

Given that I know the ID of the subject heading I want as default, how can I get smarty to output the contact.name of the contact I want?

I tried the following which does not work.

<option value="2" selected="selected">{from=$contacts item=contact $key=2 $smarty.get.contact.name}</option>

Option value is set to the ID of the contact I want, how do I tell smarty to: select the contact with id=2 from contacts and give me the contact name?

EDIT:

This works

{foreach from=$contacts item=contact}
    <option value="{$contact.id_contact|intval}"{if (isset($smarty.request.id_contact) && $smarty.request.id_contact == $contact.id_contact) || (!isset($smarty.request.id_contact) && $contact.id_contact == 2)} selected="selected"{/if}>{$contact.name|escape:'html':'UTF-8'}</option>
{/foreach}

With the exception that the contact description is now shown on the default

P.S. the code clearly suggests that the id.contact can be set, but how? With a specific url?

EDIT 2:

To link to a specific contact, add ?id_contact=N to the url, where N is the ID of the contact you want to link to. The following example assumes the contact with ID number 3 is the first additional contact added to thirty bees:

domain.tld/en/contact-us?id_contact=3

 

Edited by Jeffrey de Bruijn
Added answer
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...