Php (smarty) and tags


I am using the following code and this is working fine with smarty/php. I only wonder how leave the tags in place as it brakes the output from the api. Can someone give me some direction how to solve this?



                                $vars = $this->get_template_vars();
                                $vertaling = strip_tags($vars['entry']['introduction'] . $vars['entry']['body']);

                                $url = '';
                                $data = array(
                                    'q' => $vertaling,
                                    'source' => 'nl',
                                    'target' => 'en',
                                    'format' => 'text'
                                $options = array(
                                    'http' => array(
                                        'method' => 'POST',
                                        'header' => 'Content-Type: application/json',
                                        'content' => json_encode($data)
                                $context = stream_context_create($options);
                                $response = file_get_contents($url, false, $context);
                                if ($response !== false) {
                                    $responseData = json_decode($response, true);
                                    $translatedText = $responseData['translatedText'];
                                    echo $translatedText;
                                } else {
                                    echo 'Vertaling is mislukt';

1 Like

Hi, :wave: welcome!

Do you mean how to translate tags with the query? In that case use format: html instead of format: text. If that’s not what you meant, can you expand what you mean by “how to leave the tags in place”?

1 Like

thank you! I missed that one