我正在通过添加更多语言来改进我的Web应用程序.我按照本教程完成了它:https://coderwall.com/p/eiqd_g
一切似乎工作正常,但现在我已经发现,当试图在论坛上创建一个新帖子(HerzultForumBundle)时,我得到了上述异常.
我可以在调试器中看到:
在第8422行的kernel.root_dir/cache/dev/classes.php中
function twig_array_merge($arr1, $arr2)
{
if (!is_array($arr1) || !is_array($arr2)) {
throw new Twig_Error_Runtime('The merge filter only works with arrays or hashes.');
}
return array_merge($arr1, $arr2);
}
Run Code Online (Sandbox Code Playgroud)
在twig_array_merge(null,数组( '_区域设置'=> 'EN')) 在kernel.root_dir /高速缓存的/ dev /枝条/ C7/1/9188032d83474dae4ab5fad0cdaf278f4614c031cf7a5531428c5812bd57.php在线路200
echo ">
\t <a href=\"";
// line 81
echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath($this->getAttribute($this->getAttribute((isset($context["app"]) ? $context["app"] : $this->getContext($context, "app")), "request"), "get", array(0 => "_route"), "method"), twig_array_merge($this->getAttribute($this->getAttribute((isset($context["app"]) ? $context["app"] : $this->getContext($context, "app")), "request"), "get", array(0 => "_route_params"), "method"), array("_locale" => (isset($context["locale"]) …
Run Code Online (Sandbox Code Playgroud) 我在<img>
标签内有一个<a>
标签:
<a href="urlPage" class="contain-video">
<img src="urlImage" />
</a>
Run Code Online (Sandbox Code Playgroud)
该<a>
标签具有"包含视频"类,所以我想在重叠的实际图像的背景图像:
//css file
.contain-video img {
background: url('images/contain-video.png') no-repeat !important;
z-index: 1;
}
Run Code Online (Sandbox Code Playgroud)
但是没有显示背景图像.任何想法如何实现它?
为什么我在尝试获取时遇到此错误ContainerInterface
:
ERROR - exception 'ErrorException' with message 'Catchable Fatal Error: Argument 5 passed to Project\InvitationsBundle\Invitations::__construct() must implement interface Symfony\Component\DependencyInjection\ContainerInterface, none given, called in /www/project/app/cache/dev/appDevDebugProjectContainer.php on line 1709 and defined in /www/project/src/Project/InvitationsBundle/Invitations.php line 23'
Run Code Online (Sandbox Code Playgroud)
添加ContainerInterface
到构造方法时出现错误:
<?php
namespace Pro\InvitationsBundle;
use Pro\CommunityBundle\Entity\Community;
use Pro\InvitationsBundle\Entity\Invitation;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Pro\UserBundle\Entity\User;
use Symfony\Component\DependencyInjection\ContainerInterface;
class Invitations
{
private $mailer;
private $translator;
private $templating;
private $doctrine;
private $container;
function __construct(\Swift_Mailer $mailer, TranslatorInterface $translator, EngineInterface $templating,
Registry $doctrine, ContainerInterface $container)
{ …
Run Code Online (Sandbox Code Playgroud) 我可以在https://docs.npmjs.com/getting-started/publishing-npm-packages看到,它npm version <update_type>
改变了版本号package.json
(如果你有一个带有这个版本号的标签,也可以添加到你的 git 存储库中)。然后,npm publish
提交更改并更新包。
我在 Github 中有一个存储库,它在NPM 中发布。
问题是:我必须在npm version <update_type>
或之前明确提交我的更改npm publish
,还是会npm publish
处理它。
这是我现在如何进行的一个例子:
做一些改变
执行以下命令:
git add .
git commit -m "Message"
npm version minor
npm publish
这是我不确定是否有效:
做一些改变
执行以下命令:
npm version minor
npm publish
编辑:
事实上,如果我npm version minor
之前没有提交更改就执行,我会收到这个错误:
npm 错误!Git 工作目录不干净。
所以答案是:是的,我必须在npm version <update_type>
.
我正在尝试加载JQuery //ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
:
<script src="{{ asset('//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js') }}"></script>
Run Code Online (Sandbox Code Playgroud)
如果收到该文件,则获取该文件.如果没有,从自己的服务器获取文件:
<script><window.jQuery || document.write('<script src="{{ asset("../app/Resources/public/js/vendor/jquery-1.9.1.min.js") }}"><\/script>')</script>
Run Code Online (Sandbox Code Playgroud)
但它给了我一个语法错误.我试图改变报价,但不起作用:
<script><window.jQuery || document.write('<script src="{{ asset(\"../app/Resources/public/js/vendor/jquery-1.9.1.min.js\") }}"><\/script>')</script>
Run Code Online (Sandbox Code Playgroud)
它再次给了我一个语法错误.我究竟做错了什么?
我在所有文件(js,css,php,...)中添加了许可文本,但是在尝试在.html.twig
文件中添加文本时遇到了麻烦.我试过以下代码:
<!--
Itransformer.es is an online application to transform images
Copyright (C) 2013 Manolo Salsas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty …
Run Code Online (Sandbox Code Playgroud) 我正在使用方法中的下一个代码发送一种电子邮件:
$message = \Swift_Message::newInstance('smtp.gmail.com', 465, 'ssl')
->setSubject($this->translator->trans("Invitación a la comunidad %community%", array(
'%community%' => $community->getNiceName()
)))
->setFrom('manolez@gmail.com', 'contact') // TODO DRY
->setTo($email)
->setReplyTo($inviter->getEmail(), $inviter->getFullName())
->setContentType('text/html')
->setBody($this->templating->render(
'ProInvitationsBundle:Invitations:inviteEmail.html.twig',
array('community' => $community, 'inviter' => $inviter)));
Run Code Online (Sandbox Code Playgroud)
我想在身体上嵌入一个图像,所以我可以这样做:
$message = \Swift_Message::newInstance('smtp.gmail.com', 465, 'ssl')
->setSubject($this->translator->trans("Invitación a la comunidad %community%", array(
'%community%' => $community->getNiceName()
)))
->setFrom('manolez@gmail.com', 'contact') // TODO DRY
->setTo($email)
->setReplyTo($inviter->getEmail(), $inviter->getFullName())
->setContentType('text/html')
->setBody('<html><head></head><body>Here is an image <img src="' .
$message->embed(Swift_Image::fromPath('http://site.tld/logo.png')) .
'" alt="Image" />' .
' Rest of message' .
' </body></html>');
Run Code Online (Sandbox Code Playgroud)
但是这样,$message …
我=~
在Neo4j docs中找不到这个operator(),但他们在这个例子中使用它:
MATCH (user)-[:friend]->(follower)
WHERE user.name IN ['Joe', 'John', 'Sara', 'Maria', 'Steve'] AND follower.name =~ 'S.*'
RETURN user, follower.name
Run Code Online (Sandbox Code Playgroud)
知道这意味着什么吗?
我有一个这样的字符串:'3,6,43,8'
.
我可以轻松地将它转换为数组:
$newArray = explode( ',', $string );
Run Code Online (Sandbox Code Playgroud)
但由于我需要数组中的整数元素,我应该将每个数组元素转换为整数:
foreach( $newArray as $key => $sNumber ) {
$newArray[ $key ] = intval( $sNumber );
}
Run Code Online (Sandbox Code Playgroud)
有没有办法直接将数组元素转换为整数而不是字符串?
我需要取消left
CSS文件中的规则并将其替换为margin-left
:
.aClass {
left: 5px;
}
Run Code Online (Sandbox Code Playgroud)
要覆盖的规则:
.aClass {
left: none !important;
margin-left: 5px;
}
Run Code Online (Sandbox Code Playgroud)
但left: none
似乎什么都不做,left: 0
正在重新定位图层.那么如何取消left
规则呢?我不应该覆盖原始规则,因为它是插件的一部分,可以更新覆盖现有文件.
我一直在一个分支机构工作,有一些代码来改进应用程序.既然我已经完成了,我想将这个分支与master分支合并,但我不能.我首先尝试像这样检查主分支:
$ git checkout master
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
error: The following untracked working tree files would be overwritten by checkout:
vendor/bin/doctrine
vendor/bin/doctrine.php
...
Run Code Online (Sandbox Code Playgroud)
但供应商目录包含在.gitignore
文件中.如果我做:
$ git status
Run Code Online (Sandbox Code Playgroud)
我明白了:
# On branch mejoras_contralador
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)
在此之后,我会这样做:
$ git merge branch
Run Code Online (Sandbox Code Playgroud)
如何避免这个错误?