[time] / [verb phrase] + 以前 / 以后
[subject] + 以前 / 以后 + [verb phrase]
从前 + [sentence]
以前 and 以后 work two ways. After a time or an event they mean "before" and "after" it. Standing alone, before the verb, they mean "in the past" and "from now on". 从前 only works alone, and reaches further back.
The time or the event comes first and 以前 or 以后 follows it – the reverse of English "before nine". With a length of time, the same frame gives "ago" and "later".
以前 on its own sets the sentence in a past that has since changed. It goes before or after the subject, never after the verb.
以后 on its own looks forward from now: plans, or a promise to behave differently.
从前 is "long ago": the opening of a story, or a life that has changed a lot. It never follows a time or an event, so it can't replace 以前 in 吃饭以前.
When you tell what happened next in the past, use 后来. 以后 alone points into the future, so it sounds wrong in the middle of a past story.
之前 and 之后 do the same job as 以前 and 以后 after an event, and sound more formal.