sleeping-owl / admin

Administrative interface builder for Laravel
http://sleeping-owl.github.io/
MIT License
503 stars 258 forks source link

How to override admin template? #194

Closed xnhinzkyx closed 9 years ago

xnhinzkyx commented 9 years ago

Hello,

I been starting to use this package and can you help me how to override admin template? So that i have to add files in "resources/views/admin" folder instead of modifying files inside the vendor folder in SleepingOwl folder to be specific?

Thanks.

noxify commented 9 years ago

Hi,

you have to options to overwrite the existing admin template.

  1. you can overwrite the views with "resources/views/admin"
  2. Create your own template, a good example is the adminLTE theme: https://github.com/sleeping-owl/admin-lte-template
xnhinzkyx commented 9 years ago

I currently use adminLTE but I don't want to modify the files right in the vendor folder, how do I do that?

Do you have any idea? or suggestions?

Thanks...

acacha commented 9 years ago

Adminlte package is a Laravel package. Read official docs about Laravel packages:http://laravel.com/docs/5.1/packages and how to override view files as noxigy suggest you at option 1. In this way you can override vuew files without touching anything at vendor folder

xnhinzkyx commented 9 years ago

Thanks to both of you noxify and acacha. I tried what is said in the official docs but still don't work. I copy the files from the packages and modify it but nothings changed.

acacha commented 9 years ago

No idea then without more info sorry... If you can you will publish you code on github and then e can check you code to try to find the problem.

xnhinzkyx commented 9 years ago

I am using this V3 of admin package which I install in a fresh installation of Laravel 5.1 here https://github.com/sleeping-owl/admin/tree/development

And I use the template https://github.com/sleeping-owl/admin-lte-template and I want to override the view files of this template but I don't want to modify it directly which is inside the vendor/sleeping-owl/admin-lte-template

I would like to use the approach specified by noxify to add it in "resources/views/" and so on. Can you give me some example?

noxify commented 9 years ago

Hi,

I'm using https://github.com/barryvdh/laravel-debugbar to identify in which namespace the view to overwrite is bildschirmfoto 2015-08-05 um 21 19 11

This example shows the admin login page. As you can see, there are two views:

  1. admin-lte::default._layout.base
  2. admin-lte::default.pages.login

Both views are currently package views.

Example: To overwrite the layout view with your own, you have to do the following:

  1. Create a new directory named "admin-lte" in /resources/views/vendor/admin-lte/default/ (admin-lte is the namespace --> see screenshot above)
  2. Create a directory named _layout and inside this folder you have to create a file named base.blade.php

With this way, you have to add each file manually - this is okay if you want to change only one or two files. But if you want to change many things in the admin-lte theme you can do the following:

or

Hope this helps :)

xnhinzkyx commented 9 years ago

Great! now it works. Thanks @noxify for your great explanation and examples. Thank you guys.

noxify commented 9 years ago

you're welcome @xnhinzkyx - please don't forgot to close the issue ;)

xnhinzkyx commented 9 years ago

Ah yeah thanks :+1: