Views Views is where we store HTML and lots of contents, we are going to display our user. So, we have models that interact with database. We have controllers,

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

MA foundation Creating webpages using XHTML (part 2) Simon Mahony CCH.
Source: ojects/tabber/ ojects/tabber/
Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
Understanding HTML Style Sheets. What is a style?  A style is a rule that defines the appearance and position of text and graphics. It may define the.
HTML & CSS A brief introduction. OUTLINE 1.What is HTML? 2.What is CSS? 3.How are they used together? 4.Troubleshooting/Common problems 5.More resources.
Creating a Basic Web Page
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Eat Your Words! Creating webpage Layout. CONTENT The Layout of a Webpage HEADER FOOTER Each of these sections represents a ‘div’ (or divider). By linking.
Server-side Scripting Powering the webs favourite services.
Shows the entire path to the file, including the scheme, server name, the complete path, and the file name itself. Same idea of stating your full name,
>> Introduction to HTML: Tags. Hyper - is the opposite of linear Text – words / sentences / paragraphs Mark-up – Marking the text Language – It is a language.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
WEB DESIGN UNIT 2 Unit 2 Module 2-5. WHAT HAVE YOU LEARNED?  What is the title tag do? Where does it show?  What are the tags that need to be on every.
Microsoft FrontPage 2003 Illustrated Complete Using a Dynamic Web Template.
Creating Webpage Using HTML
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
Louisa Lambregts, Louisa Lambregts
CSE 409 – Advanced Internet Technology Today you will learn  Styles  Themes  Master Pages Themes and Master Pages.
Walkthrough example including SAS output How to create a mobile WebApp? PhUSE / 12. October 2015 / Katja Glaß BHC 4:3 Template 2010 June 2014Page 1.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
CSCI 6962: Server-side Design and Programming Facelets and User Interface Design.
USING JAVASCRIPT TO SHOW AN ALERT Web Design Sec 6-2 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
CSU Extension Webpage Template Session 4 February 2010.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
HTML. Hyper Text Markup Language Markup your text document The markup is the tag Hyper text means you can jump from place to place Programming language.
Source of website: “Text/css rel=“styles heet” This is an external style sheet link. This means that the.
INTRODUCTION ABOUT DIV Most websites have put their content in multiple columns. Multiple columns are created by using or elements. The div element is.
Making the website. Get your folders sorted first Create a new folder in “N” called “My hockey website” Create folders inside called “Documents”, “images”
Finally getting to html and CSS… Tim Berners-Lee, the writer of the software program that makes him the inventor of the WWW, defines the Internet as a.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
HTML Extra Markup CS 1150 Spring 2017.
Getting Started With HTML
Advanced HTML Tags:.
Cascading Style Sheets
Week-12 (Lecture-1) Cascading Style Sheets (CSS): describe how documents are presented on screens. Types of Style Sheets: External Style Sheet - Define.
Web Architecture & HTML
Web Basics: HTML/CSS/JavaScript What are they?
4.01 How Web Pages Work.
Objective % Select and utilize tools to design and develop websites.
PHP variables.
Using JavaScript to Show an Alert
Florida Gulf Coast University
Intro to JavaScript CS 1150 Spring 2017.
Introduction to Web programming
>> PHP: HTML Integration
Intro to Web Development Class A Review
Objective % Select and utilize tools to design and develop websites.
Filezilla problems continuing
APTECH JANAKPURI INSTITUTE PROVIDING WEB DESIGNING COURSES Address:- J-1,2nd Floor, Opp Metro Pillar No – 559, Janakpuri East, Delhi /42.
Introduction to JavaScript
Software Architecture & Design (CSC-323)
CSS.
A second look at JavaScript
Of HTML, CSS and JavaScript
Customizing Editable Regions and Building Templates
JavaScript: How To? B. Ramamurthy.
Building Web Applications
Objective Understand web-based digital media production methods, software, and hardware. Course Weight : 10%
What are Cascading Stylesheets (CSS)?
Teaching slides Chapter 6.
Using Templates and Library Items
HTML Structure.
Introduction to JavaScript
Introduction to Programming and JavaScript
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
INTERNATIONAL INSTITUTE OF IFORMATION TECHNOLOGY, (I²IT)
Introduction to Web programming
Presentation transcript:

CS428 Web Engineering Lecture 16 Views & BladeTemplating (Laravel – III)

Views Views is where we store HTML and lots of contents, we are going to display our user. So, we have models that interact with database. We have controllers, which contains lot of our application logic.

Our routes, which contains our applications URL. Our view, which contains design and HTML that will displayed to user. In Laravel, all views are store in views folder inside resource folder. We can create our own folders inside view folder to better organize views.

By default, Laravel provide us welcome.blade.php resources/views directory View only contains plain HTML(CSS+JavaScript+Bootstrap) + Blade You always put plain HTML, but have option of adding blade.

Note Whenever we create a file in view, we always have blade.php at the end. Example: welcome.blade.php (welcome is actually name of the file) about.blade.php HTML ko zaida likhna na paray.

Pages in Views We create welcome, about, and contact pages in views. welcome.blade.php, about.blade.php and contact.blade.php HTML ko zaida likhna na paray.

Laravel Layouts with Blade Blade is templating engine for laravel, it allow us to put PHP inside our HTML code. Laravel basically translate it and converts it into PHP. HTML ko zaida likhna na paray.

Blade Functions To organize our views better, we can take advantage of blade functions: Layouts Partials HTML ko zaida likhna na paray.

Layouts Layouts are design through which we can separate repetitive portion of a website. Example: In a website all of the pages share same navigation. Layouts are design to prevent that, they design to extract code and only have to be one place. From this I will have advantage that whenever I encounter a bug, I will fix it at one time and one place HTML ko zaida likhna na paray.

Layouts Create a file name main.blade.php inside view. This is where we are going to extract all repetitive elements from all the pages into one single page. So, in our welcome.blade.php page !Doctype, head, navigation and footer was repetitive, so we put inside main.blade.php HTML ko zaida likhna na paray.

Layouts Blade start with @ sign. Its signal laravel that we are writing blade not HTML. @yield(‘content’) this is basically we call a layout, content is the title given to it, so this is container we leave that blank, we dynamically fill that content.

Layouts Open main.blade.php, add this code @yield(‘content’) this is basically we call a layout. To access @yield we write: @section(“content","about") Now open welcome.blade.php and add these code of blade @extends(‘main’) @section(‘content’) // HTML code of that particular page @endsection

Cont… @section("body") @show To call section @section("body") Contact@endsection

Layouts You might have specific css file, and you don’t want to load on every single page. What we are going to do, create another section here on welcome.blade.php @section(‘stylesheets’) <link rel=“stylesheet” href=“main.css” type=“text/css” /> @endsecion

Layouts You might need to add special JavaScript code or JavaScript file @section(‘scripts’)   <script src=”js/scripts.js”></script> or <script> window.confirm(‘I loaded up some JS’); </script> @endsection

Partials Partial can extract content further, partial can be use for repetitive code and may be its for organizing. Through partials you can extract code file into its own file. Example: I can take my navigation, extract that out, and then I know, If I need to work at my navigation. I open up navigation’s partial. HTML ko zaida likhna na paray.

Create Partials In resourceviews create a new folder name partial. Working with partial, we commonly include _(underscore) before partial name. Example: _head.blade.php Open main.blade.php, upto body tag cut every thing and paste in _head.blade.php and in main_blade.php I include this code @include(‘_head’) HTML ko zaida likhna na paray.

Blade Syntax PHP Syntax: <?php foreach($customers as $customer) ?> Blade syntax: @foreach($customers as $customer) @endforeach HTML ko zaida likhna na paray.

PHP Syntax: <p><?php $customercname; ?></p> Blade Syntax: <p>{{ $customercname }}</p>

Blade Syntax PHP Syntax <?php if(true): ?> <?php echo ‘hello’; ?> <?php endif; ?> Blade Syntax @if(true) {{ ‘hello’ }} @endif HTML ko zaida likhna na paray.

Note So, you can check out lots of these syntax from laravel.com HTML ko zaida likhna na paray.