Customizing SMF > Graphics and Templates

Adding multiline text field to theme's options

(1/2) > >>

Orangine:
I want to add Google Analytics code field to my theme, here's my code from Settings.template.php:

--- Code: ---      array(
         'id' => 'analytics',
         'label' => $txt['analytics'],
         'description' => $txt['analytics_desc'],
         'type' => 'text',
      ), 
--- End code ---
however it's only showing one line, when GA's code is severeal. How do I change it so it would allow me to insert multiline content?   

Arantor:
Not without a significant rewrite.

Mind you, you could avoid making it a multi-line edit by looking at what was done in Google Analytics Code.

It's not really something you want to be set per theme, is it? Surely you want to set the code once and have it be run in all themes? (Which that mod does.)

Orangine:
Actually that was the plan, as I wanted to use the setting for Analytics and from within the <head> to call some extra code (i.e. jquery), but fair enough I will think about using a mod for this. I'm wondering why it's not possible to use sth like textarea?

Arantor:
Because the theme settings code is only built to support what SMF itself uses, which is single-line textboxes, checkboxes and selects.

Also, why do you need a multi-line textbox for things like jQuery? Make it a checkbox or at worst a single-line textbox for stating the version of jQuery.

Orangine:
I'm sorry, but you're assuming too much. I want such a functionality and I am not here discussing why or if I need it, I only want to know how to get it.
I know how to make checkboxes, what I don't know is how to make a textarea input. You have already mentioned that it's not something I could easily do and that's where you should stop.

Navigation

[0] Message Index

[#] Next page

Go to full version