Forums / Setup & design / CSS class doesn't show when link is image, not text

CSS class doesn't show when link is image, not text

Author Message

Yasen Georgiev

Friday 30 April 2010 3:31:25 am

Hi,

This is my first post here (very new to EZ Publish at all), so please bear with me if I'm asking something trivial :)

Well, I have customized my extension/ezoe/settings/content.ini.append.php to allow custom CSS classes to be added to links:

[link]
...
AvailableClasses[]=issuu
AvailableClasses[]=slideshow

After this, I'm able to set the classes "issuu" and "slideshow" to the text links in the WYSIWYG editor for the content.

And this works when the link is text link.

However, when I insert an image and make it link and select the link class to be "slideshow" for example, the CSS class doesn't go to the link attributes.

Please, advise if I missed something or I did something wrong ?

Regards,
Yasen Georgiev

Robin Muilwijk

Friday 30 April 2010 1:31:17 pm

Hi Yasen,

First welcome to the community portal. Second, about your problem applying classes to images, have a look at http://share.ez.no/forums/setup-design/solved-classes-for-images-in-oe.

That topic might provide you with a solution. If not, please post again and let us know.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Sunday 02 May 2010 11:52:42 pm

Hi Robin,

Thanks for the warm welcome :)

I've searched the forum before posting and found the topic you've suggested. I've tried it, but without success.

I've checked which template renders the image within the link that I've set as "slideshow". I found that actually there are 3 templates for rendering an embedded image. Here are the used templates:

design/standard/templates/content/datatype/view/ezxmltags/embed.tpl
extension/ezwebin/design/ezwebin/override/templates/embed/image.tpl
extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezimage.tpl

In the first one - embed.tpl - there is a variable $link_parameters which has a property class that contains the right CSS class I've set - "slideshow".

In the second template - image.tpl - there is also a variable $link_parameters which holds the proper CSS class name.

However in the third template - ezimage.tpl - there is no $link_parameters variable. There are two other variables - $link_class and $css_class that I thought might contain data abouth the CSS class "slideshow", but no luck :)

I've tried to pass the $link_parameters from image.tpl to ezimage.tpl like this (image.tpl):

{attribute_view_gui attribute=$object.data_map.caption link_parameters=$link_parameters}

but again no luck :) In the ezimage.tpl I get the passed variable $link_parameters as not defined.

Also, when I'm editing the content via the WYSIWYG editor, when I check the HTML source code for the embedded image within the link, it is properly rendered with the CSS class "slideshow" (the A tag that is wrapping the image). However when I publish the content the link doesn't contain the CSS class anymore.

I suppose if I can pass the $link_parameters to ezimage.tpl or find where the A tag is stripped upon publishing, this could help. Or any other solution, of course :)

Any suggestions are highly welcomed!

Regards,
Yasen Georgiev

Robin Muilwijk

Monday 03 May 2010 11:35:21 am

Hi Yasen,

Which version are you using? I could not find the file

extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezimage.tpl

Thanks Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Monday 03 May 2010 11:51:29 am

Hi Robin,

I'm using 4.2 with ezwebin.

Regards,
Yasen Georgiev

Robin Muilwijk

Tuesday 04 May 2010 11:31:26 am

Hi,

Could it be that ezimage.tpl comes from \design\standard\templates\content\datatype\view?

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Wednesday 05 May 2010 2:35:55 am

It could be. Perhaps I have it somewhere overridden. I'll dig into that direction.

Thanks Robin!

Regards,
Yasen Georgiev

Yasen Georgiev

Wednesday 05 May 2010 7:54:16 am

Problem solved :)

The problem was that in the second template:

extension/ezwebin/design/ezwebin/override/templates/embed/image.tpl

the link class parameter was not passed to the third template:

extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezimage.tpl

within the {attribute_view_gui ...} statement.

And it was expected in the third template as a variable $link_class.

So, I've just passed it :) from the second template:

{attribute_view_gui attribute=$object.data_map.image link_class=$link_parameters.class image_class=$object_parameters.size ...... }

I don't know if the missing of this parameter is intentional or implemented somewhere else, but now applying a CSS class to a link when you have an image instead of text, works :)

Or it could be a bug and if so, it should be reported. But I don't know how to make sure if it's a bug or just a problem on my side.

Regards,
Yasen Georgiev

Robin Muilwijk

Wednesday 05 May 2010 11:00:00 am

Hi Yasen,

Good to see you fixed it. Could you mark your original post as Solved? (Should be a checkbox if you edit it). I've passed on a message to one of the dev's so he can check if this is a bug or not.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Wednesday 05 May 2010 12:50:05 pm

Hi Robin,

Thanks a lot for the support!

Regards,
Yasen Georgiev

Robin Muilwijk

Thursday 06 May 2010 12:17:50 am

Hi Yasen,

The developer confirmed this as a bug, could you please report it on the issue tracker? See http://issues.ez.no/

Thanks, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Monday 10 May 2010 8:41:48 am

Done :)

Thanks for all the support, Robin!

Regards,
Yasen Georgiev

André R.

Wednesday 19 May 2010 10:17:33 am

I guess this is caused by lines bellow in settings/override/content.ini.append.php, you can comment them out using "#" to fix it.

[embed-type_images]
AvailableClasses[]

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

eZ debug

Timing: Jan 18 2025 05:14:16
Script start
Timing: Jan 18 2025 05:14:16
Module start 'content'
Timing: Jan 18 2025 05:14:17
Module end 'content'
Timing: Jan 18 2025 05:14:18
Script end

Main resources:

Total runtime1.4115 sec
Peak memory usage4,096.0000 KB
Database Queries226

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.2891180.8125
Module start 'content' 0.00561.1983 770.1016721.0156
Module end 'content' 1.20390.2075 1,491.1172352.4297
Script end 1.4114  1,843.5469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.2837210.0002
Check MTime0.00150.1055210.0001
Mysql Total
Database connection0.00070.050410.0007
Mysqli_queries1.281490.78602260.0057
Looping result0.00310.21892240.0000
Template Total1.379997.820.6900
Template load0.00220.157620.0011
Template processing1.377797.606720.6888
Template load and register function0.00060.039410.0006
states
state_id_array0.00170.120210.0017
state_identifier_array0.00100.073920.0005
Override
Cache load0.00210.14531040.0000
Sytem overhead
Fetch class attribute can translate value0.00260.187240.0007
Fetch class attribute name0.00220.1528150.0001
XML
Image XML parsing0.00240.167440.0006
class_abstraction
Instantiating content class attribute0.00000.0029190.0000
General
dbfile0.00340.2411360.0001
String conversion0.00000.000330.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
13content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
25content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 61
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs