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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:02:03
Script start
Timing: Jan 18 2025 02:02:03
Module start 'layout'
Timing: Jan 18 2025 02:02:03
Module start 'content'
Timing: Jan 18 2025 02:02:03
Module end 'content'
Timing: Jan 18 2025 02:02:03
Script end

Main resources:

Total runtime0.0153 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.0391152.6406
Module start 'layout' 0.00500.0026 740.679739.4922
Module start 'content' 0.00760.0056 780.171997.3672
Module end 'content' 0.01320.0021 877.539138.3047
Script end 0.0153  915.8438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002516.2304140.0002
Check MTime0.00127.6782140.0001
Mysql Total
Database connection0.00074.586410.0007
Mysqli_queries0.002516.009630.0008
Looping result0.00000.065310.0000
Template Total0.001811.710.0018
Template load0.00106.608210.0010
Template processing0.00085.087210.0008
Override
Cache load0.00085.074710.0008
General
dbfile0.00106.356280.0001
String conversion0.00000.040440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs