Views 2537 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

# 요약


1. 우선 bootstrap을 다운로드 : http://getbootstrap.com/

2. public 폴더안에 css, fonts, js 폴더 통자로 복사 붙여넣기

3. 내가 만든 blade 또는 view파일에

{{ HTML::style('css/bootstrap.css') }}

{{ HTML::style('css/bootstrap-responsive.css') }}

{{ HTML::script('js/jquery.v1.8.3.min.js') }}

{{ HTML::script('js/bootstrap.min.js') }}


head사이에 넣기!




# 원문


The Twitter-Bootstrap is a simple front-end framework that is used in many web applications.

You can download the latest version at getbootstrap.com. Laravel also has a bootstrap-directory, but this has nothing to do with the Twitter-Bootstrap.

This chapter is based on the previous Using Templates chapter. To start directly, you have to download using-templates-package.

Add Bootstrap to your Application

To make the bootstrap available for our application we have to create some directories:

  • /public/css
  • /public/fonts
  • /public/js

The downloaded bootstrap-package also has this directories somewhere inside. Just copy (extract) the files to the appropriate directories. In addition we download jQuery.com to supply it directly in our public js-directory. Now you should have following files in your public:

  • /public/css/bootstrap.css
  • /public/css/bootstrap.min.css
  • /public/css/bootstrap-theme.css
  • /public/css/bootstrap-theme.min.css
  • /public/fonts/glyphicons-halflings-regular.eot
  • /public/fonts/glyphicons-halflings-regular.svt
  • /public/fonts/glyphicons-halflings-regular.ttf
  • /public/fonts/glyphicons-halflings-regular.woff
  • /public/js/bootstrap.js
  • /public/js/bootstrap.min.js
  • /public/js/jquery-1.11.1.min.js

Use Bootstrap in your Master-Template

We have to include the Bootstrap at our master template to supply it to all pages.

/app/views/layouts/master.blade.php:

<!DOCTYPE html>
<html>
    <head>
        <title>
            @section('title')
            Laravel 4 - Tutorial
            @show
        </title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">

        <!-- CSS are placed here -->
        {{ HTML::style('css/bootstrap.css') }}
        {{ HTML::style('css/bootstrap-theme.css') }}

        <style>
        @section('styles')
            body {
                padding-top: 60px;
            }
        @show
        </style>
    </head>

    <body>
        <!-- Container -->
        <div class="container">

            <!-- Content -->
            @yield('content')

        </div>

        <!-- Scripts are placed here -->
        {{ HTML::script('js/jquery-1.11.1.min.js') }}
        {{ HTML::script('js/bootstrap.min.js') }}

    </body>
</html>

According to the Bootstrap-Help we add a meta-tag "viewport" for mobile devices. We can use {{ HTML::style('...') }} to add a css and {{ HTML::script('...') }} to add a javascript to our template. So we insert two css and two scripts.

To get this example working we need to add a padding for our body to show the menu correctly. To give the views the possibility to change the styles we add a styles section.

If you test the view, you will not see much changes. In the next step we add a main navigation-bar.

/app/views/layouts/master.blade.php:

<!DOCTYPE html>
<html>
    <head>
        <title>
            @section('title')
            Laravel 4 - Tutorial
            @show
        </title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">

        <!-- CSS are placed here -->
        {{ HTML::style('css/bootstrap.css') }}
        {{ HTML::style('css/bootstrap-theme.css') }}

        <style>
        @section('styles')
            body {
                padding-top: 60px;
            }
        @show
        </style>
    </head>

    <body>
        <!-- Navbar -->
        <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>

                    <a class="navbar-brand" href="#">Laravel</a>
                </div>
                <!-- Everything you want hidden at 940px or less, place within here -->
                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                        <li><a href="{{{ URL::to('') }}}">Home</a></li>
                    </ul> 
                </div>
            </div>
        </div> 

        <!-- Container -->
        <div class="container">

            <!-- Content -->
            @yield('content')

        </div>

        <!-- Scripts are placed here -->
        {{ HTML::script('js/jquery-1.11.1.min.js') }}
        {{ HTML::script('js/bootstrap.min.js') }}

    </body>
</html>

I don't want to explain all the elements here. You can look at the Bootstrap Help.

For the Home-Button we insert {{{ URL::to('') }}} to get automatic the correct link to our homepage.

You can test the new layout in your browser.



[출처] https://bitbucket.org/beni/laravel-4-tutorial/wiki/Add_Twitter-Bootstrap



?

  1. [js] 후리자(영규) 스타일들..

    Date2013.04.23 CategoryDevelop Byhooni Views7154
    Read More
  2. [js] 핫키(단축키) 구현방법

    Date2003.04.23 CategoryDevelop Byhooni Views7629
    Read More
  3. [js] 한글주소(URL) 인코딩(encode, Encoding), 자바스크립트(JavaScript)

    Date2013.04.23 CategoryDevelop Byhooni Views11328
    Read More
  4. [js] 한글문서로 된 259가지 자바스크립트 예제파일

    Date2013.04.23 CategoryDevelop Byhooni Views6764
    Read More
  5. [js] 폼(form) 전송시 중복 클릭 방지 간단한 구문

    Date2013.04.23 CategoryDevelop Byhooni Views9316
    Read More
  6. [js] 파이어폭스(Firefox;F/F)에서 outerHTML 작동하도록 만든 메소드

    Date2013.04.23 CategoryDevelop Byhooni Views16441
    Read More
  7. [js] 툴팁.. 좋은거.. (tooltip)

    Date2013.04.23 CategoryDevelop Byhooni Views7058
    Read More
  8. [js] 키보드 아스키코드(ASCII) 코드보기

    Date2003.04.23 CategoryDevelop Byhooni Views32476
    Read More
  9. [js] 키보드 아스키 코드 확인하는 간단한 소스

    Date2003.04.23 CategoryDevelop Byhooni Views7748
    Read More
  10. [js] 큐 형식으로 배열사용.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views7014
    Read More
  11. [js] 쿠키(cookie)에 대한 설명과 예제..

    Date2003.04.23 CategoryDevelop Byhooni Views8320
    Read More
  12. [js] 초간단 현재 사이트 쿠키 확인하는 명령~

    Date2003.04.23 CategoryDevelop Byhooni Views7275
    Read More
  13. [js] 초간단 암호화/복호화 소스..

    Date2003.04.23 CategoryDevelop Byhooni Views8839
    Read More
  14. [js] 주소표시줄 URL 읽어오기 (변경까지)

    Date2014.01.21 CategoryDevelop Byhooni Views1
    Read More
  15. [js] 주민번호 생성기..

    Date2003.04.23 CategoryDevelop Byhooni Views8142
    Read More
  16. [js] 좋은 강연자료 & UI 자료

    Date2014.10.06 CategoryDevelop Byhooni Views905
    Read More
Board Pagination Prev 1 ... 8 9 10 11 12 ... 53 Next
/ 53