are you trying to implement a dimmer via the parallel port or just simply turn the light on or off? anyways, about using opto-coupler/opto-isolators, here goes.. using your first schematic diagram as guide, disconnect r6 from parallel port and connect it to the opto's emitter. connect opto's collector to +12V.(assuming your opto is NPN output) connect the opto's LED to the parallel port through an appropriate current limiting resistor. just make sure that the value of r6 is low enough to saturate the 2222 but high enough not to exceed the opto's maximum collector current.
as for the circuit involving the triac, you could eliminate the relay and the 2222, and trigger the triac directly with an opto isolator with triac output such as moc3043/moc3081 just as the masters have suggested.