Forums / Setup & design / Adding An Image to the top node

Adding An Image to the top node

Author Message

Tate Wami

Sunday 07 November 2004 2:34:38 pm

I can't seem to add an image to the top node content page of my ezsite. I have been navigating around the admin area but I can't work out how to do it. when I try to edit the page it comes up as an article where I can't upload the image. In the case where I can add an image it comes out as an article and the image also appears in the latest news section,this is not what I want.All I want is a static image on the front page. I have tried to use the "Related to" object, the image came on the related to box but in the admin area, it didn't appear on the topnode where I want it to be.

Can this be done with the admin interface or do I have to go into the code to place a line of code to achieve this? If this is the solution what is the code and where do I palce it? thanks.

Balazs Halasy

Sunday 07 November 2004 2:50:58 pm

If you just want an image (without any welcome text):

1. Create an image object in the root folder (make sure it contains your image).

2. Make note of the Node ID number that was assigned to the image-object.

3. Edit the site.ini.append file, you'll find it in settings/siteaccess/your_site/

4. Change the IndexPage=/content/view/full/2 setting so that it points to the node ID of the image.

5. Clear all caches and surf the site (without any parameters).

6. You should be able to see the image (using the default/base template).

Balazs

Tate Wami

Sunday 07 November 2004 2:58:00 pm

Let's say I may need some welcome text, how do I achieve this?

1. how do I create the image object and where / which is the root folder?

Can you please explain like you are telling a first time learner. I will understand better that way.

Ole Morten Halvorsen

Monday 08 November 2004 7:58:55 am

If I understood you correctly:

If you haven't uploaded an image yet:
- Click on the 'Media' tab inside admin
- Choose 'Image' from the dropdown and press 'Create here'
- Fill in the name, select an image and press 'Send for publishing'

Now,
- Edit your top node
- Related the image to the top node by clicking on the magnifying glass
inside the Related objects box on the right. Browse to, select your image and press 'Select'
- In the 'Related objects' box (still on the right) you should have a small preview of the image with the name and a <object> tag below. Copy and paste this <object> tag into the XML field (probably called body or description).
- Publish the top node and the image should be visible inside the node both in admin and your user site.

This should work out-of-the box on eZ publish.

Ole M.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Tate Wami

Monday 08 November 2004 3:05:37 pm

Guess what it worked. Thank you very much that was painless yet effective. I'm wondering does that mean you can upload any media in the same way e.g flash animation, video and audio files?

The image I think was shrinked, is there a way of uploading an image and keeping the original size?

And how do you have different sections of the site on the topnode /or frontpage e.g news, media, forums all on the front page in small veiwable sections?

Ole Morten Halvorsen

Tuesday 09 November 2004 3:54:50 am

Yes, you can do this with any kind of files. The media datatype currently supports Flash, Quicktime, Realtime and Windows Media.

The original image size is kept unless you have modified image.ini. To get the original sized image add image_class="original" to the object tag. Example:

<object id="xx" size="original" />

There are four differnet sizes available by default: original, small, medium and large. You can create your own sizes in image.ini.

>And how do you have different sections of the site on the topnode /or
>frontpage e.g news, media, forums all on the front page in small veiwable
>sections?
Are you thinking about a similar page like the community frontpage here on ez.no?

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Tate Wami

Tuesday 09 November 2004 12:28:20 pm

Wowwwww thanks for that code it worked very well.

Yes I want to do something similar to the community frontpage in fact exactly the way it is.

I also want to get rid of the lines and have dots instead of the lines and have a different color in the footer. Thanks again for your valuable expert skills.

Tate Wami

Wednesday 10 November 2004 11:24:27 am

hello Ole Morten N. Halvorsen,

Is there a chance of getting a reply on the above issues. I have found the style.css file, I believe this is where you make global changes to all templates? I'm yet to understand how you have diferent sections displaying on the front page exactly like the way it's done on the community page. I will appreciate some feedback, thank you.

Ole Morten Halvorsen

Thursday 11 November 2004 1:09:27 am

Our community page is made up of related objects. The page is simply a XML field with a table. A related object is placed inside each of the table cells. The embed template fetches the 5 newest children and display them in a unorderd list. To achieve this you must create an embed override template for the class you want to edit. Example of an override entry:

[embed_class_article]
Source=content/view/embed.tpl
MatchFile=embed_class_article.tpl
Subdir=templates
Match[class]=2

And in your embed template fetch and display children. Example:

{let items=fetch('content','list',hash( parent_node_id, $object.main_node_id,
                                        limit, 5,
                                        class_filter_type, include,
                                        class_filter_array, array( 'comment' ),
                                        sort_by, array( array( 'published', false() ) ) ) )}

{section show=$items}
    <ul>
    {section var=Child loop=$items}
        <li><a href={$Child.item.url_alias|ezurl}>{$Child.item.name|wash}</a></li>
    {/section}
    </ul>
{/section}
{/let}

The above example will fetch 5 children of class 'comment' and display them in a list. (as on the community page).

If you want to change the appearance of your site the .css files is the place to edit. A basic site is made up of 3 .css files. core.css, site.css and a color css. A good way to find out which css is used on your site is to view the source. In Internet Explorer do this by View -> Source.

Ole M.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Tate Wami

Monday 07 March 2005 6:32:46 am

Ole Morten Halvorsen

Thank you again for that feed back. With your advice, like I was just posting on another topic, I only managed to create some tables and added related objects to them but I have no clue how to create an "embed override template for the class you want to edit"[Ole]. Where is this found? if you can just show me the code i will compare and add that code you provided. where do I find this embed template from?

Thanks.