Share » Forums » Developer » specifying the css class to be used...

specifying the css class to be used in the xml tags (i.e <strong>,<emphasize>) when provided in the xml text field.

specifying the css class to be used in the xml tags (i.e <strong>,<emphasize>) when provided in the xml text field.

Saturday 28 June 2003 3:08:27 am - 7 replies

Author Message

Paul Forsyth

Saturday 28 June 2003 8:08:42 am

i guess you've read:

http://ez.no/developer/ez_publish_3/forum/general/online_editor_for_31

From what i've gathered with 3.1 there is space to add a class. If you've installed 3.1 have a look at the manual and everyday functions for tag information that mentions this. Ez haven't updated their own ez.no/manual site yet with new 3.1 docs.

paul

M Farhan

Sunday 29 June 2003 4:07:42 am

Thanks for the reply Paul, but i am using 3.0.2 version of eZPublish, isn't there any option for doing the same in it.

Paul Forsyth

Sunday 29 June 2003 8:13:03 am

Ah, i see.

Ok, two ways to proceed.

First would be to look at the tpl files that the xml datafield uses to display its information. Theses are usually within:

design/standard/templates/content/datatype/view/ezxmltags/

You could override these tpl files in your design and add class tags where you wish.

The fallback approach would be to look at the html output and wrap the code, like you did with the input fields, with html specifying a css class to override anything the xml datafield does. Takes a little to play with but does work. Sometimes I find i have to go back and forward from the html source to fine tune it. In this way i can make headings and things are as i like.

Once you get used to way css works for this type of thing it becomes easier to use.

paul

M Farhan

Monday 30 June 2003 4:27:58 am

Thanks again Paul that was indeed of help, but in both the case which u have suggested, it would something hardcoded, where the same style sheet class would be used for a perticular tag, for example if i hard code the class in the .tpl file for the <strong> tag (in the ezxmltags dir or in the .tpl used for rendering the page) the same style sheet would be applied everytime i use this tag in the xmltextfield in any of the pages/nodes.

I am looking for something dynamic, where the user has more control of the presentation.

Thanks in advance.
MF

Paul Forsyth

Monday 30 June 2003 7:06:42 am

I see your point.

But this is where some ez features come in handy. The second method I mentioned involved wrapping a css class around the code to display the xml field.

You can perform tests within the tpl code to make sure that your css class is only used when you want it. For example:

{section name=TestArticle show=eq($node.object.contentclass_id, 1)}
<td class="strong">
{section-else}
<td>
{/section}
{attribute_view_gui attribute=$node.contentobject_version_object.data_map.heading}
</td>

Here the first statement will only show if the current article node is a folder. You can make this kind of check more specific if you wish, choose your new class, etc. I hope you see what is possible here.

paul

M Farhan

Tuesday 01 July 2003 12:23:17 am

Well this seems to be a good option where you can provide some of the dynamic functionality i am looking for, but then again what if the tag (e.g. <strong>) has been used twice in the same XMLtextfield (in a Node/ContentObject) and for one of them i want the text in the <strong> tag to be shown in blue colour and in the other in green. I doubt there would be any flexibility in doing such a thing??, the suggestion you have given would be restricted to just one perticular type of node.

Thanks again.

MF

Paul Forsyth

Tuesday 01 July 2003 1:13:19 am

As i mentioned you can specialise this in any way you wish so adding more logic to make the cases more specific is possible.

But its a list of trade offs. On one hand you have 3.1 and on the other the time spent working out the logic to make sure only certain classes get used. In our code we use a lot of logic to present menus and the like to users.

The upgrade path isn't too difficult to be honest ;)

paul

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu