Kohana 3 Admin Structure - structure

I've been creating my admin backend of the site as another application, like so:
admin
--classes
----controller
----model
--views
--.htaccess
--bootstrap.php
--index.php
application
--classes
----controller
----model
--views
--bootstrap.php
.htaccess
index.php
But it's a bit annoying for me this way so I was thinking of just going back and placing the admin folder as a subfolder of the main application, which would usually be like this:
application
--classes
----controller
------admin
----model
------admin
--views
----admin
--bootstrap.php
.htaccess
index.php
I'm not too fond of this setup either though lol. So my question is, is it possible to create a structure like this?
application
--admin
----classes
------controller
------model
----views
--classes
----controller
----model
--views
--bootstrap.php
.htaccess
index.php
If that is not possible I guess I will just stick with the 2nd way. Although I have one more question, is it possible to move the controller and model folders above the classes? I'm sure there is a good reason for that setup? But honestly it just makes me have to click more to get there. I would prefer controller, model and views all in the same level, would that be possible?
Thank you.

You can set $application = 'application/admin' in your admin's index.php.
Kohana's autoloader has hard-coded 'classes' directory for class files, so you cant move your classes without changing Kohana::autoload() method. Another (ugly) way is using symlinks.

Related

Can I change where root requests resolve to in an express app?

I've created a small Express app that essentially serves as a file browser for our department's work. Users can drag their files and folders onto a network drive, and the app presents this folder structure as a browsable web directory for my colleagues to view various simple static files such as html files, images, css and javascript.
This is extremely business critical, and has worked flawlessly for over a year now, but there is one feature that I'd like to add. Occasionally the work contained in a subdirectory is a slightly more complex project, and there would be a huge architecture/complexity benefit from it being able to reference files from its own root path. I'll try and explain with a small example:
/app
/projects
/project1
/project2
/index.html
/styles.css
/finished
/project3
It would be great if there was a simple way I could declare the base url of project 2 to be /app/projects/project2 so that I could reference the css file from the html with href="/styles.css".
I've read that I could do this by creating a second express app for project2, and then route requests to /app/projects/project2 to that app, but this requirement crops up quite regularly and the thought of configuring/managing a multitude of sub apps without breaking the main viewer doesn't seem like fun!
Is there a simpler way? I'm thinking of a special designation in the subdirectory name e.g. "wwwproject2" that could get the app to adjust where it maps root requests to.
I'm sorry if this all sounds insane to those with more knowledge than me!
I don't think there is a way to do that.
But you could simply reference it by using the relative path to it -> href="./styles.css"

Moving the Wamp homepage Wamp64/Apache2.4.23

So apparently the web is just chock full of old tutorials on how to configure this stuff that trying to find anything recent is a needle in a haystack endeavor.
What I want to do is move the Wamp64 homepage located on myIpAddres:8080/ somewhere else with local access.
I'd then like to make the root my landing page for various web project I'm doing for a class.
Problem is, moving index.php in C:/wamp64/www causes the dang thing to break. I'd like to keep it on local access for convenience but it simply can't live in the www folder where I want to put my own index.html I believe. Maybe I'm wrong though.
If THATS not possible, is there a way to make 'myIpAddress:8080/' point to a different folder, while still being able to access WAMP's index.php at a different address?

Simulate dynamically subdomains with .htaccess with a different database but same code base in Drupal

Sorry about my english level.
I researched so much, and i found that can i use ".htaccess" to get redirection to subdomain folder and this is OK.
In Drupal i need to create a folder for each subdomain in "/sites/sub.example.com/" and copy "default.settings.php" from default folder "/sites/default/default.setting.php" and rename it to "settings.php", after that, enable "$databases" variable in the same file, when it's done, i need to add a wildcard and modify "hosts" file.
Well, i should "automate" all this, but i don't know if it's is more hard because it's important hold the server safety with writing permissions or try another way, someone could advise me.
Im working on OSX and Drupal 7.x (recent release)
Thank you very much.
For each site that you want to use separate database, create own sites/ directory with settings.php. For example, if you want to have one database for example.com, another one for sub1.example.com and third one for sub2.example.com, all using same code base, setup your files like this:
sites/example.com/settings.php
sites/sub1.example.com/settings.php
sites/sub2.example.com/settings.php
each settings.php using different database credentials.
Read more here - https://drupal.org/documentation/install/multi-site
Also, if you want to automate this and if there is supposed to be bigger number of sites to be managed, consider deploying aegir - http://www.aegirproject.org.
I hope I understood your question correctly.

Include multiple files in index.php

I've got my site builed with multiple folders and files. Like:
index.php
includes/config.php
memberscript/login.php
memberscript/register.php
memberscript/profile.php
memberscript/change-pass.php
What is the most easy way to include all the files from the memberscript folder into index.php without using switch $_GET statements where i have to case each of the files.
Thanks!
From my point of view it is the best to use automatic class loader like Symfony2 ClassLoader. It is a very convenient way to load only the files you need in each of the request.
If you are still coding in procedural PHP it is the best time to learn OOP.
There are numerous frameworks which enforces you to code that way like Symfony2 (for large projects), Silex (for small websites) and many other like CakePHP, ZendFramework, CodeIgniter etc.
By using one of these frameworks your code will be easy to understand by any programmer and easy to maintain.

how do i use htaccess to make http requests work properly

I currently have css and javascript file calls (amongst other things) like the following:
href="/css/default.css"
src="/js/ui_control.js"
putting the preceding / in to make the files relative to the root.
This works great when my page is in the root of the domain.
However, I'm currently in the middle of transferring my site to a new hosting provider and as such have a temporary URL which is: HOST-IP/~username
As such, all file calls are trying to be called from HOST-IP/css/default.css etc instead of within the ~username sub-folder.
Of course I can wait until the domain name servers propagate but that's beside the point.
How would I go about writing a rule in the .htaccess file that would redirect all file calls that start with a /, from going to HOST-IP/FILE-CALL, and instead to go to HOST-IP/~USERNAME/FILE-CALL. ?
Any ideas?
I'd suggest changing the references in your HTML to the files to be relative, as this will work either in a sub folder or as the root of the domain.
This works great when my page is in the root of the domain. However, I'm currently in the middle of transferring my site to a new hosting provider and as such have a temporary URL which is: HOST-IP/~username
How would I go about writing a rule in the .htaccess file that would redirect all file calls that start with a /, from going to HOST-IP/FILE-CALL, and instead to go to HOST-IP/~USERNAME/FILE-CALL. ?
Unless you can put a .htaccess at HOST-IP/.htaccess on the new server, you can't do this with .htaccess. It sounds like you're on a shared host, so any approach that'd let you do this with .htaccess would allow you to hijack everyone else's site on the server.