小编shi*_*hin的帖子

如何使用jQuery向加载的内容添加类

我正在加载内容,我想为该内容添加一个类.

主要内容

<div id="notice">

</div>
Run Code Online (Sandbox Code Playgroud)

要加载的内容.

<p>Se v&aring;r <br />
siste <span>KAMPANJE</span></p>
<p>V&aring;re <span>TILBUD</span></p>
Run Code Online (Sandbox Code Playgroud)

到目前为止我的jQuery.

$('#notice').load('notice.asp'); // this loads ok.

// but this does not
$("#notice p:even").addClass("bluenotice noticecommon");

$("#notice p:odd").addClass("greennotice noticecommon");
Run Code Online (Sandbox Code Playgroud)

我可以addClass()加载内容吗?

提前致谢.

jquery load

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

如何用PHP增加每个图像1

我有以下数组输出.

Array
(
    [0] => Training centers
    [22] => Training center ABC
    [16] => Training center CCF
    [17] => Training center LLI
    [23] => Training center BBC

 ...
)
Run Code Online (Sandbox Code Playgroud)

使用这个,我想像这样回应.

<ul>
<li><a href="center/22"><img src="center1.jpg" alt="Training center ABC" /></a></li>
<li><a href="center/16"><img src="center2.jpg" alt="Training center CCF" /></a></li>
...
Run Code Online (Sandbox Code Playgroud)

等等.我正在使用foreach($ center为$ key => $ center),但不确定如何增加图像数量.我已准备好这些图像了.但中心的数量将不得而知.

我尝试了以下但它没有显示我想要的东西.

echo "<ul>\n";
foreach($centres as $key=>$centre){
    echo '<li><a href="mycentre/admin/manage_mycentre/'.$key.'">';
    for ($i = 1; $i <= 10; $i++) {

        echo "<img src=\"assets/images/centre/centre$i.jpg\" />";
    }
    echo "</a></li>\n";
}
echo "</ul>\n"; …
Run Code Online (Sandbox Code Playgroud)

php

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

diff --staged与git中的staged文件进行比较是什么?

我知道git diff会比较分阶段文件和已修改但未分阶段的文件.

但git diff --staged(或--cached)比较哪些文件?

分阶段文件和已提交文件?

git diff和git diff之间有什么区别--staged?

我有点困惑.

提前致谢.

http://progit.org/book/ch2-2.html

git

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

当我将样式的span保存到MySQL时,样式将被删除

我使用TinyMCE作为我的PHP/CodeIgniter CMS后端输入.但是,当我使用文本颜色时,某些代码不会保存,也不会显示正确的颜色.

我怎么解决这个问题?

提前致谢.

<span style="color: #ff00ff;">Some text</span>
Run Code Online (Sandbox Code Playgroud)

<span  #ff00ff;">Some text</span>
Run Code Online (Sandbox Code Playgroud)

在数据库中


有些代码在这里.

在我的控制器中.

function _fields()
{
    $data = array(
       ....
        'content'          => $_POST['content'],
        ....
    );
    return $data;
}


function create()
{
    // We need TinyMCE, so load it
    $this->bep_assets->load_asset_group('TINYMCE');
    ...
    if ($this->input->post('name'))
    {
        $data = $this->_fields();
        $this->MKaimonokago->addItem($this->module,$data);
...
Run Code Online (Sandbox Code Playgroud)

在我的模型中.

function addItem($module,$data,$return_id=FALSE)
{
    $module_table = 'omc_'.$module;
    ...
    $this->db->insert($module_table, $data);
    ...
}
Run Code Online (Sandbox Code Playgroud)

php sanitization codeigniter tinymce

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

这是if声明吗?

我正在使用CodeIgniter.

$config['global_xss_filtering'] = FALSE在一个配置文件中设置.

然后我发现这段代码system/core/Input.php:

$this->_enable_xss= (config_item('global_xss_filtering') === TRUE);
Run Code Online (Sandbox Code Playgroud)

这个代码实际上是做什么的?它看起来不像是三元声明.在我看来是

$this->_enable_xss= (FALSE === TRUE);
Run Code Online (Sandbox Code Playgroud)

在这种情况下$this->_enable_xss返回FALSE?

php codeigniter

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

如何在MySQL中按月排序

这是演示

订单是11月和10月.如何向此添加ORDER BY,以便按月,Jan,Feb,Mar等订单.

提前致谢.

CREATE TABLE `hw_homework` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `studentid` int(10) NOT NULL,
  `subjectid` int(10) NOT NULL,
  `assignment_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `teacherid` int(10) NOT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=55 ;

--
-- Dumping data for table `hw_homework`
--

INSERT INTO `hw_homework` (`id`, `studentid`, `subjectid`, `assignment_name`, `teacherid`, `date`) VALUES
(52, 56, 13, '1A', 20, '2012-10-28'),
(53, 56, 6, '12', 18, '2012-10-28'),
(54, 56, 4, 'page42', …
Run Code Online (Sandbox Code Playgroud)

mysql sql-order-by

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

ccw在Vim宏中做了什么

在下面的vim宏从这篇文章中,作者给出了解释.我理解一些但不是一切.

:qccwcommand<Esc>:w<Ctl-W>jj<Enter>q
Run Code Online (Sandbox Code Playgroud)

此宏(包括记录开始/停止,如果您想知道)将把当前的'path_to_command'字改为'command',将文件写入磁盘,将窗口分割更改为grep搜索结果,向下移动一行在结果中导航到该结果的位置.

Q1.这是ccw做什么的?是否与cw(改变词语)有关但我不确定.

Q2.:w一定要写,对吗?

Q3.这是<Ctrl-W>jj做什么的?以下是:h CTRL-W_J关于什么,但我不确定我是否正在寻找正确的帮助,也不确定在这种情况下帮助的含义.

                                        *CTRL-W_J*
CTRL-W J    Move the current window to be at the very bottom, using the
    full width of the screen.  This works like closing the current
    window and then creating another one with ":botright split",
    except that the current window contents is used for the new
    window.
Run Code Online (Sandbox Code Playgroud)

vim vim-macros

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

如何检测输入字符串在Ruby中是否只有一个数字

正如我在标题中所写,我想找到一个字符串输入是否只包含一个数字.

例子是

222 # true
33333 # true
22334 # false
556677 # false
Run Code Online (Sandbox Code Playgroud)

我想使用String#reverse但它失败了556677.

if input == input.reverse
  # do something
end
Run Code Online (Sandbox Code Playgroud)

什么是最好的方法?

ruby

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

如何在Ruby中找到每个数组的总和

我试图找到每个数组的总和.

(1..9).to_a.combination(3).to_a.each{ |item| item.inject{:+}}
Run Code Online (Sandbox Code Playgroud)

但我的代码给出了以下内容.

[[1, 2, 3], [1, 2, 4], [1, 2, 5], [1, 2, 6], [1, 2, 7], [1, 2, 8], [1, 2, 9], 
[1, 3, 4], [1, 3, 5], [1, 3, 6], [1, 3, 7], [1, 3, 8], ...
Run Code Online (Sandbox Code Playgroud)

我期待的是这样的.

[6, 7, 8, 9,...]
Run Code Online (Sandbox Code Playgroud)

如何找到每个数组的总和?

ruby arrays

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

如何在 IRB 中使用 Ruby Vector 类

我在 IRB 中尝试了Ruby cross_product 。但它给出了一个错误。

irb(main):055:0> Vector[1, 0, 0].cross_product Vector[0, 1, 0]
NameError: uninitialized constant Vector
Run Code Online (Sandbox Code Playgroud)

如何在 IRB 中测试 Vector 类?

ruby vector

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

标签 统计

php ×3

ruby ×3

codeigniter ×2

arrays ×1

git ×1

jquery ×1

load ×1

mysql ×1

sanitization ×1

sql-order-by ×1

tinymce ×1

vector ×1

vim ×1

vim-macros ×1