I have downloaded a project and I noticed that the project use views from different directory not the usual directory which are
\resources\views
but instead it create a new folder name themes and insert all the views in there.
\themes\app\views
Views Directory
and also I noticed in the controller they return view by using getAppTheme()
Return View using getAppTheme()
Anyone know how I can create a new folder outside the \resources\views folder for all my views file. And how I can return view using getAppTheme() just like in the picture.
there a config for view path at laravel located at config/views.php
you can configure there by change this
'paths' => [
resource_path('views'), //this value you need to change
],
Thanks but the answer I was looking for is in here
https://github.com/Shipu/themevel
Anyway, thanks again
Related
I am quite new to Livewire and I feel a little bit confused about its folder structure.
I use the classic Laravel folder structure for my views and I put the components under the /resources/views folder; now with Livewire it seems that I am forced to put my components under /resources/views/livewire folder otherwise the component throws an error.
I also tried to change the view_path in my config/livewire.php file to resource_path('views'), instead of resource_path('views/livewire'), but it doesn't work.
The result is a messy structure like the following, where the users' components are in a different folder and I have to go back and forth to find what I want.
Wouldn't it be possibile to remove the /resources/views/livewire folder and put the components under the relative folder they belong to?
resources
views
users
index.blade.php
livewire
users
table.blade.php
the answer is the config file /config/livewire.php
'view_path' => resource_path('views/livewire'),
Just make sure you update all the Livewire class files views in their render function and that you clear any stale config information
php artisan cache:clear
edit: I have tested this and have regular Laravel blades along side livewire ones.
My question is routing problem website.com/dashboard/admin/ but this route not working please
help me
in view a folder a dashboard folder and in dashboard folder a new folder admin
web route page code
Route::group(['middleware'=>['loginAuth']],function(){
Route:: resource('/dashboard','DashboardController');
Route:: resource('/dashboard/admin','AdminController');
});
You are currently requesting a view that doesn't exist:
view('admin.index') // Looking for /views/admin/index.blade.php
According to your file structure, you need to call the following view:
view('dashboard.admin.index') // Looking for /views/dashboard/admin/index.blade.php
As the documentation says: (https://laravel.com/docs/7.x/views#creating-views)
Views may also be nested within subdirectories of the resources/views directory.
"Dot" notation may be used to reference nested views. For example, if your view
is stored at resources/views/admin/profile.blade.php, you may reference it like
so:
return view('admin.profile', $data);
This Dot notation is very common in Laravel to access subfolders elements - you will see it as well in the blade components such as #extend or #include
I would like to change/move the Model, View and Controllers folder from application folder and want them to be keep support in a new folder called app. Can someone please give me a solution which would work on CI-3*
application/
library
config
helpers
core
......
app/
model
views
controllers
index.php look for $application_folder and modify this.
You can move views separately using the $view_folder variable.
However, without changing the way the core of CI works you'd have to keep models/controllers inside of application.
I am new to Laravel 4, and I come from a Zend Framework background. I'd like to create a folder app/forms and keep all my forms there. How can I refer to the form in the controller and within the view.blade files?
By default, the root of the view files folder is app/views so if you create a folder in views like app/views/forms then you may refer the form by it's name from a controller like:
$form = View::make('forms.formfile');
Here, formfile is the name of the file that contains the form and it could be formfile.blade.php and to refer/include the form file from a view you may use #include:
// In a blade view file
#include('forms.form1')
Assume that, form1 is a blade view inside the forms folder and saved as form1.blade.php, you may also use sub-folders inside the forms folder, for example in views/forms/user folder you may keep a view named index.blade.php and use it like:
// From a controller
$userForm = View::make('forms/user/index');
From a view file: (folders are separated by .)
#include('forms.user.index') // file: app/views/forms/user/index.blade.php
You can also nest views in the controller, check the manual for more.
From the standpoint of Laravel, HTML forms (and all presentation related things ) belongs to app/views/ folder. Exceptions are package specific views. For example some commands has their own stubs and views and they are usually stored inside package.
Laravel is very flexibile, and you can move things around and create new folders and namespaces. You just have to tell composer that you are changing Laravel default structure, and dumpautoload. That is if you only want to create new folder with internal reference. If you want something with more scope and visibility you'll have to bind that to container, so that will be visible inside whole application.
You are coming from the Zend world, so I can understand that you want to move some of Zend "flavour" to Laravel. Although is it possible, I would really recommend you to take some time and learn how Laravel works. There are some great ideas and design inside. Of course, Zend has its own quality, but hey - this is Laravel :)
I'm using codeigniter 2.1.3 with wiredesignz HMVC, I was wondering how would I get templates from the public folder rather than the modules/module/views?
example structure
application/projects/projectname/ciappstructure
application/system/etc/
public/themes/themename/layout
public/themes/themename/pages
public/themes/themename/widgets
public/themes/themename/etc
I would love to use html files and have my template library sort out the tags and placement of widgets or modules, all modules and theme data being pulled from the DB
like:
$homepage = $this->load->view(FCPATH.'themes/$theme/pages/homepage.html', $data, TRUE);
Oh and another quick question, I'm new to HMVC, could I call modules::run('module/method', $params, $...); from a template library (/application/projects/project/libraries/template.php) ?
I've tried a few things but I can't seem to get anything working, any ideas are much appreciated! Thanks in advance
First, the $this->load->view() load views with .php extension not .html files, Second, this method only load the views on views/ folder.
Therefore, your need config first your modules folder in application/config.php file. Place this on the ends of file.
$config['modules_locations'] = array(
APPPATH . 'modules/' => '../modules/'
);
Next, create your first module with views as sub-folder, and create your view file with .php as extension.
- modules/
--- my_module/
------ views/
--------- my_view.php
Next, in your controller, load the view with the ubication of your module.
$this->load->view('my_module/my_view');
This must run, you can try and read more about the documentation.
Hope this help you!