解决方案 »

  1.   

    如果是主图,另表管理。如果是内容图,fck里上传就得到了地址,这些地址存入数据库。
      

  2.   

    一般情况下取第一张图片地址就可以了,其他的图片都在FCKEditor生成的内容页中
      

  3.   

    你的 FCKEditor 生成的 Html 片段代码不是已经把一篇新闻内容跟多个图片对应起来了嘛。你的数据库中,除了你说的几个字段,再增加一个名为“HTML内容”的字段(text类型字段)保存 FCKEditor 产生的 html 代码文本即可。从基本的UI设计上看,新闻内容要放到任何新闻频道的模板中的局部,例如一个aspx中使用master page显示整体布局,然后你可能用一个 LiteralControl 控件显示新闻,右边用一个ascx插入栏目内部导航(例如栏目中其它重要新闻)和广告,下面的一个ascx插入评论控件。因此,你所谓的 FCKEditor 生成的 html 片段要保证放到任何频道的新闻模板中(也就是传送到这个 LiteralControl 控件中)都应该能够显示图片。我不使用 FCKEditor,不知道它如何保证生成的 html 中的图片用到网站的任何页面中都能显示图片的(包括网页的子目录路径不同时也能显示)。你要自己识别这种机制。最后再次强调一下,也许你不能完全明白但是这其实很重要,设计程序要从整个流程中所涉及到的重要 UI 布局、组件的组合和适配出发。你有没有搞清楚程序该如何设计,要看你能不能把重要的 UI 表现原型说清楚。如果你只知道使用录入一点局部信息使用 FCKEditor,只关心数据库表有几个字段,那么你可能还不能顺利地进行 UI 程序设计(并且 UI 设计要求往往在你做完了以后,用户才会提出修改意见)。
      

  4.   

    简单说,你至少需要
    1. 知道所谓 FCKEditor 能够产生什么东西,能够干什么用。知道html是什么,才好考虑如何保存,如何展示为新闻内容。2. 心中有同一段新闻内容放在不同栏目(当然也就是不同)新闻模板中,网页的url子目录路径可能不同,预先有这个概念。
      

  5.   


    建立三个表:news;photos;newPhoto
    news以newID为主键,存储有关新闻的信息:标题,关键词,内容
    photos以photoId为主键,存储图片名字,图片所在服务器上的地址
    newPhoto存储newID和photoId,并以newID和photoId联合为主键,以存储(一对多)一条新闻对应多张图片这样的关系。
    建表具体语句:
    news:
    /*==============================================================*/
    /* Table: news                                                  */
    /*==============================================================*/
    create table news 
    (
       newsId               int                            not null,
       newsTitle            char                           null,
       newsText             text                           null,
       createTime           date                           null,
       constraint PK_NEWS primary key clustered (newsId)
    );
    photos:
    /*==============================================================*/
    /* Table: photos                                                */
    /*==============================================================*/
    create table photos 
    (
       photoId              int                            not null,
       photoContext         char                           null,
       photoAttr            char                           null,
       photoName            char                           null,
       constraint PK_PHOTOS primary key clustered (photoId)
    );
    newPhotos:
    /*==============================================================*/
    /* Table: newPhotos                                             */
    /*==============================================================*/
    create table newPhotos 
    (
       newsId               int                            not null,
       photoId              char(10)                       not null,
       constraint PK_NEWPHOTOS primary key clustered (newsId, photoId)
    );alter table newPhotos
       add constraint FK_NEWPHOTO_REFERENCE_PHOTOS foreign key (photoId)
          references photos (photoId)
          on update restrict
          on delete restrict;alter table newPhotos
       add constraint FK_NEWPHOTO_REFERENCE_NEWS foreign key (newsId)
          references news (newsId)
          on update restrict
          on delete restrict;
      

  6.   

    对了,再补充下,当需要新闻数据的时候,只需从news中取出新闻的信息,并且从newPhotos中取出所有对应news的新闻图片的PhotoId,通过PhotoId就可以取出图片在电脑里的地址,就可以读取新闻图片信息了。
    另外有更省事的:photos删掉,只需要创建news和newPhotos两个表,在newPhotos中以PhotoId为主键,newId,Photo,PhotoName,photo。其中photo的格式就是图片。这样就更好了。
      

  7.   

    FCKEditor 会帮你处理这个问题,建议先使用FCKEditor 上传一篇带图片的文章,然后看看数据库里存的内容,你就明白了
      

  8.   

    建表如下
    news:/*==============================================================*/
    /* Table: news                                                  */
    /*==============================================================*/
    create table news 
    (
       newsId               int                            not null,
       newsTitle            char                           null,
       newsText             text                           null,
       createTime           date                           null,
       constraint PK_NEWS primary key clustered (newsId)
    );
    newPhotos:/*==============================================================*/
    /* Table: newPhotos                                             */
    /*==============================================================*/
    create table newPhotos 
    (
       newsId               int                            not null,
       PhotoId              char                           not null,
       PhotoName            char                           null,
       Photo                image                          null,
       constraint PK_NEWPHOTOS primary key clustered (PhotoId)
    );alter table newPhotos
       add constraint FK_NEWPHOTO_REFERENCE_NEWS foreign key (newsId)
          references news (newsId)
          on update restrict
          on delete restrict;