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.

eZ debug

Timing: Jan 29 2025 14:44:55
Script start
Timing: Jan 29 2025 14:44:55
Module start 'layout'
Timing: Jan 29 2025 14:44:55
Module start 'content'
Timing: Jan 29 2025 14:44:55
Module end 'content'
Timing: Jan 29 2025 14:44:55
Script end

Main resources:

Total runtime0.0144 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.1328151.2109
Module start 'layout' 0.00470.0022 739.343836.6719
Module start 'content' 0.00690.0061 776.0156102.7813
Module end 'content' 0.01300.0013 878.796945.9766
Script end 0.0143  924.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002315.6710140.0002
Check MTime0.00117.3606140.0001
Mysql Total
Database connection0.00085.251910.0008
Mysqli_queries0.002215.315630.0007
Looping result0.00000.056510.0000
Template Total0.00107.110.0010
Template load0.00085.404610.0008
Template processing0.00021.706910.0002
Override
Cache load0.00063.907010.0006
General
dbfile0.002114.837480.0003
String conversion0.00000.036540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs