get_template_part based upon post’s category

It looks like the single quotes are giving you problems.

Replace:

get_template_part( 'templates', '$childcat->slug' ); 

with:

get_template_part( 'templates', $childcat->slug ); 

Note that double quoted strings in PHP can parse variables, not single quotes.

Also check out the curly syntax in the PHP docs in the variable parsing section.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)