The Knights of the Old Republic series (video games, and also a comic book series) takes place four thousand years before the movies.
If you want to put these all into a single KOTOR story timeline:
The Knights of the Old Republic comic series from Dark Horse Comics (written by John Jackson Miller)
are followed by the Knights of the Old Republic video game,
which was followed by KOTOR 2: The Sith Lords
then about 300 years later, is the timeframe of The Old Republic (MMO game). There are also several novels and comics under "The Old Republic" and they cover some of the time between KOTOR 2 and TOR.
then about 3,700 years later, we have Episode I-II-III-IV-V-VI.
So pretty much the KOTOR era is separate from the movie era - The Sith we see in the KOTOR timeframe are very very different than the Rule of Two sith like Palpatine and Vader - instead they have their own empire, warring against the Republic. The Jedi are not quite as refined, but they have a large scope in the Republic, and there's rampaging Mandalorians conquering the galaxy as well. But there are some great heroes, villains, and cool characters in the era. The KOTOR games were pretty awesome for their stories