SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist pip's Avatar
    Join Date
    Jun 2001
    Location
    Cape Town, South Africa
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Content editing through FSO

    Hi all,

    I'm working on a ASP site where I wish to implement the ability to edit some parts of the site without having to edit in HTML. For this I've created a web based WYSIWYG editor where the owner of the site should be able to edit text into his press release box scrolling from topic to topic. This editor allows you to merely click a "B" where you want text to be bold.

    My problem lies when editing and saving the content. The reason for this is because it has to save the HTML code into an include file situated in the same directory. The front page of the site has a server side include "bb_content.inc" where it reads the content and displays it based on what is written in the include file.

    When the user clicks "Apply changes", the content, as changed, is written into a hidden text area on the page. Once the user clicks "Done", the form submits, then writes the code into the include file (bb_content.inc). This all works fine up to a point. It writes the code into the include file, but does not keep it on one line. In order for my File System Object to read multiple topics, each topic has to be written into the include file on one line. The primary language used is JavaScript.

    How would I be able to take the content, then write it into the include file on one line, where the next topic should be written on the next line, and so forth?

    Another problem with this is that the ASP code writes the JavaScript function into the file as well.

    One line example:

    pressReleaseTopics.addItem('<P ALIGN="CENTER">Press release box <B>Content <I>Here</I></B></P>');

    I'd apprecaite it if anyone has any ideas on how this could be done.
    - Pip
    ---------------------------------------------------------------------------------
    Nothing takes the taste out of peanut butter quite like unrequited love.

  2. #2
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For this specific problem you may want to post some of your code to help illustrate what it is your trying to do.

    As an alternative, I would highly recommend 'writing' into a database as opposed to a flat file system. There would be many benifits including security and more flexibilty for what you can do with the data.
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com

  3. #3
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To get the topic on one line replacing the carriage returns would probably solve the problem

    strTopic = Replace(strTopic, vbCrLf, "")

    However, this would have the downside of making the topic more difficult to re-edit. You might be able to get around this by replacing the vbCrLf's with tabs (vbTab) instead. I don't think this'll cause a problem displaying the topic and you could then replace the tabs with carriage returns before editing.

    To add the topic to a new line open the file in append mode.

    Const ForAppending = 8
    Set f = fso.OpenTextFile("c:\testfile.txt", ForAppending, True)

    I've no idea why your js function is also getting written to the file. Like westmich said, maybe a closer look at your code will help.

  4. #4
    SitePoint Evangelist pip's Avatar
    Join Date
    Jun 2001
    Location
    Cape Town, South Africa
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx for the help guys.

    It might be a good idea to post some of my code on here, but I think that westmich has given me the advice I needed on this one. I've been trying to avoid a database, however once I thought it through I realised that it would most probably be the best thing to do.

    I will see if I can set this up, and should I run into any more problems, I'll post some of my code here to explain the function(s).

    Thanx once again
    - Pip
    ---------------------------------------------------------------------------------
    Nothing takes the taste out of peanut butter quite like unrequited love.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •