Forums / Suggestions / Select frontpage image

Select frontpage image

Author Message

Daniel Staver

Wednesday 10 September 2003 5:23:33 am

I suggest adding a function to select a frontpage image from the list of related images. This was possible in 2.2, and it would be nice to have it in 3.x as well.

It can be done right now by adding an integer field to the article class where you insert the ID of the related object you want on the frontpage. To make it more user-friendly you can also override the template and display the integer field as a drop-down list of all related images and allow the user to select which one to use as a frontpage image.

The problem with this is that you manually have to remove the ID if you delete an image.

Something like this could probably be generalized into a related-selector datatype which would allow the user to make a selection between the exisiting releated objects. The selector should support filtering of specific class types.

Daniel Staver
http://daniel.staver.no

Daniel Staver

Friday 19 September 2003 1:46:21 am

I've solved it for now by creating an override for the integer edit field for class 2 in admin, like this:

[frontpageimage]
Source=content/datatype/edit/ezinteger.tpl
MatchFile=frontpageimageselect.tpl
Subdir=templates
Match[class]=2

And then I put this in the template:

{let name=CurrentObject current_object=fetch('content','version',hash(object_id,$attribute.contentobject_id,version_id,$attribute.version))}
<select name="ContentObjectAttribute_data_integer_{$attribute.id}" size="1">
{section show=$attribute.data_int}
<option value="">Ikke bruk forsidebilde</option>
{section-else}
<option value="" selected>Ikke bruk forsidebilde</option>
{/section}

{section name=ContentObjectRelation loop=$CurrentObject:current_object.related_contentobject_array}
{section show=eq($attribute.data_int,$CurrentObject:ContentObjectRelation:item.id)}
<option value="{$CurrentObject:ContentObjectRelation:item.id}" selected>{$CurrentObject:ContentObjectRelation:item.id} - {$CurrentObject:ContentObjectRelation:item.name}</option>
{section-else}
<option value="{$CurrentObject:ContentObjectRelation:item.id}">{$CurrentObject:ContentObjectRelation:item.id} - {$CurrentObject:ContentObjectRelation:item.name}</option>
{/section}
{/section}
</select>
{/let}

Daniel Staver
http://daniel.staver.no

eZ debug

Timing: Jan 18 2025 04:30:22
Script start
Timing: Jan 18 2025 04:30:22
Module start 'content'
Timing: Jan 18 2025 04:30:23
Module end 'content'
Timing: Jan 18 2025 04:30:24
Script end

Main resources:

Total runtime1.0371 sec
Peak memory usage4,096.0000 KB
Database Queries189

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0097 588.8203180.8438
Module start 'content' 0.00970.8826 769.6641499.1406
Module end 'content' 0.89230.1447 1,268.8047334.8750
Script end 1.0371  1,603.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00540.5231210.0003
Check MTime0.00240.2299210.0001
Mysql Total
Database connection0.00090.086910.0009
Mysqli_queries0.955392.10631890.0051
Looping result0.00210.20161870.0000
Template Total0.989995.420.4949
Template load0.00200.194420.0010
Template processing0.987895.248220.4939
Template load and register function0.00010.010810.0001
states
state_id_array0.00210.202910.0021
state_identifier_array0.00180.169820.0009
Override
Cache load0.00160.1582340.0000
Sytem overhead
Fetch class attribute can translate value0.00220.211320.0011
Fetch class attribute name0.00130.123430.0004
XML
Image XML parsing0.00090.090520.0005
class_abstraction
Instantiating content class attribute0.00000.001140.0000
General
dbfile0.00240.2349270.0001
String conversion0.00000.001130.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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/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: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs