在messages.en.yml,我有
confirmed: Congrats %username%, your account is now activated.
Run Code Online (Sandbox Code Playgroud)
但我想用'粗体'用户名示例......我怎么能做到这一点?
confirmed: Congrats <span class='bold'>%username%</span>, your account is now activated.
Run Code Online (Sandbox Code Playgroud)
当然我可以在这个例子中使用两个句子
first: Congrats
second: , your account ...
Run Code Online (Sandbox Code Playgroud)
和twig内部使用html标签,但这看起来很脏.
'use strict';
var trkiApp = angular.module('trkiApp', [
'trkiApp.tStatus',
'trkiApp.feed'
]);
var tStatus = angular.module('trkiApp.tStatus', [])
.factory('Status', ['$q']);
var feed = angular.module('trkiApp.feed', []);
Run Code Online (Sandbox Code Playgroud)
现在我不明白我怎么可能访问在另一个模块上定义的服务状态?
'use strict';
feed
.controller('FeedController', ['$scope','$http','Status']);
Run Code Online (Sandbox Code Playgroud)
我不应该对吗?但不知怎的,我......或者这是一个正确的行为?
我失去了trilion时间谷歌,但没有一个解决方案是好的.
我有这个查询构建器:
$qb2=$this->createQueryBuilder('s')
->addSelect('u')
->innerJoin('s.user','u')
->where("u.id IN(:followeeIds)")
->andWhere('s.admin_status = false')
->setParameter('user', $user)
->setParameter('followeeIds', $arrayFolloweeIds)
->orderBy('s.id','DESC')
->setMaxResults(15)
;
Run Code Online (Sandbox Code Playgroud)
我可以做第二个查询然后做,$qb->getDQL()但我会缓存查询?
错误:
Invalid parameter number: number of bound variables does not match number of tokens
Run Code Online (Sandbox Code Playgroud) 好的,我有这个代码:
SELECT
IFNULL(s2.id,s1.id) AS effectiveID,
IFNULL(s2.status, s1.status) AS effectiveStatus,
IFNULL(s2.user_id, s1.user_id) as effectiveUser,
IFNULL(s2.likes_count, s1.likes_count) as effectiveLikesCount
FROM statuses AS s1
LEFT JOIN statuses AS s2 ON s2.id = s1.shared_from_id
WHERE s1.user_id = 4310
ORDER BY effectiveID DESC
LIMIT 15
Run Code Online (Sandbox Code Playgroud)
我需要将它重写为querybuilder.那样的东西?
$fields = array('IFNULL(s2.id,s1.id) AS effectiveID','IFNULL(s2.status, s1.status) AS effectiveStatus', 'IFNULL(s2.user_id, s1.user_id) as effectiveUser','IFNULL(s2.likes_count, s1.likes_count) as effectiveLikesCount');
$qb=$this->_em->createQueryBuilder()
->select($fields)
->from('WallBundle:Status','s1')
->addSelect('u')
->where('s1.user = :user')
->andWhere('s1.admin_status = false')
->andWhere('s1.typ_statusu != :group')
->setParameter('user', $user)
->setParameter('group', 'group')
->leftJoin('WallBundle:Status','s2', 'WITH', 's2.id=s1.shared_from_id')
->innerJoin('s1.user', 'u')
->orderBy('s1.time', 'DESC') …Run Code Online (Sandbox Code Playgroud) 好吧,我很绝望.我正在使用FOSRestBundle和NelmioCorsBundle
当我尝试通过不同服务器的角度发布数据时,我仍然收到此错误:
XMLHttpRequest cannot load
http://IP/app_dev.php/api/v1/pages.json.
No 'Access- Control-Allow-Origin' header is present on the requested resource.
Origin 'http://127.0.0.1:9000' is therefore not allowed access.
Remote Address:IP:80
Request URL:http://IP/app_dev.php/api/v1/pages.json
Request Method:OPTIONS
Status Code:200 OK
Request Headers
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,sk;q=0.6,cs;q=0.4
Access-Control-Request-Headers:accept, authorization, content-type
Access-Control-Request-Method:POST
Cache-Control:no-cache
Connection:keep-alive
Host:192.168.43.195
Origin:http://127.0.0.1:9000
Pragma:no-cache
Referer:http://127.0.0.1:9000/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
Response Headers
Access-Control-Allow-Headers:X-Requested-With, content-type
Access-Control-Allow-Methods:POST, GET, PUT, DELETE, OPTIONS
Connection:Keep-Alive
Content-Length:573
Content-Type:text/html; charset=iso-8859-1
Date:Sun, 29 Jun 2014 18:07:54 GMT
Keep-Alive:timeout=5, max=100
Server:Apache/2.4.7 (Ubuntu) …Run Code Online (Sandbox Code Playgroud) 我试图通过我的第一个脚本执行一些命令,但它不起作用.
#!/bin/bash
#connect to server
echo "Connecting to the server..."
ssh -t root@IP '
#switch user to deploy
su - deploy
#switch path
echo "Switching the path"
cd /var/www/deploys/bin/app/config
#run deploy script
echo "Running deploy script"
/usr/local/bin/cap -S env=prod deploy
#restart apache
sudo /bin/systemctl restart httpd.service
bash -l
'
Run Code Online (Sandbox Code Playgroud)
怎么了?我成功连接到服务器,用户被更改,然后我没有看到任何事情发生.当我按下ctrl + c就像在终端中那样,应该执行的命令的一些输出出现,但是有一些错误.
为什么我在启动脚本后看不到终端中发生的一切?我这样做是错误的吗?
顺便说一句:当我尝试手动连接并自己运行命令时,一切都运行良好.
使用CentOS 7.
我将连接的手机用作ADB设备.
→phonegap -v 3.1.0-0.15.0
我的index.html几乎没有任何内容
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
Run Code Online (Sandbox Code Playgroud)
当我跑
? phonegap local run android
[phonegap] compiling Android...
[phonegap] successfully compiled Android app
[phonegap] trying to install app onto device
[phonegap] successfully installed onto device
Run Code Online (Sandbox Code Playgroud)
我可以看到我的应用程序运行,之前没有注意到控制台中的错误.然后我尝试了更复杂的东西,如ngRoute,但它没有用.我决定将所有数据删除到几乎为空的项目,如您所见(确保其他内容不会导致此错误).
然后我检查了控制台:
adb logcat | grep -i console
Run Code Online (Sandbox Code Playgroud)
我明白了:
I/Web Console( 3946): Could not find cordova.js script tag. Plugin loading may
fail.:1511
E/Web Console( 3946): Uncaught module cordova/plugin_list already defined:76 …Run Code Online (Sandbox Code Playgroud) 我想做的事情并不难.这是我关于symfony的第一个项目,这真的令人困惑.
我正在使用FOSUSerbundle.我不希望登录和注册下面/login和/registration
所以我做了一个捆绑,这是FOSUSerbundle的孩子......它覆盖了它的树枝.
我有:: base.html.twig,其中包括header.html.twig,我在那里:{% render 'FOSUserBundle:Security:login' %}渲染我的teplate(覆盖了FOS)工作gr8.即使提交后的错误也会在:: base模板下呈现"/"路径.
#Security.yml
form_login:
check_path: /login_check
login_path: /
provider: fos_userbundle
Run Code Online (Sandbox Code Playgroud)
效果很好.
我需要为我的注册做同样的事情.
所以在::base我包含welcome_page.html.twig我编码的地方{% render 'FOSUserBundle:Registration:register' %},我在我的重写模板下面:WelcomePageBundle:Registration:register.html.twig这个:
{% block fos_user_content %}
{% include "FOSUserBundle:Registration:register_content.html.twig" %}
{% endblock fos_user_content %}[/code]
Run Code Online (Sandbox Code Playgroud)
其中还包括我重写的包:WelcomePageBundle:Registration:register_content.html.twig这个:
{% for key, message in app.session.getFlashes() %}
<div class="{{ key }}">
{{ message|trans({}, 'FOSUserBundle') }}
</div>
{% endfor %}
<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" id="register_form">
{{ …Run Code Online (Sandbox Code Playgroud) 我想知道为什么表单类型中的max_length已弃用?

如何以最干净的方式达到预期的效果呢?
尝试按用户获取喜欢的状态。
public function getLikedStatuses(User $user)
{
$qb = $this->_em->createQueryBuilder();
$qb
->select('s.id')
->from('WallBundle:Likes','l')
->innerJoin('l.status', 's')
->where('l.user = :user')
->setParameter('user', $user)
->orderBy('s.id','DESC')
;
$qb2= $this->_em->createQueryBuilder()
->select('st')
->from('WallBundle:Status','st');
$qb2 ->andWhere($qb2->expr()->in('st.id',$qb->getDQL()));
return $qb2->getQuery()->getResult();
}
Run Code Online (Sandbox Code Playgroud)
错误:无效的参数编号:绑定变量的数量与令牌的数量不匹配
顺便说一句:当我转储$ qb-> getDQL()时:
string 'SELECT s.id FROM TB\WBundle\Entity\Likes l LEFT JOIN l.status s WHERE l.user = :user' (length=87)
Run Code Online (Sandbox Code Playgroud)
BTW2:当我用(12073)(状态ID)替换'$ qb-> getDQL()'时,它起作用了...