我有一个非常基本的表:
<table id="ttable5" class="table-default">
<thead>
<tr>
<th>Nombre</th>
<th class="sort-date">Provincia</th>
<th class="sort-digit">Municipio</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tablaprim">1VESTIBULUM TORTOR NISL </td>
<td>Sevilla</td>
<td>Castilleja de la Cuesta</td>
</tr>
<tr>
<td class="tablaprim">4VESTIBULUM TORTOR NISL </td>
<td>Sevilla</td>
<td>Castilleja de la Cuesta</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我需要这个:
------------
head
------------1px border #fff
------------3px border #gray
body
------------
Run Code Online (Sandbox Code Playgroud)
我只能展示其中一个边界,而不是两个同时出现.这并不重要,但我很好奇导致这个问题的原因.
我的css:
thead{border-bottom: 1px solid #fff;}
tbody{border-top: 3px solid #4d4d4d;}
Run Code Online (Sandbox Code Playgroud)
编辑:
由于看起来边界崩溃可能是问题,但我无法使其工作,我已经设置了这个沙箱:
在那里你可以看到只有一个灰色的边框,它上面应该有一个1px的白色边框
我有一个通过ajax填充的列表.这个列表我可以通过ajax添加和删除项目,也可以对它们进行排序.我有两个问题.
第一个是在这里,它仍然没有解决:https://stackoverflow.com/questions/6370213/jquery-dynamic-dragn-drop-doesnt-update-order(在列表中排序来自数据库的项目数直到我刷新才会更新)
第二个更糟糕.通过ajax更新列表中的内容后(假设我添加了一个新项),可重排的函数停止工作,直到我重新加载页面.似乎.live不适用于可排序,我对这个想法不合适.我将添加一些代码:
我的清单是这样的:
<ul id="listaruta">
<li> ... </li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我的文章排序脚本:
$(function() {
$("ul#listaruta").sortable({
opacity: 0.6,
cursor: 'move',
update: function() {
var order = $(this).sortable("serialize") + '&action=updateRecordsListings';
$.post("/plugins/drag/updateDB.php", order);
}
});
});
Run Code Online (Sandbox Code Playgroud)
我正在使用它来进行排序功能:http://www.webresourcesdepot.com/wp-content/uploads/file/jquerydragdrop/
这应该相当容易,但我不知道我在这里缺少什么:
我有我的数据库,我希望从中填充alt属性.
我的代码如下:
<img src="admin/uploads/retouch/'.$list->thumbnail.'" class="thumb-image" alt="'.utf8_encode(addslashes($list->titulo)).'" />
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我的数据库中的"titulo"里面有什么东西"就在它上面,我在我的代码中得到了这个结果:
<img ti!\""="" por="" ¡hazlo="" manos.="" en="" estÁ="" prestaciones="" tus="" mejorar="" alt="\" class="thumb-image" src="admin/uploads/retouch/noticia_default.png">
Run Code Online (Sandbox Code Playgroud)
来自数据库的句子是:"MEJORAR TUS PRESTACIONESESTÁENTUS MANOS."HAZLO POR TI!
在之前的一个问题中(以雄辩的方式获取外键的名称)我在Laravel 4中询问了一对多与雄辩的关系,但是当我进入一个更复杂的Schema时,我开始越来越混淆它是怎么回事正确的方法.我想我可以简单地模仿常规的SQL查询,但我想以正确的方式做到这一点,使用模型和我用laravel和eloquent的所有工具.
所以这些是我的表(其中一些)
Units
+------------+------------------+
| Field | Type |
+------------+------------------+
| id | int(10) unsigned |
| name | varchar(255) |
| type | int(11) |
| created_at | timestamp |
| updated_at | timestamp |
| value | int(11) |
| army | int(11) |
+------------+------------------+
Armies
+------------+------------------+
| Field | Type |
+------------+------------------+
| id | int(10) unsigned |
| name | varchar(255) |
| created_at | timestamp |
| updated_at | timestamp |
| …Run Code Online (Sandbox Code Playgroud) 我有两个连接的表:团队和成员。这些模型通过 an:m 关系连接,在我的团队视图中,我将创建一个 foreach 循环来获取所述团队的成员,如下所示:
@foreach( $team->teammember as $member )
{{ $member->firstname }} {{ $member->lastname }}
@endforeach
Run Code Online (Sandbox Code Playgroud)
到目前为止,一切都很好并且正常工作,我的问题是,如何获得按姓氏排序的成员列表?在我的控制器中,我没有获取成员,因为连接是通过模型完成的,我只能对团队进行排序,而不能对成员进行排序。
这可能是因为我做错了什么并且改变了一些东西但是错误在我添加错误消息以进行验证的每个地方都显得很突出.这是一个例子:
$validator = Validator::make(Input::all(), $rules, $messages);
$messages = $validator->errors();
$operation = Operation::find(Input::get('operation_id'));
if($operation->membersNeeded()<Input::get('max')){
$error=1;
$messages->add('limit', 'You can only have '.$operation->membersNeeded().' more hostesses on this operation');
}
Run Code Online (Sandbox Code Playgroud)
给我以下错误:
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Call to a member function add() on a non-object
Run Code Online (Sandbox Code Playgroud)
选择的行将是y使用add()添加我的错误消息的地方.这工作正常,我正在编辑网站的其他部分,现在突然它不起作用.这让我很困惑.
我正在用PHP构建一个网站,我用gettext处理翻译.到目前为止,一切都很完美,但网站在某些时候会向用户发送电子邮件,我无法收到要翻译的电子邮件.
我使用.mo文件翻译网站,并在会话中选择我将使用的语言:
$lang=$_SESSION['lang'];
switch ($lang){
case 'en':
setlocale(LC_ALL, 'en_US.utf8');
putenv('LC_ALL=en_US.utf8');
bindtextdomain("estribo", "locale");
bind_textdomain_codeset("estribo", 'UTF-8');
textdomain("estribo");
break;
case 'es':
putenv('LC_ALL=es_ES.utf8');
setlocale(LC_ALL, 'es_ES.utf8');
bindtextdomain("estribo", "locale");
bind_textdomain_codeset("estribo", 'UTF-8');
textdomain("estribo");
break;
}
Run Code Online (Sandbox Code Playgroud)
在locale/en_US.utf8/estribo.mo里面我已经翻译了所有的字符串,当我在页面的任何地方起诉它时它工作正常,例如:
<a href="index.php"><?echo _("Index");?></a>
Run Code Online (Sandbox Code Playgroud)
当我对变量(字符串)的内容做同样的事情时,它会完全转换为rpoblem,我稍后会通过邮件发送它而不是在屏幕上打印它.
这是我的电子邮件代码(checkout.php):
$message = _("Some text to send via email").": \n";
//a few more lines of
$message .= _("Some more text").": \n";
mail($email, $subject, $message);
Run Code Online (Sandbox Code Playgroud)
我到checkout.php的方式是通过ajax:
function () {
$.post('checkout.php', {
cart: this.cart.items,
total: this.format(this.total),
quantity: this.quantity,
shipping: $('select.shipping').val(),
tipopago: $('input.tipopago').val(),
customer: $('#checkout-form').serialize()
}, function (result) {
window.location.href …Run Code Online (Sandbox Code Playgroud) 我有一个项目列表,我希望能够使用视图中的某些按钮进行过滤(显示,它们是活动的,只显示以某个字母开头的那些等),我对每个可能的组合进行了不同的查询一旦我有超过3个按钮进行过滤,那就失控了.
所以我想根据按下的按钮为我的初始查询添加一个where子句,但到目前为止我没有工作,我不知道它是否是分页:
(这是一个只有一个按钮的示例,我稍后会添加更多条件,但这已经不起作用了).
public function index()
{
$hostesses = Hostess::orderBy('lastname', 'asc')
->paginate(30);
if (Input::has('l')){
$hostesses->where('lastname', 'like', Input::get('l').'%');
}
$this->layout->content = View::make('hostesses.index', compact('hostesses'));
}
Run Code Online (Sandbox Code Playgroud)
我在视图上收到此错误:
ErrorException
call_user_func_array() expects parameter 1 to be a valid callback, class 'Illuminate\Support\Collection' does not have a method 'where'
Run Code Online (Sandbox Code Playgroud) 我们通常Redirect::back()在控制器内部使用重定向到上次访问的页面,但是,是否有 Laravel 函数可以在视图中用作链接?
php ×6
laravel-4 ×5
laravel ×3
eloquent ×2
jquery ×2
ajax ×1
css ×1
escaping ×1
gettext ×1
html ×1
html-table ×1
javascript ×1
string ×1
translation ×1