create controllers in subfolders in yii2 - yii2

i need to put admin controllers in subfolder like this
app\controllers\adpanel\AdminsControllers.php
also put view in subfolder like this:
app\views\adpanel\login.php
app\views\adpanel\dashboard.php
is this possible?what should i do?

Related

Relative path in dynamically generated (with hash) folder

With Express, I am trying to acess relative path (css/..., assets/...) inside HTML file.
I can't use express.static() because the HTML file is located in a dynamically generated folder, with a hash as its name.
There are many folders with a different set of files inside, these folders are in "public/assets/template/file/tmp".
The server is trying to access these files based on what was defined in express.static, which was "path.join(__dirname,'public')", in order to handle other files in the project.
The public folder (which is in the project root) looks like this:
The index.html head:
I couldn't think of anything to do in this current situation, perhaps set a different express.static when accessing files in the dynamically generated folder, but it doesn't look like the best approach (not even sure if it's possible).

Feathersjs. How do i redirect initial page to page in view folder instead of public folder

Writing my first Feathersjs app. Using handlebars for templating. HTML Templates in Express seem to default to a view folder. It seems Feathersjs defaults to a CLI generated public folder. How can i tell Feathersjs to use my view folder for HTML? That will allow me to put all my HTML templates in that folder.

Github Multiple Page

i have my own github pages.
username.github.io
i know if github pages can having 1 pages like username.github.io/pages1, but is there any way to make MULTIPLE pages like this?
username.github.io/pages/1
username.github.io/pages/2
Yes, and it is the same way.
To creates the URL /pages1 you create a directory called /pages1 and put an index.html file inside it.
To create the URL /pages/1 you create a directory called /pages and put a directory called 1 inside it and then put an index.html file inside that.
… and you can put a directory called 2 next to the directory called 1.

using react-router in Next.js environment

I am currently using next.js framework. Is it possible to route components out of /pages directory?
Would not like to use 'react-router' (because it'll be complicated to edit server.js). If it is inevitable I will but is there any other way?
im afraid this is not possible in nextjs. nextjs builds its route view pages folder. what you can do that wont ruin your project structure or URLs is to
add your components to the new repo.
create your pages folder based on your routes in pervious project.
add index.js in each pages folder.
and import the main component instead of actually moving it to pages folder, for example:
export { default } from './components/users';
this way you can drag and drop your existing structure and only add your route as pages folders.
notes to consider:
next default routing is case sensitive so be careful about your folder names if you want a work around for that you should use nextjs v12 create all pages to lower case and config your project to translate all routes to lower case.
you can have nested routes by adding nested folder:
pages
userslist
userdetail
index.js
this structure will create this route:
/userlist/userdetail
if you have components you dont want for user to be accessible do not put them in pages
if you have dynamic routes such as id in your route you can specify it by adding a folder in pages like [id] and redirect to it following this syntax
Router.push(`/sth/sth/${sth.id}`);
this configuration of redirects in nextjs might come in handy when you need to custom your links
i should also warn you migrating an existing project to nextjs requires a lot of work and a lot of changes to the project.

CakePHP: keeping view files in same directory

For controller_A's views, I currently use $this->element('repeatedly_used_html'); in the element folder for some .ctp files that are used more than once. However, some of the files in the element folder are entirely used for one controller, and the file are unorganized in the element folder.
So, for exmaple, controller_A has views that use files from the element folder. I would like these .ctp files for controller A's views to be contained in the app/views/A.. is there way to invoke a call similar to $this->element('repeatedly_used_html'); that will allow me to keep files the folder app/views/controller_A? I would like to avoid writing a very long .ctp file.
It looks like you're using CakePHP 1.3 based on your directory structure. If this is the case, you can do this by simply using the render() method instead of element(). This will render a template using the current view path (in this case, the controller you're in).
echo $this->render('repeatedly_used_html', false);
The second parameter is the layout, which we set to false to make sure the whole layout isn't rendered along with the view.
echo $this->element( 'subfoldername/viewfile' );
Then create the subfoldername directory in your elements folder.