Make Apache ignore actual directory for route?

2014-10-18 Thread Joe Theuerkauf
Forewarning: i'm not great with Apache. Usually i can fumble my way around, 
but it doesn't take much to throw me off.

i've done all my development using Cake's built-in server, and things have 
been mostly smooth. i'm now working toward migrating to a LAMP server 
(testing locally in Windows), starting with figuring out what configuration 
differences there will be. i need this to be a VirtualHost config. Cake's 
server Just Works (TM), but Apache is giving me migraines.

i have a set of Routes with prefix "admin", so anything from 
/admin/whatever... is using /Controller/Admin/WhateverController. This Just 
Works (TM) with the Cake server, but with Apache, it gives me various 
errors, depending on config variations.

Before getting much further into the TL of this DR, i think i've discovered 
*part* of the problem: i have an actual /webroot/admin directory where 
CSS/IMG/JS assets for the Admin section of the site are held. There's no 
index.php there, just the resources. It *appears* Apache is choking on this 
directory. If i create /webroot/contact, it chokes on that as well. Without 
the directory, the /contact URL displays correctly. The Cake server doesn't 
seem to care that i have either /webroot/admin or /webroot/contact. So 
there must be something wrong in my Apache config, but i can't seem to get 
the right setup.

If that's enough to trigger some suggestions, great! PLEASE tell me what 
stupid-simple thing i missed. If not, here's what i currently have...


*1. Virtual Host config:*
Define SITE_ROOT "C:/Sites/kodiakinvestmentsllc.com-cake3"
ServerName kodiak.local

DocumentRoot   ${SITE_ROOT}
DirectoryIndex index.php

ErrorLog  ${SITE_ROOT}/tmp/logs/error.log
CustomLog ${SITE_ROOT}/tmp/logs/debug.log combined


AllowOverride All
Order Allow,Deny



*2. Routes*
Router::scope('/', function(RouteBuilder $routes) {
// Several routes defined here that work in Apache
});

Router::prefix('admin', function(RouteBuilder $routes){
$routes->connect('/:controller', ['action' => 'index'], ['routeClass' 
=> 'InflectedRoute']);
$routes->connect('/:controller/:action/*', [], ['routeClass' => 
'InflectedRoute']);
$routes->connect('/login', ['controller' => 'Users', 'action' => 
'login']);
$routes->connect('/logout', ['controller' => 'Users', 'action' => 
'logout']);
$routes->connect('/', ['controller' => 'Admin', 'action' => 'index']);
});


*3. .htaccess**/.htaccess*

RewriteEngine On
RewriteRule   ^$   webroot/   [L]
RewriteRule   (.*) webroot/$1 [L]


Header Set Access-Control-Allow-Origin "*"

AddType image/svg+xml .svg .svgz

*/webroot/.htaccess*

RewriteEngine On
RewriteCond   %{REQUEST_FILENAME} !-d
RewriteCond   %{REWRITE_FILENAME} !-f
RewriteRule   ^ index.php [L]



*3. URLs*kodiak.local:8008/ : Works, shows Cake's system check page. (i 
still have to work out a main index.)
kodiak.local:8008/contact : Works, uses route defined above in the '/' 
scope. Other routes similar to this also work, so i know mod_rewrite is 
doing some part of its job.
kodiak.local:8008/admin : Broken... 

   - It typically redirects to /webroot/admin and gives an error that 
   either i'm missing "WebrootController" (obviously wrong), or usually a 403 
   access forbidden to /webroot/admin.
   - Cake's server correctly redirects to /admin/login and correctly lets 
   me log in and go to various /admin paths...
   

Let me know if more info is needed to figure out what i'm missing. i 
appreciate all the help i've gotten here. :)

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Security Component is Ruining my Life

2014-10-18 Thread glk
Florian... What a wonderful idea.  

Just wish I understood all of Cake well enough to help implement.  I've 
fought with the Security Component many times and, although I've never 
lost, it has created many headaches.  Hope the Development team can add 
this functionality during debugging.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


find('all') with results using id as the index instead of 0,1,2,3,...

2014-10-18 Thread glk
Hello,

I seem to be rewriting the same code over and over... which, of course, is 
really a waste of time...
What I'm using a lot is the results of a find all that is indexed by the id 
field. 

find all returns:
[0] => array( id => 178, otherdata => 'something 178')
[1] => array(id => 55, otherdata => 'data for 55')
etc.

I want:
[178] => array(otherdata => 'something 178')
[55] => array(otherdata => 'data for 55')

Now of course I can loop through the results array and build the second but 
it seems that I'm missing something in Cake.  Is there something in Cake 
that would take care of this more "automagically?"

Thanks in advance for any assistance,
glk

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


routing problem

2014-10-18 Thread masud moni
i am saving the work in home page but it is not seen as the home page.some 
static page is loading as the home page.i want the page which i am changin 
as the home page.what should i do? 
home page is : http://dev.example.al/example1
the page i want as home : http://dev.example.al/example1/pages/home

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Unable to retrieve data in browser from the *.ctp files

2014-10-18 Thread shesar
I have added the model, controller and able to retrieve the view files from 
the browser but the data from the arrays is not being displayed. So I am 
sure I am missing something here.

If I try to bring up:
http://example.com/cake_2_0/app/View/Posts/index.ctp

I see the following on the browser:
   Id Title Created

Html->link($post['Post']['title'], array('controller' => 'posts', 'action' 
=> 'view', $post['Post']['id'])); ?>

The php code is not being compiled in index.ctp. What am I missing? 

The code behind index.ctp is what you have in your documentation as follows:


Blog postsIdTitle 
   Created

Html->link($post['Post']['title'],array('controller' => 'posts', 
'action' => 'view', $post['Post']['id'])); ?>


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: validation criteria at least 3 fileds are not empty

2014-10-18 Thread John Andersen
Assuming you are still using CakePHP 3.0

I have not seen any built-in rules for this kind of validation, so my best 
guess is to roll your own.
See section "Custom Validation Rules" under "Validation" in the CakePHP 3.0 
book. That should help you on the way.

Enjoy, John

On Saturday, 18 October 2014 16:21:57 UTC+3, Radharadhya Dasa wrote:
>
> Hi,
>
> Is there a way to check if at least 3 fileds are not empty? I have 8 
> fileds and any of those could be empty, but at least 3 of them should be 
> not empty. Is there any build in validation rule, or how to do it? Should I 
> do it on beforeSave?
>
> rrd
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


validation criteria at least 3 fileds are not empty

2014-10-18 Thread Radharadhya Dasa
Hi,

Is there a way to check if at least 3 fileds are not empty? I have 8 fileds 
and any of those could be empty, but at least 3 of them should be not 
empty. Is there any build in validation rule, or how to do it? Should I do 
it on beforeSave?

rrd

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


displaying date without time

2014-10-18 Thread Radharadhya Dasa
Hi,

On CakePHP 3 I have a database field which is a DATE (not DATETIME nor 
TIMESTAMP)

When I display 
echo $contact->date;

It will show something like 2014. 01. 06. 0:00. How to hide hours and 
minutes?

I tried 
print $this->Time->format($history->date, 'Y-m-d');
but I got 2014-0-6

How to get year-month-day?

rrd

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.