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.