install cakephp in subdirectory of another cake app - cakephp

How to install app in a subdirectory of another app?
For example, if it is the main app folder structure:
/app/Config
/app/Controller
/app/Model
/app/webroot
...
I want to put the second app files in a directory named 'client', so new structure should be:
/app/Config
/app/Controller
/app/Model
/app/webroot
/app/client/Model
/app/client/webroot
...
and if first app url is http://example.com, the second one should be http://example.com/client
I tried putting some files in client folder, but cake thinks its one of its controllers and try to find its action. (so 404 error occurred)

You can fix this problem in your default CakePHP installation.
You can use a 'client' prefix and in the your default controller you can add the method 'client_index'
Look here:
http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing

Related

hugo serve content inside .well-known folder

Third party application which I'm trying to integrate, asking to put a file inside a .well-known folder. how can I make that file accessible from URL? (example.com/.well-known/token.txt). site is deployed as a gitlab page. every attempt I tried gives 404 error.
If you put your ".well-known" folder inside the "static" folder it should get deployed to the root of your website as you expect.

cakephp access cs and js files inside webroot folders

I am getting a problem in deploying my app to the server. The problem is i have folders inside the webroot which points to the .css and .js files.
I was doing the basic cakephp function $this->Html->css('bootstrap') when my simple css files were in the css folder but now there are some other folders inside the webroot because of using the plugins for the frontend UI.
For this i have changed my url to like this $this->Html->css('/global/plugin/file')
Problem is on local it is working fine because of virtual host example.com but on live server i have domain like this 192.168.00.00/mysite so it go to the main directory to and link the ip 192.168.00.00 instead of going to 192.168.00.00/mysite.
Is there any good way to solve this and add the flexibility to the url so that my local and live will not be disturbed while i push my code through git?
Just removes '/' from $this->Html->css('/global/plugin/file') to below
<?php
$this->Html->css('global/plugin/file');
$this->Html->script('global/plugin/file'); //example loading file.js
?>
I already had an issue about this one including my JS and CSS inside a folder but when I removed '/' it solve my problem.
Confirm that their is a file.css inside plugin inside webroot\css\global\plugin\file.css windows path or LINUX path /webroot/css/global/plugin/file.css

Angular JS + Laravel 4: How to compile for production mode?

So i have watched the 5 part youtube videos by David Mosher about Angular JS (vids great by the way). In the part 2 (http://www.youtube.com/watch?v=hqAyiqUs93c), it has a practical mysql database usage which I almost wanted.
I'm going to use AngularJS along with Laravel 4, but I had no idea which files I'm going to upload for the web hosting later. I'm trying to run the web app under "/public" folder in my root on localhost (localhost/public/) but the css and js points to the wrong directory (points to the root: '/css/style.css').
Another method I have tried is by copying all the files to the root and moved all files inside "public" to root. Then I navigate to "localhost/public/". All works fine in script paths, except that it doesn't seemed to do any connection to the database (either the laravel or angular failed).
Is there any proper way to do this for practical use (without using php artisan serve or grunt run or lineman run on the server)? Which files I should upload later?
EDIT: the reason is my web hosting doesn't allow me to install nginx or run code remotely using putty, so I need a manual way to do this. Thanks.
First install latest laravel in your localhost. See doc.
Assuming you have completed composer install command.
Then move your all public folder contents to the project root.
Next change the line 21 in index.php from,
require __DIR__.'/../bootstrap/autoload.php';
to
require __DIR__.'/bootstrap/autoload.php';
and line 35 content
$app = require_once __DIR__.'/../bootstrap/start.php';
to
$app = require_once __DIR__.'/bootstrap/start.php';
Now you can access project without public folder.
Place your css, js and other assets folder in root like http://localhost/laravel/css
Note that the laravel blade and angular also using {{ syntax for compilation.So you need to change the laravel blade syntax to {= and =}.Otherwise you will get conflict.
To do this open vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php file and change line 45 to this
protected $contentTags = array('{=', '=}');
and line 52 to this
protected $escapedTags = array('{={', '}=}');
Now you can use {{ for angular and {= for blade.
For linking your assets, use HTMLBuilder functions, see doc here.
Now use these in blade,
{= HTML::style('css/style.css') =} // links localhost/project/css/style.css
{= HTML::script('js/jquery.js') =}
Use migrations and db seeds in localhost and make an exported copy of db for online hosting
After completing project, copy entire project content to online server and change db configuration and import database.
Directory Structure for Online
There will be a public directory for your file hosting, where you put your files in web root.
That may be htdocs or public_html and now it's your project public root.Now the directory structure will be,
-- app
-- bootstrap
-- css
-- images
-- js
-- vendor

CakePHP and NearlyFreeSpeech.net

How do I set AllowOverride on NearlyFreeSpeech.net? I'm trying to follow the instructions at Within cakePHP, In my routes.php only the '/' (base path) works. Any other url is 404 page not found to resolve the problems described therein.
So far, I've had to do the following when moving out of a WAMP development environment:
Refer to controller names by their correct case
Change the name of the server in the configuration file
Add all the CakePHP-related files to the web group
The solution is as follows:
Copy the files over from your working environment (or do an export from your source control tool) into a new folder on NearlyFreeSpeech.net (NFS.net). Let's call the new folder "abc".
Import your database into NFS.net.
Configure database settings as necessary on the NFS.net version of the site.
Add the abc folder and everything in it to the web group.
Go into the .htaccess file in /home/public/abc and add "RewriteBase /abc" under "RewriteEngine on".
Add "RewriteBase /abc/app" to the .htaccess in /home/public/abc/app and add "RewriteBase /abc/app/webroot" to the one in /home/public/abc/app/webroot.

CakePHP Subcake Redirect

I have a problem with CakePHP (1.3) project, i need to create projects inside the same domain/hosting of other project, like this:
app
cake
plugins
templates
vendors
ADMINONE (Cake project files here)
ADMINTWO (another Cake project files here)
.htaccess
index.php
README
The problem is, when I put the CakePHP code inside ADMINONE or ADMINTWO to create the other cake projects, if I put the url http://domain.com/ADMINONE/, the URL redirects to http://domain.com or the cake read the /ADMINONE as a controller name.
How can I redirect this URL to the directory ignoring the primary directory cake's redirect?
Dont forget to change your index.php inside the webroot folder. In there you can set up the
APP_DIR and the ROOT if need be.

Resources