L
L
Leonid Gorshkov2018-06-29 19:49:11
MODX
Leonid Gorshkov, 2018-06-29 19:49:11

Modx rev. How to insert tv fields into a snippet?

Hello,
I have 2 additional fields (TV).

and

in the template I inserted ;
And there is a snippet with this code:

<?php
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);

if(empty($_COOKIE["synacs_lang"])){
      setcookie("synacs_lang", $lang, time() + ((3600*24)*365));
   }
if($_COOKIE["synacs_lang"]=="en"){
      echo ;
   }elseif($_COOKIE["synacs_lang"]=="ru"){
      echo ;
   }

Why doesn't it work?)
The essence of the script:
I determine the language of the browser, and write it down in cookies. Then I process the language and display the tv field I need. But something is wrong.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
display: block, 2018-06-29
@Synacs-U

echo $modx->resource->getTVValue('seo.title.en');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question