I found my answer. See this article (postet by Mayeenul Islam in the comments of my question Post) to get an understanding of template_loader.
If you understand then, how you locate a template, you can write one small methode to pass parameters to this template.
I wrote the following method:
public static function get_my_template( $template_name, $args = array(), $template_path="", $default_path="" ) {
if ( $args && is_array( $args ) ) {
extract( $args );
}
$located = self::locate_template( $template_name, $template_path, $default_path );
include( $located );
}
as you can see, in this method you are able to pass $args as parameter.
The function “extract”, extracts the array so that every key is his own variable. (See the manual for more information)
But this was not my idea!
Someone in the comments of the article write this suggestion.
And when you look at the code of woocommerce you will see that they doing the same way.