in resources folder and layouts/backend/ and i have main.blade.php file as master template and partials folder which that have some files such as sidebar, footer and etc, for example:
/layouts/backend/main.blade.php:
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
</head>
<body>
<!-- Footer -->
#yield('partials.footer')
<!-- /footer -->
</body>
</html>
/layouts/backend/partials/footer.blade.php:
#extends('layouts.backend')
#section('footer')
<div class="footer text-muted">Hello</div>
#endsection
after save and refreshing page i don't have footer on page
Have a look at the Docs, the section about Blade is really good.
I think there are a few logical issues here. If you have a footer that you want to include in your backend/master template, then there's no need to extend the layout in your footer, simply include it in your master template. Here's an example:
layouts/backend/main.blade.php:
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
</head>
<body>
#yield('main')
<!-- Footer -->
#include('layouts.backend.partials.footer')
<!-- /footer -->
</body>
</html>
layouts/backend/partials/footer.blade.php:
<div class="footer text-muted">Hello</div>
Also, you might want to review your folder organisation, maybe you can go with something similar
views/layouts/backend.blade.php
views/layouts/frontend.blade.php
views/layouts/backend/footer.blade.php
views/layouts/backend/header.blade.php
This is just an idea, of course you can do the folder organisation as you prefer.
Related
I need to redirect a page whilst keeping the original page (not the one redirected to) share title and description and icon.
So in this example, the share preview in Whatsapp etc would say Title rather than Google.
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Title</title>
<meta name="description" content="Download now">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" href="icon.png">
<!-- Place favicon.ico in the root directory -->
</head>
<body>
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: google.com");
?>
</body>
</html>
we are developing one application in Marathi language for farmers, but i have faced one issue after start conversion from "HTML to Blade PHP Template".
My HTML template showing Marathi (मराठी) language correctly, but after I had change the file extension from .html to .blade.php Marathi language change to "?????? ??? ????".
I have already added UTF-8 in my head tag. I am not getting what is the problem exactly related to?
I am adding Marathi text by using "Google Input tool"
HTML Template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body class="blank">
<div class="back-link">
मुख पृष्ठावर जा
</div>
<div class="text-center m-b-md">
<h3>कृपया अनुप्रयोग लॉगिन करा</h3>
<small>अनुप्रयोग करण्या साठी लॉगिन करा.</small>
</div>
</body>
</html>
Blade PHP template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body class="blank">
<div class="back-link">
??? ???????? ??
</div>
<div class="text-center m-b-md">
<h3>????? ????????? ????? ???</h3>
<small>????????? ?????? ???? ????? ???.</small>
</div>
</body>
</html>
Is this problem is related to laravel server? which we run on port 8000? because apache support UTF-8 encode decode perfectly. is it possible?
I am new to HTML and hope someone can help me with this.
I am trying to set up a website where the code for every page is saved as a separate php file.
Since all these pages use the same document head and includes I would like to remove as much as possible of this from the pages and save it in a separate includes file (header.php) which I can then include using PHP.
My current head looks as follows and since this is the same on all pages I currently have ALL this saved in the separate header.php file and then just use <?php include "header.php"; ?> on the single pages.
Can someone tell me which parts of this should remain on the single pages for a proper setup and if anything should be changed or added here ?
Note: jQuery and JS are included separately in the footer.
My PHP (header file):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="John Doe" />
<meta name="description" content="Created: 2015-06" />
<base href="http://www.MyURL.com" target="_self" />
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="includes/styles.css" />
<!-- CSS - Font Awesome -->
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
<title>My Page</title>
</head>
<body>
<div class="wrapper">
<!-- ... -->
Your Top head file (top_head.php):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php if(isset($page_author)){ ?>
<meta name="author" content="<?php echo $page_author; ?>" />
<?php } ?>
<?php if(isset($page_description)){ ?>
<meta name="description" content="Created: 2015-06" />
<?php } ?>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="includes/styles.css" />
<!-- CSS - Font Awesome -->
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
<title><?php echo $page_title; ?></title>
Your current header file:
<?php
$page_title = 'Hello';
$page_description = 'This is a beautiful description';
?>
<?php include("top_head.php"); ?>
</head>
<body>
<div class="wrapper">
<!-- ... -->
Since you are starting your tag in header.php, you can close the tag on the own page itself (i mean the other pages ie: Contact, About Us, Product, etc...).
The code section you have mentioned in the question can be called as header.php and further can be included on each and every page where it is required.
Apart from this
Header - header.php
Main content - main-content.php - this will be specific to each and every page from your website
Footer - footer.php - this can also be made common - and further included in every page.
Apart from this you can also have a few more php files which might have navigation or any kind of common content blocks.
Example page could be:
<?php
include 'header.php'
/*either add here the content or include further php files*/
include 'about-us.php'
include 'footer.php'
?>
You are doing right, the parts that are shared between all the pages should be placed in a separate php file, this greatly improve your life when you have to maintain the site (immagine add a stylesheet or a library to every page of your site after some time ...).
To help SEO you should specify a title and maybe some meta tag that are page specific.
Also consider carefully if you have other parts that are repeated in every page for example a left or right bar or a particular widget (for example a banner image or something like that)
This should give you the general idea...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="John Doe" />
<meta name="description" content="Created: 2015-06" />
<base href="http://www.MyURL.com" target="_self" />
<!--
Your paths need to relative to the websites root directory or the full
URL else they may not work depending on where the file is located.
-->
<link rel="stylesheet" type="text/css" href="/includes/styles.css" />
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
<!--
This line just echos the title if one has been set or a default string
if the title hasn't been set. You will need to ensure every page that
includes this file sets the title before including this file. You may
also want to take this approach with other values.
-->
<title><?php echo isset($title) ? $title : 'Default Title'; ?></title>
</head>
<body>
<div class="wrapper">
I have a php file which is in the name of index.php. In that I have included another page like "xyz.php".
I have included "xyz.php" in index.php using #include('xyz').
When I am trying to include external css and js in xyz using
{{ URL::asset('assets/js/jsfile.js') }}
{{ URL::asset('assets/css/cssfile.css') }}
It is not working. In source it displays as it is.
How can I solve this issue.
index.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Laravel page</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic' rel='stylesheet' type='text/css'>
<link href="{{ URL::asset('assets/netbramha/css/bootstrap.min.css') }}" rel="stylesheet">
<script src="{{ URL::asset('assets/netbramha/js/modernizr.custom.js') }}"></script>
</head>
<body>
#include('home-search')
</body>
</html>
home-search.blade.php
<div class="video-modal">
<img class="lazy-load" data-original="{{ URL::asset('/') }}/assets/netbramha/images/video-img.jpg" src="images/grey.gif" width="598" height="336" alt="" />
</div>
Maybe this will help
{{ URL::asset('/') }}/location of you css/scripts
cheers
You are using blade templating in the xyz.php file. It should be named xyz.blade.php
You have to use helper functions
include(public_path() . '/xyz.php')
I am new to Laravel4, so I was learning from the documentation.
It seems everything is all correct, but the extends method literally displays its code on my web browser. I don't know hwy..
This is the layout file (base.blade.php under layouts directory)
<!-- app/views/layouts/base.blade.php -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<!-- You can provide some default content -->
#section('head')
<link rel="stylesheet" href="style.css" />
#show
</head>
<body>
#yield('body')
</body>
</html>
and home.blade.php.
<!-- app/views/home.blade.php -->
#extends('layouts.base')
#section('body')
<h1>Hurray!</h1>
<p>We have a template!</p>
#stop
and my routing configuration is like below..
Route::get('/',
function()
{
return View::make('home');
}
);
Now when you access to the URL, it displays just a string!
#extends('layouts.base')
I have been googling for a hour or so! still could not fix it...
What's wrong with them? :(
I checked common mistakes below
possible type
incorrect path
incorrect method name
missing appending 'blade' on the file name
BUT STILL CAN'T FIND THE PROBLEM. :(
There shouldn't be any space in the template above #extends at all no comments or whitespace
Remove
<!-- app/views/home.blade.php --> from home.blade.php
home.blade.php
#extends('layouts.base')
#section('body')
<h1>Hurray!</h1>
<p>We have a template!</p>
#stop
Possibilities are that you have printed #extends('layouts.base') twice in the page. Please have a look.