Forums / Setup & design / How to apply a class to a <p> tag

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

eZ debug

Timing: Jan 17 2025 22:54:13
Script start
Timing: Jan 17 2025 22:54:13
Module start 'content'
Timing: Jan 17 2025 22:54:14
Module end 'content'
Timing: Jan 17 2025 22:54:14
Script end

Main resources:

Total runtime0.7520 sec
Peak memory usage4,096.0000 KB
Database Queries229

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0092 588.8438180.8438
Module start 'content' 0.00920.6161 769.6875801.5859
Module end 'content' 0.62530.1266 1,571.2734349.3359
Script end 0.7519  1,920.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.5866210.0002
Check MTime0.00160.2080210.0001
Mysql Total
Database connection0.00060.086010.0006
Mysqli_queries0.655987.21712290.0029
Looping result0.00220.29622270.0000
Template Total0.709694.420.3548
Template load0.00220.289120.0011
Template processing0.707494.073520.3537
Template load and register function0.00020.021110.0002
states
state_id_array0.00100.137510.0010
state_identifier_array0.00080.109920.0004
Override
Cache load0.00200.2668600.0000
Sytem overhead
Fetch class attribute can translate value0.00130.174170.0002
Fetch class attribute name0.00090.1194150.0001
XML
Image XML parsing0.00310.410070.0004
class_abstraction
Instantiating content class attribute0.00000.0040160.0000
General
dbfile0.00791.0448420.0002
String conversion0.00000.001430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
12content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 39
 Number of unique templates used: 9

Time used to render debug report: 0.0002 secs