Forums / Setup & design / override layout for attributes

override layout for attributes

Author Message

Matt Brady

Thursday 26 October 2006 9:06:58 pm

I'm trying to redesign the attributes layout of a create/edit class but not sure how to do it.
What I wanted to do was just override the edit.tpl and lay out the form so that it looks better and has the correct field sizes but I'm having no luck.

For example: Within a class I create a new text attribute "post code" with max string length of 4. When I go to create a new object the default layout of the edit form all text fields are the same size. I want to at least get the fields the correct size.

Is this the best way to do this or am I way off... can anyone give a few pointers here?

It's not easy being easy.

Daniele Nocentini

Tuesday 31 October 2006 2:39:23 am

maybe you must override only text attribute datatype template instead edit.tpl, try to override this:

standard\templates\content\datatype\edit\eztext.tpl for your class or only a single specified attribute.

Antica Bottega Digitale srl
http://www.abd.it

Matt Brady

Tuesday 31 October 2006 1:50:05 pm

Hi Daniele,
Thanks for that... yes, that's the first thing I did however I couldn't quite grasp it... you can't select the class and attribute through the template wizard so I assume you need to rewrite the template for each text field. So... the default is
----------------------------------------------------
{default attribute_base='ContentObjectAttribute' html_class='full'}
<textarea id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}" class="{eq( $html_class, 'half' )|choose( 'box', 'halfbox' )} ezcc-{$attribute.object.content_class.identifier} ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier}" name="{$attribute_base}_data_text_{$attribute.id}" cols="70" rows="{$attribute.contentclass_attribute.data_int1}">{$attribute.content|wash}</textarea>
{/default}
----------------------------------------------------
My class is content_report and attribute is postcode. Now I want to change the field to be only 4 characters long and restricted to 4 characters.... I also want to add some text beside the label.
Any idea how I would change the template to suit? Once I have one done it will make a lot more sense to me and I'll be able to edit the others with no prob.

Any help here would be greatly appreciated.

It's not easy being easy.