Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 insert images in random locations

Author  Topic 

abc
Starting Member

48 Posts

Posted - 2002-04-11 : 23:07:25
Hi ,
I want to display news in my homepage with many images of that news. The content of news will be select from database, and I want the images of that news will be appear in some different place of the news' content. But don't know how to do that, I just can insert image in the top or end on that news' conttent, because content is selected from database. How can I put image in other place of that news' conttent.
Thank for reading,


Thanks for your attention

Peter Dutch
Posting Yak Master

127 Posts

Posted - 2002-04-12 : 04:24:28
Depends on what you want. Do you want control over the location of the image, or should it be random in the text.

What I mean, do you want to decide where the image comes at the moment you write the article?


Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-12 : 08:42:09
I don't want to sound nitpicky, but what does this have to do with SQL Server? Even if the data is in SQL Server, how they are presented on the web page isn't a function of the database.

Try some of these ASP sites, they have articles on random image selection, you may be able to modify it to randomize the placement of your images:

www.4guysfromrolla.com
www.15seconds.com
www.asp101.com
www.aspalliance.com

4Guys also has a messageboard similar to the SQL Team forums; you may be able to find someone on the board who has done this before.

Go to Top of Page

Peter Dutch
Posting Yak Master

127 Posts

Posted - 2002-04-12 : 09:04:16
Why not make this a part of SQL Server?

You could place the <IMG SRC = > tag in the text in the DB field, and response.write the text at once.

It's not really picking a random image, but more a random place in the text. It's pretty easy to write a scipt that generates a random number and places a fixed text into the existing text

PSEUDO CODE
------------------

CREATE PROC InsertNewsItem
@ItemID INT OUTPUT
.. other vars like Title, Author etc.
@Text VARCHAR(5000)
@ImgPath VARCHAR(25)

as

genrate random number

stuff the @ImgPath var at the random choosen position in the @text var
Insert the @text var in the table.

----------

Peter

BTW, the 4guys msgboard is down (Primary filegroup is full.... whoops!)


Go to Top of Page

abc
Starting Member

48 Posts

Posted - 2002-04-12 : 21:39:58
You are right Robvolk, It's not database function :-)
Anyway, thanks for all your help

Thanks for your attention
Go to Top of Page
   

- Advertisement -