Forums / Developer / Display images between the article body

Display images between the article body

Author Message

Muhammad Khalid Majeed

Monday 26 April 2004 6:39:29 am

I edit the Article class and add 2 more images. Now, I want to display the article like

1- Image
2- Some text of body
3- Image
4- Some text of body
5- Image
6- Remaining Text

example page: http://news.bbc.co.uk/1/hi/technology/3646825.stm

But as the body is string and i can't insert the image between it. I try to explode the string using explode function but later i read that it is not work for string.... Is there any way that i can do it...

Muhammad Khalid
Software Engineer
www.webgurru.net

Balazs Halasy

Monday 26 April 2004 7:03:41 am

In order to achieve the stuff that you wish to achieve, do this:

Don't add any more attributes to the article class.
Use the power of related objects instead.

Example:

1) Create a couple of images in the "Media" part of eZ publish.
2) Edit an article.
3) Click on the small magnify glass icon (on the right).
4) Locate & select the images that you wish to include (navigate to media using the menu on the left).
5) Back in the article edit mode, the images will be displayed on the right hand side.
6) Copy and paste the XML code that is under each image into the desired positions within the body text-field (this will tell eZ publish to display the images).
7) Publish the thing.

That's it; may the force be with you!

Balazs

PS: Depending on the eZ publish version you're using, you might have to create an override template for images within XML code.

Muhammad Khalid Majeed

Tuesday 04 May 2004 12:45:56 am

Thank Balazs Halasy

But there is a problem. I edit the article class and add 6 more images. Now when i enter any aritcle add more images in it. Now when i need to display the article on the page the body comes in one string only. and it can't display the images by the customized locations. like http://arabia.autospeed.com/cms/A_0174/article.html.

I also try to explode the body by <br> but later i come to know that explode function is not working on string.

Can any one help me in this issue.

Muhammad Khalid
Software Engineer
www.webgurru.net