如何?
固定中心的导航栏,但两侧没有背景色.
导航栏的宽度应该与容器的宽度相同,然后导航栏的背景颜色到容器的两侧(包含它),您不应该看到.
任何的想法?
此外,导航栏必须缩小容器宽度的大小,然后缩小页面:所以重新响应导航栏!
如何?
提前致谢.
我在我的数据库中有选项卡:PLAYERS和一个标签:SCORES.
在SCORES选项卡中,我有以下行:ID - IDPLAYER - SCORE
例如:
ID IDPLAYER SCORE
---------------------
1 1 5
2 2 4
3 1 3
4 2 1
5 1 9
Run Code Online (Sandbox Code Playgroud)
我想放一个模板:
对于" 玩家1 ",有3个分数.
得分的计数是" 17 "(9 + 3 + 5).
玩家得分的平均值是" 5.6 "(17totscores/3countScores).
我有一个ORM实体,没关系.
我有一个具有此功能的控制器:
public function avgScoreAction($id) {
$queryScore = $this->getDoctrine()
->getRepository('AcmeBundle:tabScores');
$queryAvgScore = $queryScore->createQueryBuilder('g')
->select("avg(g.score)")
->where('g.idPlayer = :idPlayer')
->setParameter('idPlayer', $id)
->getQuery();
$avgScore = $queryAvgScore->getResult();
$result = ("Score average: ".$avgScore);
return new Response($result);
Run Code Online (Sandbox Code Playgroud)
但是我有一个错误:
"Notice: Array …Run Code Online (Sandbox Code Playgroud) 我遇到了Symfony和ajax电话的麻烦.
我在Windows 8上的本地服务器上使用XAMPP 1.8.2.
每一个都很好,但当我接受回应时,我有这个,在正确的文本下面:
HTTP/1.0 200 OK Cache-Control: no-cache Date: Tue, 19 Nov 2013 14:58:18
Run Code Online (Sandbox Code Playgroud)
为什么?
我的代码:
在底部的HTML(Twig)中:
$.ajax({
url: "{{ path('score') }}",
data: { id: scoreid, value: value },
dataType: 'json',
type: 'POST',
success: function (data) {
if(data.responseCode==200 ){
$('#score').html(data.score);
$('#score').css("color","green");
}
else if(data.responseCode==400){
$('#score').html(data.score);
$('#score').css("color","red");
}
else{
alert("An unexpeded error occured.");
$('#score').html(data);
}
},
error: function (jxhr, msg, err) {
$('#score').html('<span style="color:red">Error!</span>');
}
});
Run Code Online (Sandbox Code Playgroud)
控制器"得分":
class scoreController extends Controller
{
public function onepointAction(Request $request) {
....some logical... …Run Code Online (Sandbox Code Playgroud)