$gimme values inside PHP (ver. 4.4.7) (Resolved)
  • In version 4.4.7 when I try to use this code in .tpl file
    {{ assign var="article_name" value={{ $gimme->article->name }} }}
    {{ assign var="webcode" value={{ $gimme->article->webcode }} }}
    {{ assign var="pubdate" value={{ $gimme->article->publish_date|camp_date_format:"%d.%m.%Y, %H:%i" }} }}
    {{ assign var="section" value={{ $gimme->article->section->name|upper }} }}

    {{ php }}
    $article_name = $template->get_template_vars('article_name');
    $webcode = $template->get_template_vars('webcode');
    $pubdate = $template->get_template_vars('pubdate');
    $section = $template->get_template_vars('section');

    template do not pass a variable in php

    In version 4.2.4 everything is working properly

    Information from Newscoop 4.4 Cookbook:
    When using PHP, you might want to work with $gimme values inside PHP, as well as pass on PHP variables to the template. In order to do this, you need to assign the variables first, then you can access them inside PHP. Important: use backticks ` in the assign function. Here's a little example:

    Assigning a variable in the template to use with PHP

    {{ assign var="profile_email" value=`$gimme->comment->reader_email` }}
    {{ php }}
    $profile_email = $template->get_template_vars('profile_email');
    print $profile_email;
    {{ /php }}
    Post edited by Butov Stanislav at 2016-02-14 08:12:14
  • 1 Comment sorted by
  • In order to pass a variable, you must use $var = $template->getTemplateVars('var'); instead of $var= $template->get_template_vars('var') inside {{ php }}{{ /php }}