How to apply a class to a <p> tag

Author Message

Andy Woods

Friday 15 April 2011 8:59:41 am

Is it possible to apply the following class to a <p> tag using ezoe:

<p class="large">

I can see that I can select the html within the ezoe and then click on the Paragraph element at the bottom of the editor which then opens a popup window. I can see that there is a class drop-down menu where I could choose a class to apply.

Can you tell me how I can add a class item to the drop-down list for me to select please?

Thanks,

Andy

Carlos Revillo

Friday 15 April 2011 9:26:08 am

hi Andy.

Have a look at https://github.com/ezsystems/ezpublish/blob/master/settings/content.ini#L143

that's it. you can add your "available classes" in one of your content.ini.append.php files. clear your caches and 'large' should appear in the drop-down

Andy Woods

Friday 15 April 2011 10:19:28 am

Thanks - worked a treat.

Can you tell me how I can add an <HR> tag to the online editor?

Andy

Carlos Revillo

Friday 15 April 2011 10:38:48 am

You probably need a custom tag for that.

again in the same file have a look at https://github.com/ezsystems/ezpublish/blob/master/settings/content.ini#L112

you can add a custom tag to that list.

After this, you need to add a template for the output part. this template should be in one your design/[whatever_design_used_by_your_site]/templates/content/datatype/view/ezxmltags.

have a look at factbox.tpl file for an example.

Andy Woods

Friday 15 April 2011 11:23:30 am

I've followed what you suggested and I can select the 'hr' option from within the Custom Tag popup but it doesn't display the <hr> when I browse the site.

I added hr.tpl to the folder /extension/my_extension/design/ezwebin/override/templates/datatype/ezxmltext/hr.tpl

Seems like a lot of work to display a simple <hr> tag.

Marko Žmak

Saturday 16 April 2011 5:21:28 am

"

I've followed what you suggested and I can select the 'hr' option from within the Custom Tag popup but it doesn't display the <hr> when I browse the site.

I added hr.tpl to the folder /extension/my_extension/design/ezwebin/override/templates/datatype/ezxmltext/hr.tpl

Seems like a lot of work to display a simple <hr> tag.

"

Jus a few tips to check:

  • you must add the definition of your custom tag to override/content.ini... (or to all siteaccesses you're using)
  • try clearing the cache

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Sander van den Akker

Monday 18 April 2011 1:03:06 am

Try putting it here: /extension/<extension_name>/design/ezwebin/templates/content/datatype/view/ezxmltags/hr.tpl

The override folder is meant for overrides of already existing templates.

eZ Publish certified developer
http://auth.ez.no/certification/verify/392313

Andy Woods

Monday 18 April 2011 2:02:23 am

Thank you - that made it work.

Andy

kirill starikov

Thursday 21 April 2011 9:12:31 am

isn't there an easier way to do this rather than add custom tags to the list and then creating templates for them?

Marko Žmak

Thursday 21 April 2011 11:24:45 pm

"

isn't there an easier way to do this rather than add custom tags to the list and then creating templates for them?

"

I think there is not. But it's not so diffivcult, once you get the hang of it it's just a 5 minute job.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Andy Woods

Friday 22 April 2011 3:04:22 am

I have to say once I was told the correct place to put the template it was very easy to implement.

Andy

Nicolas Pastorino

Friday 22 April 2011 3:18:19 am

"

I have to say once I was told the correct place to put the template it was very easy to implement.

"

+1, a very low-load task.
Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.