Forums / Setup & design / using an image object as <TD> background image???

using an image object as <TD> background image???

Author Message

Yvan Cottyn

Friday 12 September 2003 5:33:44 am

Does anybody know if this is possible?

Paul Borgermans

Friday 12 September 2003 5:41:38 am

Only in the templates. With version 3.2, you can add "class" names to xml tags in xml fields. This could be used to select a template with the override template system which shows you this image in your <td>.

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Yvan Cottyn

Friday 12 September 2003 6:05:37 am

yup, i want to use it in a template. but in 3.1

<td background=?????>

Paul Forsyth

Friday 12 September 2003 6:15:28 am

Is this within an xml data field or *only* within a template?

Paul Borgermans

Friday 12 September 2003 6:46:04 am

You need to now the node id (see admin interface, its in the URL) of this particular image object and then use

something like

{let tdimage=fetch(content, node, hash(node_id,55))}

<td background={$tdimage.data_map.<image attribute name>.content[reference].full_path|ezurl}>

....

{/let}

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Alex Jones

Friday 12 September 2003 6:47:49 am

Yvan, is the image object going to change per template or article, or do you want to use the same image across the site?

If you are using one image, your best bet would be to use CSS to apply the background image by adding a class to the TDs you want to display the background. If you need to change out the image per article or class the code would be something like:
<td style="background-image: url("{$node.data_map.image.content[original].full_path|ezroot}");>

Note, this code will probably need a bit of tweaking to get it to work with your setup.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Yvan Cottyn

Friday 12 September 2003 6:52:29 am

in design/user/templates/left_menu.tpl (included from pagelayout.tpl) i have:

<table border="0" cellpadding="3" width="100%"><tr><td>

{* loop children and print name with link *}
{let main_cats=fetch('content', 'list', hash(parent_node_id, 2, class_filter_type, include, class_filter_array, array(1)))}

{section name=Cat loop=$main_cats}
{let latest=fetch('content', 'list', hash(parent_node_id, $Cat:item.node_id, limit, 3, class_filter_type, include, class_filter_array, array(12)))}

<table class="left_menu" width="100%" cellspacing="1">
<tr>
<td class="left_menu_top" align="center">
<a href={concat("/content/view/full/",$Cat:item.node_id,"/")|ezurl} class="left_menu">{$Cat:item.name|wash}</a>
</td>
</tr>
<tr>
<td class="left_menu_bottom" align="left">
{section name=Last loop=$Cat:latest}
<a href={concat("/content/view/full/",$Cat:Last:item.node_id,"/")|ezurl}>{$Cat:Last:item.name|wash}</a> <br>
{/section}
</td>
</tr>
</table>
<br>
{/let}
{/section}

</td></tr></table>

{/let}

So for each folder in the root folder it makes a little table. All the little tables togetger form the menu.
My goal is that one can make an object of the type 'menu background' (that is a copy of the class image that i made) and the the image is used as background for the second table cell. the one's with class=left_menu_bottom.

This way, users using the interface to add stuff to the site (here, a folder in the root folder) can also create an image object to use as background in the menu. they don't have to upload/copy an image to /desing/user/images and edit a template to have the background they want.

Paul Borgermans

Friday 12 September 2003 6:57:52 am

The more general idea put forward by Bard on the conference was to make the entire pagelayout refer to "site design objects" which contain almost everything from style sheets to logo's to menus to ....

Now add the ezpreferences feature (3.2) and you can make your site skinnable by the end-user ... just create a series of objects and add a little preferences menu

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Yvan Cottyn

Friday 12 September 2003 8:05:26 am

ok, i'm there, thanks for the quick responses!

{let
main_cats=fetch('content', 'list', hash(parent_node_id, 2, class_filter_type, include, class_filter_array, array(1)))
}
{section name=Cat loop=$main_cats}
{let
latest=fetch('content', 'list', hash(parent_node_id, $Cat:item.node_id, limit, 3, class_filter_type, include, class_filter_array, array(12)))
backgrounds=fetch('content', 'list', hash(parent_node_id, $Cat:item.node_id, limit, 1, class_filter_type, include, class_filter_array, array(14)))
}
<table class="left_menu" width="100%" cellspacing="1">
<tr>
<td class="left_menu_top" align="center">
<a href={concat("/content/view/full/",$Cat:item.node_id,"/")|ezurl} class="left_menu">{$Cat:item.name|wash}</a>
</td>
</tr>
<tr>
<td class="left_menu_bottom" align="left" background={$Cat:backgrounds[0].data_map.image.content[original].full_path|ezroot}">
{section name=Last loop=$Cat:latest}
<a href={concat("/content/view/full/",$Cat:Last:item.node_id,"/")|ezurl}>{$Cat:Last:item.name|wash}</a> <br>
{/section}
</td>
</tr>
</table>
{/let}
<br>
{/section}

{/let}

eZ debug

Timing: Jan 19 2025 00:32:22
Script start
Timing: Jan 19 2025 00:32:22
Module start 'content'
Timing: Jan 19 2025 00:32:22
Module end 'content'
Timing: Jan 19 2025 00:32:22
Script end

Main resources:

Total runtime0.7040 sec
Peak memory usage4,096.0000 KB
Database Queries216

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 587.8438180.8125
Module start 'content' 0.00730.5556 768.6563701.3750
Module end 'content' 0.56290.1409 1,470.0313344.4297
Script end 0.7038  1,814.4609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.5605210.0002
Check MTime0.00150.2109210.0001
Mysql Total
Database connection0.00080.117410.0008
Mysqli_queries0.606486.13862160.0028
Looping result0.00220.31952140.0000
Template Total0.673195.620.3366
Template load0.00210.297720.0010
Template processing0.671095.322020.3355
Template load and register function0.00010.020510.0001
states
state_id_array0.00100.138910.0010
state_identifier_array0.00080.114120.0004
Override
Cache load0.00200.2813910.0000
Sytem overhead
Fetch class attribute can translate value0.00130.180850.0003
Fetch class attribute name0.00090.1291110.0001
XML
Image XML parsing0.00150.215550.0003
class_abstraction
Instantiating content class attribute0.00000.0039130.0000
General
dbfile0.00470.6661340.0001
String conversion0.00000.000830.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
9content/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
6content/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: 36
 Number of unique templates used: 6

Time used to render debug report: 0.0004 secs