Forums / General / How can I add new attribute (class?) for the start page?

How can I add new attribute (class?) for the start page?

Author Message

Steven Stieng

Thursday 20 May 2010 3:57:02 am

I need to place an image on the front page.
I want to do this the same way as I add an logo in the 'Look & Feel' section.

Where do I add such an property? I'm looking calsses -> Frontpage, but not getting any wiser.

 

Quoc Huy Nguyen Dinh

Thursday 20 May 2010 4:21:38 am

classes -> Frontpage is not what you want to look at.

The logo that you see in the 'Look & Feel' section is part of classes -> Setup -> Template look (image attribute).

But are you sure this is what you want to do?

Steven Stieng

Thursday 20 May 2010 4:35:51 am

Wow, that was quick :)

I just want a place where the customer himself can change the picture which display on the front page.
(Not the logo)

I've only had an 3 hour crash course in eZ Publish, so I'm a noob to eZ :)

Quoc Huy Nguyen Dinh

Thursday 20 May 2010 5:47:14 am

If the image you are talking about is not part of the global template then I suggest you not to edit the 'template look' class. As this is more for the global look of the website not a content that just appears on the frontpage.

Also if that type of image is just appearing on the frontpage then there is no point to edit the frontpage class either.

Maybe what you can do is go in the "Media Library" > "Images" and create a new object of type "image" and call it something like "Frontpage image". If it is less confusing for your customer, you can also create that image object as a child of the frontpage:

Home

|__ Folder1

|__ Folder2

|__ etc...

|__ "Frontpage image"

Then edit settings/override/content.ini.append.php or settings/siteaccess/your_site_access/content.ini.append.php

and add/append this:

[NodeSettings]

FrontpageImage=XXXXXX

where XXXXXX is the node ID of your "Frontpage image" node.

Then in the tpl file that is displaying your frontpage you will need some logic to display or not the frontpage image. And fetch and display it:

{def $frontpageImageNodeID=ezini( 'NodeSettings', 'FrontpageImage', 'content.ini' )}

{def $frontpageImageNode=fetch( 'content', 'node', hash( 'node_id', $frontpageImageNodeID ) )}

{attribute_view_gui attribute=$frontpageImageNode.object.data_map.image}

That is one way to do it.

Steven Stieng

Thursday 20 May 2010 5:55:34 am

Yeah, that's one way.

The major drawback (I think) is if the user deletes the images and uploads a new image. Then the Node ID will no longer be valid.

The best way will be having an attribute called 'FrontpageImage' where I just retrieve the value of that attribute (link to image).

Is it really that difficult to do something this simple in eZ?

Quoc Huy Nguyen Dinh

Thursday 20 May 2010 6:35:42 am

You can create a section and set the node for the image in that section.

Then edit the roles/permissions to allow only edit but not removal of the node.

Quoc Huy Nguyen Dinh

Thursday 20 May 2010 6:36:30 am

You can also do the way you wanted above.

My suggestion is just for the logic of it but your way is doable.

eZ debug

Timing: Jan 17 2025 23:50:03
Script start
Timing: Jan 17 2025 23:50:03
Module start 'content'
Timing: Jan 17 2025 23:50:04
Module end 'content'
Timing: Jan 17 2025 23:50:04
Script end

Main resources:

Total runtime0.9468 sec
Peak memory usage4,096.0000 KB
Database Queries70

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.2969180.8203
Module start 'content' 0.00630.9363 770.1172561.4219
Module end 'content' 0.94260.0041 1,331.539150.0547
Script end 0.9467  1,381.5938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3629140.0002
Check MTime0.00180.1897140.0001
Mysql Total
Database connection0.00090.096710.0009
Mysqli_queries0.893994.4131700.0128
Looping result0.00070.0689680.0000
Template Total0.916796.820.4583
Template load0.00240.254520.0012
Template processing0.914296.562520.4571
Template load and register function0.00020.024710.0002
states
state_id_array0.00120.129410.0012
state_identifier_array0.00090.096420.0005
Override
Cache load0.00180.1890500.0000
Sytem overhead
Fetch class attribute can translate value0.00050.054320.0003
Fetch class attribute name0.00140.152280.0002
XML
Image XML parsing0.00070.078920.0004
class_abstraction
Instantiating content class attribute0.00000.0030110.0000
General
dbfile0.00110.1168200.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
8content/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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs