Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 142329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:55:09+00:00 2026-05-11T07:55:09+00:00

Anyone know of an API (php preferable but I’d be interested in any language)

  • 0

Anyone know of an API (php preferable but I’d be interested in any language) for creating wiki-like data storage?

How about any resources on rolling your own plaintext wiki? How do other plaintext wikis handle the format of the text file?

I understand I can use Markdown or Textile for the formatting. But what I’m most interested in is how to approach the plaintext storage of multi-user edits.

I’m writing a web application that is primarily database driven. I want at least one text field of this database to be in a wiki-like format. Specifically, this text can be edited by multiple users with the ability to roll back to any version. Think the wiki/bio section of Last.FM (almost the entire site is strictly structured by a database except for this one section per artist).

So far, my approach of taking apart MediaWiki and wedging it into a database seems like overkill. I’m thinking it would be much easier to roll my own plaintext wiki, and store this file in the database’s appropriate text field.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:55:09+00:00Added an answer on May 11, 2026 at 7:55 am

    So, basically this is a ‘how do I version text information in my DB’.

    Well, the simplest way is simply copying the data.

    Simply, create a ‘version’ table that holds ‘old versions’ of the data, and link it back to your main table.

    create table docs {     id integer primary key not null,     version integer not null,     create_date date,     change_date date,     create_user_id integer not null references users(id),     change_user_id integer references users(id),     text_data text }  create table versions {     id integer primary key not null,     doc_id integer not null references docs(id),     version integer,     change_date date,     change_user integer not null references users(id),     text_data text } 

    Whenever you update your original document, you copy the old text value in to this table, copy the user and change date and bump the version.

    select version, change_date, change_user, text_data      into l_version, l_change_data, l_change_user, l_text_data  from docs where id = l_doc_id;  insert into versions values (newid, l_doc_id, l_version,      l_change_date, l_change_user, l_text_data);  update docs set version = version + 1, change_date = now,      change_user = cur_user, text_data = l_new_text where id = l_doc_id; 

    You could even do this in a trigger if your DB supports those.

    Faults with this method are that its a full copy of the data (so if you have a large document, the version stay large). You can mitigate that by using something like diff(1) and patch(1).

    For example:

    diff version2.txt version1.txt > difffile 

    Then you can store that difffile as ‘version 1’.

    In order to recover version 1 from version 2, you grab the version 2 data, run patch on it using the diff file data, and that gives you v1.

    If you want to go from v3 to v1, you need to do this twice (once to get v2, and then again to get v1).

    This lowers your storage burden, but increases your processing (obviously), so you’ll have to judge how you want to do this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know a good .NET dictionary API? I'm not interested in meanings, rather
Does anyone know any good chart api for a web application in java? This
Does anyone know of a good dictionary API or ruby library to lookup the
Does anyone know if there is an API to get the current monitor state
Does anyone know how to access ALSA (low-level audio API) in Linux using Mono?
Does anyone know how to use the RegisterHotKey/UnregisterHotKey API calls in a console application?
Anyone know if it's possible to databind the ScaleX and ScaleY of a render
Anyone know of a way to capture keyboard events (keyup / keydown) in Portable
Anyone know how to do this without using a third party program? If there
Anyone know a good book or post about how to start in EF? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.