Jump to content

Recommended Posts

Ok so I have a post on a blog using an OO pattern to add to the blog.

I'm stumped at how to even begin to do versioning.  I want it to be able to record every version of the messages that is amended and then give the user the change to pick which article to use.

 

Any ideas?

Thanks!

 

 

Link to comment
https://forums.phpfreaks.com/topic/219679-oo-php-versioning/
Share on other sites

thanks for the help.

i kinda figured that but im unsurehow to do it in OO PHP.

Obviously when you add to database you add a date.

but my problem is when im editing at the moment it just adds as a new post.

 

I need it to be able to add to the database, but update on the main screen, with some way of rolling back versions of the post.

 

is there any tuts on this as i can't find anything anywhere. i'm stumped.

 

Cheers again,

very much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/219679-oo-php-versioning/#findComment-1138919
Share on other sites

OOP has nothing to do with your question, you seem to be getting caught up in your own design pattern.

 

Take a step back and think about it:

You have an object representing the article. 

It has changed.

You want to record the changes in the database.

What do you do?

 

 

Add two columns to your table, for "edit date" and for "visible."  When your system would otherwise do an UPDATE, change that so it simply sets the old record to "not visible" and INSERTS a new record with NOW() as the edit date.  Now, you can simply display the visible record, and keep all the invisible ones as the edit history.

 

-Dan

Link to comment
https://forums.phpfreaks.com/topic/219679-oo-php-versioning/#findComment-1138931
Share on other sites

Thanks for that.

now i just need to work out how to write it! haha.

this is for an assignment at uni. so thats why im confused.

 

the blog at the moment adds and deletes with no issues.

all i need now is for it to be able to edit a blog post and record previous versions of the edited posts.

 

that will definetly help with the recording of the posts. now i just need to find out how to actually amend.

 

iv got something called Command_BlogAdd.php and Command_BlogAddForm.php, views/addform.php and a Manager.php and ManagerMessage.php

 

I'm guessing, the amend will be very similar to the add, just need it to show the message that was already there, in the text box to edit the article, that is where im struggling.

 

the table is called messages and contains ID, TITLE, MESSAGE.  I will add the EDIT DATE AND VISABLE columns as you said and see where i get with that.

 

my last question is, how do i get the message title and message content to show in the addform screen to edit it.

 

im guessing its something to do with calling the ID and displaying the title and message related to that ID in the form.  Just don't know how to go about it :S

 

 

again your help is much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/219679-oo-php-versioning/#findComment-1138968
Share on other sites

very similiar to search i think

 

static $get_message =  "SELECT id,title,message FROM messages WHERE id = ?" ;

 

 function getOneMessage($id)
  {
    $values = array($id);
    $stmt = $this->doStatement(self::$get_message, $values);
    $result = $stmt->fetchAll();
    return $result;
  }

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/219679-oo-php-versioning/#findComment-1138973
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.