This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » General » How can I add new attribute (class?)...
expandshrink

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

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

Thursday 20 May 2010 12:57:02 pm - 6 replies

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.

 

Thursday 20 May 2010 1:21:38 pm

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?

Thursday 20 May 2010 1:35:51 pm

Wow, that was quick happy.gif Emoticon

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 happy.gif Emoticon

Modified on Thursday 20 May 2010 1:36:10 pm by Steven Stieng

Thursday 20 May 2010 2:47:14 pm

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.

Thursday 20 May 2010 2:55:34 pm

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?

Thursday 20 May 2010 3:35:42 pm

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.

Thursday 20 May 2010 3:36:30 pm

You can also do the way you wanted above.

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

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from