小编Moi*_*ade的帖子

if = false,怎么样?

$a = true;
$b = true;


if (($a == false) || ($b == false)) {
 echo "BAD";
} else {
  echo "OK";
}
Run Code Online (Sandbox Code Playgroud)

为什么这会让我觉得"不好"?我该怎么办呢?

php if-statement

4
推荐指数
2
解决办法
3万
查看次数

如何使用symfony对管理面板中的自己的列进行排序?

M schema.yml:

News:
  columns:
    title:
      type: string(50)
    category_id:
      type: integer(4)
  relations:
    Category:
      local: category_id
      foreign: category_id
      type: one

Category:
  columns:
    category_name:
      type: string(50)

generator:
  class: sfDoctrineGenerator
  param:
    model_class:           News
    theme:                 admin
    non_verbose_templates: true
    with_show:             false
    singular:              ~
    plural:                ~
    route_prefix:          news
    with_doctrine_route:   true
    actions_base_class:    sfActions

    config:
      actions: ~
      fields:  ~
      list:
        display: [news_id, title, category_name]
      filter:
        display: [news_id, title, category_id]
      form:    ~
      edit:    ~
      new:     ~
Run Code Online (Sandbox Code Playgroud)

在news.class中:

public function getCategoryName()
{
  return $this->getCategories()->getCategoryName();
}
Run Code Online (Sandbox Code Playgroud)

这有效,但我不能对这个字段进行排序.我可以按id,title,category_id排序,但不能按category_name排序.如何按此自定义列排序?

php doctrine symfony1 symfony-1.4

1
推荐指数
1
解决办法
2912
查看次数

选择的默认样式

<select id="select">
    <option>1</option>
    <option>2</option>
    <option>3</option>
</select>

<span id="red">red </span> <span id="default">default</span>

$("#red").click(function(){
    $("#select").css('background-color', 'red');
});

$("#default").click(function(){
    $("#select").css('background-color', 'white');
});
Run Code Online (Sandbox Code Playgroud)

如果我点击红色然后选择是红色.如何设置选择的默认样式,对白色?

html javascript css jquery

1
推荐指数
1
解决办法
304
查看次数

标签 统计

php ×2

css ×1

doctrine ×1

html ×1

if-statement ×1

javascript ×1

jquery ×1

symfony-1.4 ×1

symfony1 ×1