有没有办法通过配置文件在PhpStorm模板中设置var?
在PhpStorm中,我使用ApacheVelocity执行以下php文件模板: Php模板 我想使用ApacheVelocity从配置文件.ini、.env中设置$plugin\u name\u名称空间和defalut值。。。随便 或者 要动态,请使用配置文件中的值填充模板有没有办法通过配置文件在PhpStorm模板中设置var?,phpstorm,apache-velocity,Phpstorm,Apache Velocity,在PhpStorm中,我使用ApacheVelocity执行以下php文件模板: Php模板 我想使用ApacheVelocity从配置文件.ini、.env中设置$plugin\u name\u名称空间和defalut值。。。随便 或者 要动态,请使用配置文件中的值填充模板 有什么方法可以做到这一点吗?目前不可能,请投票决定是否通知此功能的任何进展情况不是真的,我不知道此类功能,内置不允许。但是您可以尝试为这些变量提供默认值。过去可以使用,现在可能已经3年没有使用这个插件了,所以不确定它是否还
有什么方法可以做到这一点吗?目前不可能,请投票决定是否通知此功能的任何进展情况不是真的,我不知道此类功能,内置不允许。但是您可以尝试为这些变量提供默认值。过去可以使用,现在可能已经3年没有使用这个插件了,所以不确定它是否还能使用。你可以检查其他可能的插件。@LazyOne,我尝试了这个插件,它似乎唯一能做的就是完全正确地编写set my_var=a值,但该值来自IDE配置,我相信它可以在每个项目级别上配置,而不是硬编码到模板本身中。
<?php
defined( 'ABSPATH' ) || exit;
use function $plugin_name_namespace\Core\get_current_plugin_domain;
printf( '<article class="post-entry-content">' );
if ( has_post_thumbnail() ) {
printf( '<a class="post-thumbnail-link" href="%s">%s</a>',
get_the_permalink(),
get_the_post_thumbnail()
);
}
echo '<div class="post-content">';
printf( '<h4 class="entry-title"><a href="%s" title="%s" rel="bookmark">%s</a></h4>',
get_the_permalink(),
get_the_title(),
get_the_title()
);
printf( '<div class="entry-excerpt">%s</div>' ,get_the_excerpt() );
printf('<a href="%s" class="details-link button" rel="nofollow">%s</a>',
get_the_permalink(),
__( "See More", get_current_plugin_domain() )
);
echo '</div>';
echo '</article>';
?>