小编Tom*_*ski的帖子

CodeIgniter - 自动加载视图?

有没有办法在每个函数(在控制器中)加载视图(页眉或页脚)?我在if/else那里有几个陈述,在我需要的时候改变这一切将是一件痛苦的事.

codeigniter

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

Symfony2 - 无法显示实体的值

findOneBy在我的实体中找到(使用)一个单行.这是代码:

$userown = $this->getDoctrine()->getRepository('GameShelfUsersBundle:Own')
    ->findOneBy(array(
        'game' => $game->getId(),
        'user' => $em->getRepository('GameShelfUsersBundle:User')->find($session->getId())
    ));
Run Code Online (Sandbox Code Playgroud)

现在我将它传递给模板userown.但是当我尝试在树枝上打印时,使用{{ userown.typo }}它会引发错误:

An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Object of class Proxies\__CG__\GameShelf\UsersBundle\Entity\OwnState could not be converted to string in D:\!!XAMPP\htdocs\
Run Code Online (Sandbox Code Playgroud)

我的实体就在这里.

doctrine symfony

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

IE 7和8无法识别jQuery的高度和宽度?

我用config变量写了几个函数.这是它的样子:

scripts = function() {
    var config = {
        windowWidth: $(window).width(),
        windowHeight: $(window).height()
    }

    function generatePages() {
        $('section.main').each(function() {
            $(this).css({
                'width' : config.windowWidth,
                'height': config.windowHeight
            });

            if($(this).children('.more').length) {
                $(this).children('.more').css('line-height',config.windowHeight+'px')
            }
        });
    }

    return {
        config:config,
        generatePages:generatePages
    }
}();

scripts.generatePages();
Run Code Online (Sandbox Code Playgroud)

它适用于所有浏览器,但IE 7-9不运行generatePages,似乎它不"理解" $(window).width()height().我能做什么?

javascript jquery internet-explorer

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

无法在Symfony2中从YML生成实体

我的实体代码:

GameShelf\GamesBundle\Entity\Game:
    type: entity
    table: games
    id:
        id:
            type: integer
            generator: { strategy: AUTO }
    fields:
        parent_id:
            type: integer
            length: 11
        name:
            type: string
            length: 200
        slug:
            type: string
            length: 200
        reldate:
            type: date
        genres:
            type: text
        platforms:
            type: text
        developers:
            type: text
        desc:
            type: text
        desc_src:
            type: text
        rate:
            string: integer
            lenght: 10
Run Code Online (Sandbox Code Playgroud)

我跑了php app/console doctrine:generate:entities GameShelf\GamesBundle\Entity\Game,它回来了Namespace "GameShelf\GamesBundle\Entity\Game" does not contain any mapped entities..怎么了?我跟着这里的文档.

symfony

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

无法在Laravel 4中登录用户

我尝试在Laravel 4中创建一个登录系统.为此,我使用了Authbuild.首先,我还没有创建一个注册页面,所以我在我的数据库中创建了一个用户.对于密码,我用过

echo Hash :: make('password');

它给了我一个哈希,我粘贴在pass现场.现在,我想记录用户.为此,我创建了一个路由:

Route::post('/users/login/try', array('as' => 'loginTry'), function() {
    $user = array(
        'name' => Input::get('user'),
        'pass' => Hash::make(Input::get('pass'))
    );

    if(Auth::attempt($user,true)) {
        return Redirect::intended('dashboard');
    } else {
        return Redirect::to('/users/login');
    }
});
Run Code Online (Sandbox Code Playgroud)

和一个观点:

{{ Form::open(array('route' => 'loginTry')) }}
<p>{{ Form::label('user','Nazwa u?ytkownika') }} {{ Form::text('user') }}</p>
<p>{{ Form::label('pass','Has?o') }} {{ Form::password('pass') }}</p>
<p>{{ Form::submit('Zaloguj') }}</p>
{{ Form::close() }}
Run Code Online (Sandbox Code Playgroud)

当我尝试提交表格时,我明白了

call_user_func_array() expects parameter 1 to be a valid callback, no array or string given
Run Code Online (Sandbox Code Playgroud)

我做错了什么?

laravel laravel-4

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

以字体缩写方式将单位添加到font-size和line-height变量

我尝试学习SASS.为了编译我的文件,我使用Prepros应用程序.它一直很好,直到我开始使用mixins.我的代码如下:

@mixin fontface($size) {
    font: ($size)px/($size*1.7)px "Roboto Slab", Georgia, sans-serif;
}
Run Code Online (Sandbox Code Playgroud)

我这样使用它:

@include fontface(28);
Run Code Online (Sandbox Code Playgroud)

当我编译它时,我将空格添加到变量中,如下所示:

font: 28 px/47.6 px "Roboto Slab", Georgia, sans-serif;
Run Code Online (Sandbox Code Playgroud)

我该怎么改变它?是因为应用程序,还是我做错了什么?

sass

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

comment_reply_link没有显示

我想创建自己的评论模板,所以我确实运行了foreach,结果出来了:

<dl class="commentlist">
    <?php foreach ($comments as $comment) : ?>
        <dt><?php printf(__('%s'), get_comment_author_link()) ?> <em><?php echo human_time_diff( get_comment_time('U'), current_time('timestamp') ); ?> <?php echo get_locale() == 'pl_PL' ? 'temu' : 'ago'; ?></em></dt>
        <dd>
            <?php if ($comment->comment_approved == '0') : ?>
                <em>Komentarz czeka na zatwierdzenie</em><br />
            <?php endif; ?>

            <?php comment_text(); ?>
            <?php comment_reply_link( array ( 'reply_text' => 'Reply this comment' ) ); ?>
        </dd>
    <?php endforeach; ?>
</dl>
Run Code Online (Sandbox Code Playgroud)

一切都好,但我无法comment_reply_link上班.我尝试使用Wordpress中找到的解决方案评论回复链接没有出现,但它对我不起作用.

comment_reply_link( array('reply_text' => 'Reply …
Run Code Online (Sandbox Code Playgroud)

wordpress

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

Simple ++不会增加数字

我确实错过了一些非常简单的东西,但是,我做到了.我找不到它.我的代码如下:

    var count = 0;

    $(document).on('click', button, function() {
        var originalLink = button.attr('href'),
            elems,
            count = parseInt(originalLink.match(/\d+$/)[0]),
            cleanlink = originalLink.replace(/[0-9]/g, ''),
            link = cleanlink+''+count;

        $.get(link, function(data) {
            elems = $(data).find(elements);
            $(elems).hide();
            $(elems).appendTo(container);
        }).done(function() {
            count = count++;
            var offsetButton = $(button).offset().top;
            $('html, body').animate({
                scrollTop: offsetButton
            },500);

            if($('.masonry').length) {
                container.masonry('reload');
                container.masonry('reloadItems');
            };

            $(elems).fadeIn();
        });

        alert(count);

        return false;
    });
Run Code Online (Sandbox Code Playgroud)

它应该count随着每次点击而增加.但事实并非如此.哪里是我的错?

javascript jquery

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