Форумы / Cotonti / Support / Page extra field value in page.tpl

Uch
#1 02.12.2012 15:33

Hello!

If i use $L['<extrafieldname>_<value>'] = '<extrafieldname>_<value>_<alias>' in my language files, i get {PAGE_<EXTRAFIELDNAME>} =  <extrafieldname>_<value>_<alias> in my page instead of its value.

How can i get page extra field value instead of its alias?

Trustmaster
#2 02.12.2012 16:06

I haven't quite understood what you mean but it seems like you need to assign a value rather than a key:

$L['<extrafieldname>_<value>'] = $L['<extrafieldname>_<value>_<alias>'];

 

May the Source be with you!
Macik
#3 02.12.2012 21:09

 

Where you need to use (get) extrafield value? In PHP code or in TPL file? 

If you speak about using it in TPL file it depends what TPL file it is. 

For page.tpl this should be:

{PAGE_DATE2_TITLE} {PAGE_DATE2}

Where `DATE2` is name of ExtraField. {PAGE_DATE2_TITLE}-prints title for it and  {PAGE_DATE2} -prints Value of this extrafield.

Добавлено 30 минуты спустя:

I realized what you mean… 

Once you set up $L['extra_#'] for fields variants you get it in page instear of raw value.

So only one ability to get raw data of extrafields is to unset your $L['extra_#'] before page «renders».

Or you can assign this vars ($L['extra_#']) only for pageedit and pageadd pages.

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
Отредактировано: Macik (02.12.2012 21:39, 11 лет назад)
Kort
#4 03.12.2012 05:22

Assuming you have an extrafield "producttype" with a value "jckt". To localize it you go for:

$L['producttype_jckt'] = 'Jacket';

in the theme lang file. So in the page.tpl you can use the tag:

{PAGE_PRODUCTTYPE}

to get the localized "Jacket" string or the variable

{PHP.pag.page_producttype}

to get the original "jckt" value.

SED.by - создание сайтов, разработка плагинов и тем для Котонти