Re: search by username or email

2012-12-24 Thread zuha
That is some funky looking code there, but you could just use the OR key. 
 Here's an example...

$this-find('first', array(
 'conditions' = array(
  'OR' = array(
   'User.username' = $value,
   'User.email' = $value
   )
  )
));


On Saturday, December 15, 2012 4:12:13 AM UTC-5, Chris wrote:

 hi guys,... I have a admin function that need find users by username or 
 email from search field,... and used to work on cake1.2 
 I moved script to 1.3 ,... and it's not working what am I doing 
 wrong,... ?? please help

   $filter = $this-params['pass'];
   unset($filter['page']);
   unset($filter['sort']);
   unset($filter['direction']);
   $this-data = array('User' = $filter);
   $this-set('url_options', $filter);

   $scope = array();
   foreach(array('username', 'email') as $field)
   {
 if(!empty($filter[$field]))
   $scope[] = 'User.' . $field . ' LIKE \'%' . $filter[$field] . 
 '%\'';
   } 

 thanks in advance 
 chris 



-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Access to specific data cakephp 2.x

2012-12-24 Thread zuha
Is there a reason you don't just do access control in the controller then? 
  ie. 

if ($this-request-data['User']['creator_id']  == 
$this-Session-read('Auth.User.id')) {
$this-BlogPost-save($this-request-data);
}

BTW, Zuha has a behavior called the UsableBehavior which could probably be 
modified to do what you're trying to do with a new function or two added to 
it. 
 https://github.com/zuha/Zuha/tree/master/app/Plugin/Users/Model/Behavior



On Monday, December 24, 2012 6:12:02 PM UTC-5, Paulo Braga wrote:

 Hi Rob. Thanks for your answer, the behavior is very interesting. 

 I think I did not express myself well, I dont want just to set that a user 
 has only access to the posts he created.

 I want also to configure for example:

 We have hotels around a country from the same organization, so in each 
 city there's a manager, and I want a manager to manage just the hotels in 
 his city. but this hotels can be created by another user(admin), is it 
 possible?   I did it with isAuthorized() method, but it requires a lot of 
 code (ugly code)° :p 

 Paulo

 On Monday, December 24, 2012 3:08:31 PM UTC+2, Rob M wrote:

 Hi Paulo: You are describing row-level access control, and I am doing 
 that with CakePHP 2.0 using a modified version of Daniel 
 Vecchiato's WhoDidIt Model Behavior (
 https://github.com/danfreak/4cakephp/tree/master/models/behaviors). Then 
 I check in the controller to see if the id in the table for the person who 
 created the record matches the id of the person who is trying to modify it. 
 - Rob

 On Sunday, December 23, 2012 4:01:28 PM UTC-5, Paulo Braga wrote:

 Hi people.

 I am using cakephp 2.x, and I am trying to build a system with group 
 permissions, ok, I used Acl and Auth component without problem.

 Now I want to configure access to specific data. for example: 

 we have a blog app, and we have users, posts, etc.
 an admin can do anything(no problems);
 a post is posted by a user. (some problems here);

 With acl I configured that admin group can do anything. and that user 
 group can just do anything in posts(add, list, edit, delete). everything is 
 working.

 But I dont want a user to edit,delete,list posts that were not created 
 by him. 

 I used to do it with the method isAuthorized(), but imagining a big app, 
 I think it will be too hard to codify it.

 is there a clean way to do it???



-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




My Unit Tests are Looking for the default database configuration.

2012-11-23 Thread zuha
So, I've got this rather strange thing happening in my Unit Test. I run 
this series of functions... 


$this-Product-create();
 $this-Product-save($testData);
 $id = $this-Product-id;
 $result = $this-Product-find('first', array('conditions' = 
 array('Product.id' = $id)));
 $this-Product-delete($result['Product']['id']);


...and I get this message...


The datasource configuration default was not found in database.php
 Test case: ProductTestCase(testDelete)
 Stack trace:
 /home/razorit/dev.zuha.com/lib/Cake/Model/ConnectionManager.php : 94
 /home/razorit/dev.zuha.com/lib/Cake/Model/Model.php : 3374
 /home/razorit/dev.zuha.com/lib/Cake/Model/Model.php : 1083
 /home/razorit/dev.zuha.com/lib/Cake/Model/Model.php : 3400
 /home/razorit/dev.zuha.com/lib/Cake/Model/Model.php : 3284
 /home/razorit/dev.zuha.com/lib/Cake/Model/Model.php : 2443
 /home/razorit/dev.zuha.com/lib/Cake/Model/Model.php : 2386
 /home/razorit/dev.zuha.com/app/Plugin/Products/Test/Case/Model/ProductTest.php
  
 : 95



...strangely, it doesn't give me any problem like that, for the create(), 
save(), find(). It only seems to throw this error when I use delete(). I've 
looked all over to see if there are any callbacks which might cause it, but 
so far nothing. Any ideas would help, I'm running out of places to look. 


-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Did you know?

2012-07-07 Thread zuha
Did you know that CakePHP has a limit of 1,254 records to be returned in an 
array?  Maybe its a server or database setting and not CakePHP, but let me 
tell you it was a real chore to debug why a query was returning results but 
the data array was empty.  Figured I'd post it somewhere in case it might 
help someone else. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How to Redirect from a Behavior?

2011-12-09 Thread zuha
Ha, I know you'll all say... ah, you're breaking MVC so let me explain 
the situation in case anyone cares to have it.  But if you don't, I'm just 
looking for the best way to force a redirect from a behavior.  Preferably 
without having to edit any other file. 

ie. maybe something like ...  myFunction () { 
Controller::redirect('somewhere'); }


If you just can't stand someone breaking MVC, here's the story, so that 
maybe you can tell me the MVC way to do it.   

I have this behavior which is used by many different plugins.   In 
beforeFind() it filters results.  If no results are found, I want to all of 
the plugins that use this behavior to be redirected to a single specific 
page.  Its not something I would return to the controller, because then I 
would have to edit a the multiple controllers, in multiple plugins for any 
plugin that actsAs this behavior.  And I wouldn't just do a beforeFilter 
catch in AppController, because that would break plugin architecture - as 
in they should be stand alone and separate from the App.   So as simple as 
it sounds, it seems its just not possible to do...

public function afterFind($Model, $results) {
 if (empty($results)) :
$this-redirect('to somewhere else');
 endif;
}

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to Redirect from a Behavior?

2011-12-09 Thread zuha
wow i feel stupid now :)  ah it was a long day

i'm redirecting so that the user gets feedback that there was no info found 
and/or they were restricted from seeing it.  thanks for helping me remember 
cake was written in php :)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-12-01 Thread zuha
#1 They can't be moved.  #2  Yeah spaces are bad, I get it, but this is a 
legacy issue not a moving forward issue.  


Does anyone have any insight as to where Cake checks to see if the file 
exists, and returns the file to the browser if it does when using Themes. 
 I'm happy to hack the core to make this work.  

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-12-01 Thread zuha
ah, found it.  In case anyone else stumbles on this, I changed 

Line 277  278 in /lib/Cake/Routing/Dispatcher.php from...

if (file_exists($path . $fileFragment)) {
$assetFile = $path . $fileFragment;
 }


to..

if (file_exists($path . str_replace('%20', ' ', $fileFragment))) {
   $assetFile = $path . str_replace('%20', ' ', $fileFragment);
 }

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-12-01 Thread zuha
Ah put up the answer a bit too fast.   Here's a better version, where I 
changed...

Line 275 in /lib/Cake/Routing/Dispatcher.php from... 

$fileFragment = implode(DS, $parts);


to...

 $fileFragment = urldecode(implode(DS, $parts));



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-11-30 Thread zuha
Okay so I've hit a problem and I have no idea how to fix it.  In Cake 1.3 a 
file name like /theme/default/images/my image.jpg would work.  In Cake2.0 
the url changes to a standard url in the browser address bar (ie. 
/theme/default/images/my%20image.jpg - with the space replaced with %20). 

So now I have hundreds if not thousands of image files, and some have 
spaces in them, and they're all broken.   Because Cake no longer knows the 
file is there. 

Please note, this does not effect files in the app/webroot directory, but 
only in the theme directory (aka.  /app/View/Themed/Default/webroot/)  For 
example /app/webroot/test test.html  will work when called by the url 
/test%20test.html. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-11-30 Thread zuha
I don't believe symlink will be possible (or at a minimum would be a big 
annoyance) because I run an unlimited number of apps from custom 
directories and each one contains its own theme directory.   I would much 
rather just figure out where to do something like... 

$fileName = str_replace('%20', ' ', $fileName); 

...to get it to show, but can't find where to do that in the core.  I tried 
ThemeView.php, View.php, Helper.php, MediaView.php, CakeResponse.php and no 
luck. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Containable Memory Usage

2011-11-12 Thread zuha
I saw this comment on another thread, and instead of taking over that 
thread with a containable discussion, I'm starting a new one.  Can anyone 
confirm or deny this claim that containable uses a lot of memory?  (as 
say compared to bind/unbind)

On Sat, Nov 12, 2011 at 5:47 PM, phpMagpie pa...@webbedit.co.uk wrote:

 I would advise you to learn how to use containable ... only takes a

couple of lines of code makes life a whole lot easier than having to

bind and unbind for every paginate.



I'd like to avoid it. I think it consumes a lot of memory. CMIIW. 
Thank you. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: cant apply cakes contain function to this array structure

2011-11-07 Thread zuha
I had this problem once and it was because the contain behavior wasn't 
being called (due to app_model not being named AppModel where I was setting 
the actsAs containable setting)  

But I had it happen again, when it was being called and it still didn't 
work.  Contain is pretty buggy now if you ask me. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Want to Start a Business?

2011-11-07 Thread zuha
If any CakePHP developers are interested in starting a Saas business, we 
have a great setup started and are looking for partners (revenue share) who 
would like to build out and compete with Google apps, Salesforce and  Zoho. 
  If you're interested shoot me a private message / email and we can talk 
details.   

If this feels spammy let me know, I won't post it again.  (I'm still a bit 
unclear about whats okay vs. not okay to post here.  ie. bugs only, jobs, 
etc)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CSS not displaying Form elements correctly

2011-11-07 Thread zuha
does it make any difference if you use  echo $this-Form-end('Search');

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Really Annoying Error

2011-11-06 Thread zuha
Well it appears to have held.  Not sure why or how it worked but apparently 
Memcache instead of File

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Run a cron job in cakephp

2011-11-04 Thread zuha
Oh that looks promising, if anything it should at least get us started.   
Thank you for that :  https://github.com/MSeven/cakephp_queue/wiki

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Run a cron job in cakephp

2011-11-04 Thread zuha
Cron is not only for particular times, its also for recurring events.  It 
certainly does make sense if you simply set your task to check what time it 
is before executing.  Then you just try to run it every minute (or every 
page load), and it will fire only at the appropriate time.   This makes a 
lot of sense for something like triggered notifications which don't happen 
until X days after X event, and aren't at any particular time, but instead 
are relative time. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Really Annoying Error

2011-11-03 Thread zuha
I'm not longer sure how this is happening anymore, but its a recurring 
problem with Cake 2.0, and there is no exception or error message to help 
figure it out.   Simply put there are some pages that do not work, (shows 
internal server error), and then when you turn on debug they do work. 
 Without error.  (thus no error message to figure out why it didn't work 
int he first place).  

It seems fairly obvious that it has something to do with cache and cache 
getting refreshed when debug comes on, but as far as what is getting cached 
incorrectly or not cached at all is a mystery. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Error Debugging Help

2011-11-03 Thread zuha
Do you have any advice for how to find the root cause of an error like 
this...

2011-11-03 09:43:59 Error: [MissingControllerException] Controller class 
ImgController could not be found.
#0 /home/.../app/webroot/index.php(133): 
Dispatcher-dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}


Like maybe there's a way to figure out what CakeRequest is asking for?  Or 
maybe someway to update/overwrite MissingControllerException so that it 
outputs a better error?  Any ideas would be helpful. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can i protect my code from the duplicaters

2011-11-03 Thread zuha
that is hilarious, thanks for the laugh

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Error Debugging Help

2011-11-03 Thread zuha
It sure doesn't seem right to throw a missing controller error for a a 
missing image call.  Does anyone else have an idea about how to find where 
this exception is being thrown?   Or what CakeRequest is asking for which 
causes this exception? 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Really Annoying Error

2011-11-03 Thread zuha
Not sure if it will hold, (because I'm not sure how long it takes for it to 
stop working again), but I changed the engine to Memcache and without 
turning debug on the error went away.  That felt promising.  I'll probably 
need to give it 24 hours though and see if it continues to work before I'd 
know for sure.  (it might have just recognized the cache change and wrote 
the cache new, like it does when you turn debug on)

I'll see tomorrow, I guess. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Error Debugging Help

2011-11-03 Thread zuha
Yeah I get that, but are should we seriously have to look at server access 
logs to find a missing image file file?  Maybe the missing controller 
exception would give the name of the action being asked for so you could 
get the full information about the CakeRequest being made. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Run a cron job in cakephp

2011-11-03 Thread zuha
While we're on the topic though... is there anyway to run a process 
separate from the page load.  I would love to run a pseudo cronjob on each 
page load if it could be done without negatively effecting performance in a 
serious way.  (I was thinking curl, and ajax, but they didn't really seem 
to fit the bill)   Any experts out there know how to start a cron task 
outside of the page load, but triggered by a page load?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Can't get Plugin model to work / be noticed at all

2011-10-31 Thread zuha
My bet is that you don't have a plugin defined somewhere.  I had the same 
problem in a couple of places after the upgrade because I had forgotten to 
name which plugin the model could be found in.   

belongsTo = array(
className = [PLUGIN].[MODEL]

instead of...

belongsTo = array(
className = [MODEL]


And this goes for all relationships, and you might have just missed one. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Going back to school: ACL

2011-10-31 Thread zuha
Hey Eric, 
Not sure what else I could explain other than posting some code (which 
isn't 100% tested quite yet).  Basically we use prefix routing just to get 
the $this-request-params['prefix'] variable filled, then reroute getting 
rid of the prefix from the method.  (a call which would normally go to 
admin_index()  becomes a a call to index() method)  

If you want more info, I would suggest starting a new thread with a 
question, because it would steer this original post way too far off topic.  

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Contain Getting Ignored Again (cake 2.0)

2011-10-31 Thread zuha
I've posted about this before, but previously it was because AppModel 
wasn't getting loaded (I have made sure that it and containable is being 
loaded this time).  But even though they are being loaded, I'm again having 
a problem where 'contain' stops working.   I go to the beforeFind method 
and print out the $queryData, and sure enough contain is in the array, and 
I get this sql error because there is no join in the sql on the contact 
table. 

Column not found: 1054 Unknown column 'Contact.name' in 'field list' 

*With this Query ::  *SELECT `Project`.`id`, (CONCAT(`Project`.`name`,  , 
`Contact`.`name`, )) AS `Project__displayName` FROM `projects` AS 
`Project` INNER JOIN `used` AS `Used` ON (`Used`.`foreign_key` = 
`Project`.`id` AND `Used`.`model` = 'Project' AND `Used`.`user_id` = 1) 
WHERE 1 = 1 ORDER BY `Project`.`name` ASC 

*Mind you this query works in every other place in our app because the 
Contact table is automatically joined with containable.  Just in this one 
plugin it seems to be impossible to get contain to work when its called 
from this plugin to another plugin.*

*Here is the line that is creating this query in TimesheetsController.php : 
*
$projects = $this-TimesheetTime-Project-find('list');

*Here is the output from beforeFind($queryData) { debug($queryData) } in 
the Project model  (most notably is that 'contain' = Contact.name exists 
in the queryData)*

Array
(
[conditions] = 
[fields] = Array
(
[0] = Project.id
[1] = Project.displayName
)

[joins] = Array
(
[0] = Array
(
[table] = used
[alias] = Used
[type] = INNER
[conditions] = Array
(
[0] = Used.foreign_key = Project.id
[1] = Used.model = 'Project'
[2] = Used.user_id = 1
)

)

)

[limit] = 
[offset] = 
[order] = Array
(
[0] = Array
(
[0] = Project.name
)

)

[page] = 1
[group] = 
[callbacks] = 1
[contain] = Array
(
[0] = Contact.name
)

[recursive] = -1
[list] = Array
(
[groupPath] = 
[valuePath] = {n}.Project.displayName
[keyPath] = {n}.Project.id
)

)



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Contain Getting Ignored Again (cake 2.0)

2011-10-31 Thread zuha
That had some effect, but made something else break.  I added...

$params['fields'][] = 'Project.contact_id'; 

to force the contained relationship foreign key to be included, and it 
completed the query, but then the virtualField defined in the 
Project::__construct() method stopped working and I would get an index 
does not exist error for the displayField.  (even after making sure that 
it remained in the fields list)

$this-displayField = 'displayName';

What I mostly don't get why it works from other plugins by not this 
particular plugin when they both make calls to the Project model. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 2.0 upgrade - benefit vs pain scale

2011-10-27 Thread zuha
It took me 7, 15 hour days to get my app mostly back to normal after the 
upgrade.   Its pretty painful, but the performance upgrade is worth it in 
my opinion.  (1.3 is so slow, its close to unusable for larger 
applications, so far 2.0 has been a substantial upgrade in performance)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Why use .po files (was: Re: Discussion Question)

2011-10-27 Thread zuha
What I'm talking about is this :  
http://translate.google.com/translate_tools 

And that does allow you to have specific translations for specific pages 
and/or websites, but also will automatically translate using a world wide 
translation system.  (In other words it takes advantage of a social 
database of translations which get better as more people use it.)   

So scalability wise - you can translate your app into 50 different 
languages immediately and then have it improved upon at anytime by any 
visitor to your site because they can contribute a better translation at 
the click of a button. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Going back to school: ACL

2011-10-27 Thread zuha
#1 : Would require a prefix for every role.   admin_index, manager_index, 
user_index, guest_index, etc.   With ACL being database driven you can have 
unlimited user roles and not be required to add new prefixes every time you 
add a role. 

#2 : I don't know, interesting question.  It sounds kind of a-typical to me 
though.  You would probably add a 3rd group in that rare case called 
something like, board-teachers.  

#3 : Yes and its not small.  It can be large and a major slow down. 

ACL is very flexible but the flexibility comes with the downside of speed 
performance.  I'm quite sure there are caching solutions to get around it, 
but I have not gotten that far yet (even after 2 years of using ACL 
extensively). 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Non Human / User Authentication

2011-10-27 Thread zuha
Maybe a better question is, can you use a REST type of authentication with 
ACL checking the permissions? 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Best Practice (import, used, class registry)

2011-10-27 Thread zuha
Not really sure why there are 3+ ways to do the same thing in CakePHP but 
what is the best standard (future proof) way to link models which aren't 
inherently (hard coded) related.

App::import('Model', [Plugin].[Model]);
$Model = new [ModelClass];

App::uses([Plugin].[Model], 'Model');
$Model = new [ModelClass];

$Model = ClassRegistry::init([Plugin].[Model]);

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 2.0 upgrade - benefit vs pain scale

2011-10-27 Thread zuha
How many tables are in your database for this site, and do you use ACL? 
 I'd like to see some bench marks too, but don't necessarily think that the 
biggest improvements would be shown in a straight setup.  Instead, I'd like 
to see benchmarks based on some use cases of core components. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Why use .po files (was: Re: Discussion Question)

2011-10-27 Thread zuha
Your js translation is a good point.  Especially if you want to show for 
SEO in other countries.  I would need to investigate that a bit further.   
But with it being from Google I might guess that if it doesn't now, that it 
would eventually be fine for SEO.  And I'm not looking at Google Translate 
as anything but a possible way to make the tedious job of translation more 
efficient.   I think you put the purity of hand written translation ahead 
of practical usage.  In depth translation might be great if you have people 
willing and/or able to do it, but if you don't then finding another 
solution is not a bad idea either.  (and note : you do get to control the 
translations if I remember right)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Going back to school: ACL

2011-10-27 Thread zuha
Ha you've hit pretty close to a change I've made in the way Cake works in 
order to address the prefix in what I think is a better way.  In our app we 
keep prefix routing but get rid of the method routing.  So we still get the 
$this-params-params['prefix'] but route the user to the index() method 
instead of the admin_index() method.   We then leave it up to ACL 
completely to decide whether your role has access to the index function.   
This allows us to get rid of 50% of the view files and 50% of the 
controller methods. 

We can have different views for different user roles in that we assign view 
prefixes to user roles.  So we can have an admin view, and all users in the 
admin user role would see /Posts/View/Posts/admin/index.ctp instead of 
/Posts/View/Posts/index.ctp if and only if the admin view exists.  We could 
do the same thing for managers, users, etc, and leave it up to each app to 
decide whether managers would see the admin view or the manager view or the 
guest view. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Discussion Question

2011-10-26 Thread zuha
Okay just have a question I've been curious about for awhile.  What is the 
benefit of .pot files instead of say using Google Translate?I'm also 
curious as to whether removing the 1000's of __() functions would have any 
performance upgrade in that case. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 2.0 meioupload

2011-10-26 Thread zuha
Actually I think the preferred way if I'm not mistaken is...

App::uses('File', 'Utility');
App::uses('Folder', 'Utility');

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 2.0 bake all plugin views - fail?

2011-10-26 Thread zuha
Do you have this in your bootstrap.php file ? 


 CakePlugin::loadAll(); // Loads all plugins at once

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Looking for a Programmer

2011-10-25 Thread zuha
Not sure if this is allowed on this board or no, so please remove it if it 
isn't and I won't post anything like it again.   I'm looking for a CakePHP 
programmer and figured there probably isn't a much better place too look 
than here. 

http://www.razorit.com/all-star-mvc-programmer/

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Non Human / User Authentication

2011-10-24 Thread zuha
Don't know if I'm just not search for the right keywords, but I'm hoping 
some one might be able to point me in the right direction for a tutorial or 
advice on how to use Acl with a REST type of authentication.   The specific 
case I'm trying to do is explained something like this...

   - I create a tasks rss feed.  (available at something like 
   [domain]/tasks/tasks/index.rss)
   - This index method is Acl controlled 
   - If I'm logged in as a user I can view the rss feed directly.
   - If I'm logged in as a user and I view the feed with a feed aggregator / 
   reader I cannot see it.
  - I cannot see it because the aggregator is not passing the Acl check 
  (even though its at the same domain installed in the same system)
  - If I turn on allowedActions = 'index', the reader works
   - How might I get the aggregator to pass authentication based on the user 
   using the feed reader?  (because I want to manage permissions for viewing 
   the feed in the same way that I manage permission to individual methods)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


CakePHP 2.0 Component Calling Helper

2011-10-21 Thread zuha
So I'm working on upgrading the CakeDC Comments Plugin to 2.0, and I've hit 
a roadblock.  

// in Comments/Controller/Component/CommentsComponent.php
function cleanHtml($text, $settings = 'full') {
App::import('Helper', 'Comments.Cleaner');
$cleaner =  new CleanerHelper();
return $cleaner-clean($text, $settings);
}

and I get the follow error print out  (any help for how I get the view to 
from the component to the helper)? 

*Warning* (4096) 
http://razorit.localhost/tasks/tasks/view/4ea17399-9790-4595-a330-0c58124e0d46/comment:0:
 Argument 1 passed to CleanerHelper::__construct() must be an instance of View, 
none given, called in 
C:\wamp\www\zuha\app\Plugin\Comments\Controller\Component\CommentsComponent.php 
on line 678 and defined [*APP\Plugin\Comments\View\Helper\CleanerHelper.php*, 
line *78*]

*Notice* (8) 
http://razorit.localhost/tasks/tasks/view/4ea17399-9790-4595-a330-0c58124e0d46/comment:0:
 Undefined variable: View [*APP\Plugin\Comments\View\Helper\CleanerHelper.php*, 
line *82*]

*Warning* (4096) 
http://razorit.localhost/tasks/tasks/view/4ea17399-9790-4595-a330-0c58124e0d46/comment:0:
 Argument 1 passed to Helper::__construct() must be an instance of View, null 
given, called in 
C:\wamp\www\zuha\app\Plugin\Comments\View\Helper\CleanerHelper.php on line 82 
and defined [*CORE\Cake\View\Helper.php*, line *144*]

*Notice* (8) 
http://razorit.localhost/tasks/tasks/view/4ea17399-9790-4595-a330-0c58124e0d46/comment:0:
 Trying to get property of non-object [*CORE\Cake\View\Helper.php*, line *146*]

*Warning* (4096) 
http://razorit.localhost/tasks/tasks/view/4ea17399-9790-4595-a330-0c58124e0d46/comment:0:
 Argument 1 passed to CleanerHelper::__construct() must be an instance of View, 
none given, called in 
C:\wamp\www\zuha\app\Plugin\Comments\Controller\Component\CommentsComponent.php 
on line 678 and defined [*APP\Plugin\Comments\View\Helper\CleanerHelper.php*, 
line *78*]

*Notice* (8) 
http://razorit.localhost/tasks/tasks/view/4ea17399-9790-4595-a330-0c58124e0d46/comment:0:
 Undefined variable: View [*APP\Plugin\Comments\View\Helper\CleanerHelper.php*, 
line *82*]

*Warning* (4096) 
http://razorit.localhost/tasks/tasks/view/4ea17399-9790-4595-a330-0c58124e0d46/comment:0:
 Argument 1 passed to Helper::__construct() must be an instance of View, null 
given, called in 
C:\wamp\www\zuha\app\Plugin\Comments\View\Helper\CleanerHelper.php on line 82 
and defined [*CORE\Cake\View\Helper.php*, line *144*]

*Notice* (8) 
http://razorit.localhost/tasks/tasks/view/4ea17399-9790-4595-a330-0c58124e0d46/comment:0:
 Trying to get property of non-object [*CORE\Cake\View\Helper.php*, line *146*]



*// NOTE : I've already added this to the CleanerHelper... (View $View, 
$settings = array())*

public function __construct(View $View, $settings = array()) {
foreach ($this-config['full'] as $key = $value) {
$this-{$key} = $value;
}
parent::__construct($View, $settings);
}

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 2.0 Component Calling Helper

2011-10-21 Thread zuha
Solved (might be a better solution though, if anyone cares to critique my 
solution) : 

*Changed the function cleanHtml() from the above version to this version : *
*
*
// in Comments/Controller/Component/CommentsComponent.php 
function cleanHtml($text, $settings = 'full') {
App::import('Helper', 'Comments.Cleaner');
App::uses('View', 'View');
$this-View = new View($this-Controller);
$cleaner =  new CleanerHelper($this-View);
return $cleaner-clean($text, $settings);
}

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Table design for storing of synonyms

2011-10-21 Thread zuha
ah, my feelings are hurt :(

-- since sarcasm doesn't translate well to typed text, I'll let you know... 
 this reply is just an example of some poor humor 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Table design for storing of synonyms

2011-10-20 Thread zuha
Personally, I think I would just put them in a comma separated list, and if 
you want to get fancy you could serialize and unserialize them.   So...

id, root, synonyms  

for the table structure, and an example entry would be

Synonym.root = mad
Synonym.synonyms = angry, upset, bachmann

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: vtiger CRM with Cakephp

2011-10-19 Thread zuha
Yes, thats why I didn't respond to it.  (not to mention I'm not on this 
board to argue with anyone)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Login Difficulty : CakePHP 2.0

2011-10-19 Thread zuha
Thank you, thank you, thank you.  That worked nicely. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: vtiger CRM with Cakephp

2011-10-18 Thread zuha
I will after we finish the migration to CakePHP 2.0.   Otherwise we only 
share it with potential contributors who meet with me personally (phone / 
screen share).   Its in alpha phase. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Containable Not Working - Migration to CakePHP 2.0 from 1.3

2011-10-18 Thread zuha
Sorry, I should have mentioned it is also being used.   

In my model I overwrite the find() function like so.  (Yes I know 
beforeFind(), this is just an example)

function find($type = null, $params = array()) {
$params = array_merge_recursive(array('contain' = array('Contact' = 
array('fields' = array('id', 'name', $params);
return parent::find($type, $params);
}

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 2.0.0 release

2011-10-18 Thread zuha
Can you paste your database.php file code? 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Containable Not Working - Migration to CakePHP 2.0 from 1.3

2011-10-18 Thread zuha
*Solved :: * It went higher than the ContainableBehavior not getting loaded. 
 The app_model file itself wasn't being loaded.   

In case it helps someone else.  It wasn't being loaded because the file was 
named app_model.php and not AppModel.php (and probably because the models 
folder was renamed to Model). 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Login Difficulty : CakePHP 2.0

2011-10-18 Thread zuha
For some reason the UsersController after login is not finding the User 
model.   

*// UsersController.php*

public function login() {  
if (!empty($this-request-data)) {
if ($this-Auth-login()) {
try {
$this-User-loginMeta($this-request-data);
 return $this-redirect($this-Auth-redirect());
} catch (Exception $e) {
$this-Session-setFlash($e-getMessage());
$this-Auth-logout();
}
} else {
$this-Session-setFlash(__('Username or password is incorrect'), 
'default', array(), 'auth');
}
}
}

*/// Error Output*

*Notice* (8): Array to string conversion 
[*CORE\Cake\Model\Datasource\DboSource.php*, line *436*]
Code Context

PDOStatement::execute() - [internal], line ??
DboSource::_execute() - CORE\Cake\Model\Datasource\DboSource.php, line 436
DboSource::execute() - CORE\Cake\Model\Datasource\DboSource.php, line 403
DboSource::fetchAll() - CORE\Cake\Model\Datasource\DboSource.php, line 645
DboSource::query() - CORE\Cake\Model\Datasource\DboSource.php, line 587
Model::__call() - CORE\Cake\Model\Model.php, line 720
AppModel::loginMeta() - APP\Plugin\Users\Controller\UsersController.php, line 48
UsersController::login() - APP\Plugin\Users\Controller\UsersController.php, 
line 48
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE\Cake\Controller\Controller.php, line 473
Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 107
Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 89
[main] - APP\webroot\index.php, line 125



Notice how in that output it goes to AppModel::loginMeta()  after the 
UsersController::login()?   When my code clearly says 
: $this-User-loginMeta($this-request-data);  which is a call to the 
UserModel.   It should say UserModel::loginMeta() not 
AppModel::loginMeta(). 


BTW...  I put some text in the User.php file that should throw a fatal error 
if the file is being loaded, and it does not throw the Fatal error.   
Instead it brings me back to the login page with this output in the flash 
message.

*SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error 
in your SQL syntax; check the manual that corresponds to your MySQL server 
version for the right syntax to use near 'loginMeta' at line 1*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problem generating view for REST webservice in cakephp 2.0

2011-10-18 Thread zuha
I doubt its the right answer but figured I'd throw it out just in case. 
 Have you tried $this-Xml-header();  instead of $xml-header();  ?   
Ignore me if I'm steering you off track. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: plugin cakephp

2011-10-18 Thread zuha
Plugin communication is typically pretty simple.  Here's one example that 
might get you started...

// In my Users Plugin, which I want to relate to my Galleries Plugin

var $hasMany = array(
'Gallery' = array(
'className' = 'Galleries.Gallery',
'foreignKey' = 'foreign_key',
'dependent' = true,
),
  );

^^^ Galleries is the name of the plugin, and Gallery is the model within 
that plugin. 

// You might also do plugin to non-plugin communication, or non-plugin to 
non-plugin, if say the Gallery model is in /app/Model/Gallery.php 

var $hasMany = array(
'Gallery' = array(
'className' = 'Gallery',
'foreignKey' = 'foreign_key',
'dependent' = true,
),
 );

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: 2.0 Upgrade Problem (with $controller-request in RequestHandlerComponent)

2011-10-17 Thread zuha
I solved the issue.  In CakePHP 2.0 the AppController::__construct() has new 
variables that you need to pass to the parent __construct().I updated 
the __construct() function to look like this...


public function __construct($request = null, $response = null) {
parent::__construct($request, $response);
// my construct logic
}

(Previously the $request, and $response vars weren't there.)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: vtiger CRM with Cakephp

2011-10-17 Thread zuha
How much time do you have to commit to working on a CRM?   We have developed 
an open source CRM for CakePHP and could use a new contributor.   (It's 
desktop  mobile ready, and very simple, and includes a number of other 
functionalities as well).   Let me know if you're interested. 

https://lh6.googleusercontent.com/-a41qYMp6LA4/TpxBTDVValI/AAc/9qfVXGUgXIk/Capture.JPG

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Exception Handler Not Getting $this and by extension $this-request

2011-10-17 Thread zuha
I followed the documentation exactly in the book, specifically 
 
(http://book.cakephp.org/2.0/en/development/exceptions.html#built-in-exceptions)...

?php
// in app/config/core.php
Configure::write('Exception.handler', 'AppExceptionHandler::handle'); 

// in app/config/bootstrap.php
App::uses('AppExceptionHandler', 'Lib'); 

// in app/Lib/AppExceptionHandler.php
class AppExceptionHandler {
public static function handle($error) {
   echo 'Oh noes! ' . $error-getMessage();
   $this-sendEmail();
}
...
}


And it gives you this error : Fatal error: Using $this when not in object 
context in C:\wamp\www\zuha\app\Lib\AppExceptionHandler.php on line *9*

This is causing other problems too, in that I think its stopping the 
application from finding AppExceptionRenderer (explained in the same book 
page).   

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Exception Handler Not Getting $this and by extension $this-request

2011-10-17 Thread zuha
Its not that $this-sendEmail() is a bad example.  I was only using that as 
an example of how $this-[anything] is not working.   Including 
$this-request-url or if I add another function underneath that function 
and do 

public static function handle($error) { 
$this-functionInTheSameClass(); 
}

Really the whole thing is just not working as expected when I do exactly 
what is in the documentation.   Like when I do the AppExceptionRenderer 
thing in the book, the AppExceptionRenderer.php file is never found in the 
/app/Lib/  directory, and I get nothing but uncaught exception errors. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: 2.0 Upgrade Problem (with $controller-request in RequestHandlerComponent)

2011-10-17 Thread zuha
Yup its there, but without an example of how to do it its not really 
something that stands out.  Is the documentation open to contributors to 
make changes?  I wouldn't mind helping.  I would change where it says...

Controller’s constructor now takes two parameters. A CakeRequest, and 
CakeResponse objects. These objects are used to populate several deprecated 
properties and will be set to $request and $response inside the controller. 

To 

Controller’s constructor now takes two parameters. A CakeRequest, and 
CakeResponse objects. These objects are used to populate several deprecated 
properties and will be set to $request and $response inside the controller. 
 The new constructor would look like this public function 
__construct($request = null, $response = null) {  // 
parent::__constructor($request 
= null, $response = null);  // insert logic  }



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Exception Handler Not Getting $this and by extension $this-request

2011-10-17 Thread zuha
Here's some code in case anyone can help decipher why the error is 
happening. 

Following instructions here 
: http://book.cakephp.org/2.0/en/development/exceptions.html#built-in-exceptions

// in /app/Config/core.php 
#Configure::write('Exception', array(
# 'handler' = 'ErrorHandler::handleException',
# 'renderer' = 'ExceptionRenderer',
# 'log' = true
#));
Configure::write('Exception.renderer', 'AppExceptionRenderer');

// in /app/Lib/AppExceptionRenderer.php

App::uses('ExceptionRenderer', 'Error');

class AppExceptionRenderer extends ExceptionRenderer {
 public function missingController($error) {
echo 'Oops that widget is missing!';
}


And this is the error printed on the page when visiting the root (ie. 
http://localhost)


 ( ! ) Fatal error: Uncaught exception 'MissingControllerException' with 
message 'Controller class Controller could not be found.' in 
C:\wamp\www\zuha\lib\Cake\Routing\Dispatcher.php on line *83* ( ! 
)MissingControllerException: Controller class Controller could not be found. 
in C:\wamp\www\zuha\lib\Cake\Routing\Dispatcher.php on line *83*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Containable Not Working - Migration to CakePHP 2.0 from 1.3

2011-10-17 Thread zuha
I have : 

class AppModel extends Model { 
var $actsAs = array('Containable');
}

and I go to /lib/Cake/Model/Behavior/ContainableBehavior.php  and put 
something in the file that would create a Fatal PHP error, and nothing 
happens.  (ie. remove a comma or something, or put in some non-sense 
characters, or just delete half the file).  

That was how I tested whether the ContainableBehavior was being loaded, and 
it appears it is not.   (I was wondering why containable wasn't loaded when 
some data was missing from a few views).

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Limit output from DB based on user_id

2011-10-17 Thread zuha
Maybe something like...

$this-[ModelName]-find('all', array('conditions' = 
array([ModelName].user_id = $this-Session-read('Auth.User.id')));

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


2.0 Upgrade Problem (with $controller-request in RequestHandlerComponent)

2011-10-16 Thread zuha
(I have searched for answers, I have attempted self-debugging for 4+ hours, 
Including going through the core up and down. )

Its going to be hard to be clear on this problem but here's my best 
effort...

In /lib/CAke/Controller/Component/RequestHandlerComponent.php in the 
initialize function I put these two lines (line 110  111 if it helps)...

debug($controller-name);
debug($controller-request-params);

The controller name is printed as expected, but the second line gives me 
this output:

*Notice* (8): Trying to get property of non-object 
[*CORE\Cake\Controller\Component\RequestHandlerComponent.php*, line *111*]


I believe this means that somehow CakeRequest is not making its way into the 
Controller being passed to the RequestHandler Component.  Since we do see 
the Controller name though (btw, we see helpers var and others too), the 
controller is there.  In the end what it does is cause a fatal error when 
the Request Handler later calls to a $this-request-parseAccept() 
function.  

What would cause a controller to not load CakeRequest?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Session Not Persistent When Calling a Feed

2011-08-02 Thread zuha
I'm trying to show a running activity log using rss feeds from various
plugins.  I can handle everything pretty well except the fact that
what the feed should return is based on the user doing the request.
But we don't know the user doing the request because Session-read()
returns nothing.   These feeds should only be available to the app
itself - not outside feed readers or anything - and should only be
available when a user is logged in.   So when the request is made the
page which is to display the feeds is being called by someone who is
logged in.

Hardcoded example:
foreach($Simplepie-feed('http://localhost/projects/projects/messages/
79.rss') as $feed) :$data =
   array(
'title' = $feed-get_title(),
'permalink' =  $feed-get_permalink(),
'datetime' = $feed-get_date(),
'description' = $feed-get_description(),
'name' = $url['News']['name']);
array_push($feeds, $data);
endforeach;

I've reviewed the output and instead of returning the raw text of an
rss file (like it does if I just go to the requested url instead of
calling it with a feed parser), it returns the html for our login
page.  Which obviously happens because Auth is redirecting it.

Any idea how I pass the session for that request so that,
1. I don't get redirected to the login page and,
2. So that the feed can return values specific to that logged in user.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Easy Query Seems Difficult to Fire

2011-06-15 Thread Zuha
Seems like this should be easy, and maybe I'm just missing how to do
it, but I want to execute the following query. [preferrably using
find('list')]

SELECT `Contact`.`id`, `Contact`.`name` FROM `contacts` AS `Contact`,
`contact_companies` AS `ContactCompany` WHERE `Contact`.`id` =
`ContactCompany`.`contact_id` ORDER BY `Contact`.`name` ASC

ContactCompany belongsTo Contact

That query returns the exact information I want, but without query(),
I don't see how to do it.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Easy Query Seems Difficult to Fire

2011-06-15 Thread Zuha
Close... select where we only pull back contacts where the company
belongsTo contact



On Jun 15, 3:00 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 Are you trying to do an inner join where you only pull back contacts who 
 belong to a company?

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 15 Jun 2011, at 17:44, Zuha wrote:







  Seems like this should be easy, and maybe I'm just missing how to do
  it, but I want to execute the following query. [preferrably using
  find('list')]

  SELECT `Contact`.`id`, `Contact`.`name` FROM `contacts` AS `Contact`,
  `contact_companies` AS `ContactCompany` WHERE `Contact`.`id` =
  `ContactCompany`.`contact_id` ORDER BY `Contact`.`name` ASC

  ContactCompany belongsTo Contact

  That query returns the exact information I want, but without query(),
  I don't see how to do it.

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Easy Query Seems Difficult to Fire

2011-06-15 Thread Zuha
INNER was the word I needed to remember to get an alternative to
work.


For other people here's what the end query (which returns the same as
the above query) turned out to be.

SELECT `Contact`.`id`, `Contact`.`name` FROM `contacts` AS `Contact`
INNER JOIN contact_companies AS `ContactCompany` ON
(`ContactCompany`.`contact_id` = `Contact`.`id`) WHERE 1 = 1 ORDER BY
`Contact`.`name` ASC


and the Cakephp way is (in my Contact model)

$this-find('list', array(
 'joins' = array(array(
'table' = 'contact_companies',
'alias' = 'ContactCompany',
'type' = 'INNER',
'conditions' = array(
'ContactCompany.contact_id = Contact.id',
),
)),
'order' = 'Contact.name'));


(I typed that out, so don't shoot me if I'm missing a parenthesis or
something)




On Jun 15, 4:46 pm, Zuha zuha-test...@razorit.com wrote:
 Close... select where we only pull back contacts where the company
 belongsTo contact

 On Jun 15, 3:00 pm, Jeremy Burns | Class Outfit







 jeremybu...@classoutfit.com wrote:
  Are you trying to do an inner join where you only pull back contacts who 
  belong to a company?

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 15 Jun 2011, at 17:44, Zuha wrote:

   Seems like this should be easy, and maybe I'm just missing how to do
   it, but I want to execute the following query. [preferrably using
   find('list')]

   SELECT `Contact`.`id`, `Contact`.`name` FROM `contacts` AS `Contact`,
   `contact_companies` AS `ContactCompany` WHERE `Contact`.`id` =
   `ContactCompany`.`contact_id` ORDER BY `Contact`.`name` ASC

   ContactCompany belongsTo Contact

   That query returns the exact information I want, but without query(),
   I don't see how to do it.

   --
   Our newest site for the community: CakePHP Video 
   Tutorialshttp://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
   others with their CakePHP related questions.

   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this group 
   athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Downgrade from 1.3 to 1.2 Question

2010-09-02 Thread zuha
Does anyone think it might be possible to selectively downgrade, most
specifically the routing updates made to 1.3?   For our use it seems
the fixes Cake put into the router are worse than the problems the
changes were trying to fix, and we're considering dropping back to 1.2
if we can't get it to work better soon.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Getting back 1.2 plugin routing in 1.3 :: (1.3.3 to be exact) :: Round 1

2010-09-01 Thread zuha
Okay, so I know that 1.3 eliminated the old plugin routing that
automagically made it the double reference to plugins/controllers
disappear.   Ie. /admin/projects/projects/view/1 was automagically /
admin/projects/view/1.

So I've been trying to get it back for like a week now, and have it
pretty well done, but something very strange is going on and I was
wondering if anyone might have some ideas to push me in another
direction.

Situation Summary :  Routing works in most cases, but if debug mode is
off (ie. set it to 0 in core.php) after a new repository publish
almost no pages work until I turn on debug mode (set to 2) and refresh
almost exactly 3 times.   After that it works with debug mode set back
to zero.   So its obviously some caching issue, but boy is it annoying
to be working on a project for the first time since publishing a repo
commit and save some changes and have all of those changes be lost
because I didn't run the add function three times in full debug mode
to update the cache.

Routing Code :


# shorten up plugin urls
$controllerKey = false;
$prefixedPluginKey = false;
$urlPieces = explode('/', $fromUrl);
$plugins = App::objects('plugin');
$pluginKey = array_search(Inflector::camelize($urlPieces[0]),
$plugins);
if (!empty($urlPieces[1])) $prefixedPluginKey =
array_search(Inflector::camelize($urlPieces[1]), $plugins);
# lets do non-admin or prefixed first
if ($pluginKey !== false) {
# and check if the next url piece is a controller or an action 
or if
it even exists
$plugin = strtolower($plugins[$pluginKey]);
if (!empty($urlPieces[0])) {
$pluginPath = App::pluginPath($plugin);
$controllers = App::objects('controller',
$pluginPath.'controllers');
$controllerKey = 
array_search(Inflector::camelize($urlPieces[1]),
$controllers);
if ($controllerKey !== false) {
$controller = $controllers[$controllerKey];

Router::Connect('/'.$plugin.'/:controller/:action/*',
array('plugin' = $plugin, 'controller' = $controller));
} else {
$controller = $plugin;
Router::Connect('/'.$plugin.'/:action/*', 
array('plugin' =
$plugin, 'controller' = $controller));
}
}
} else if ($prefixedPluginKey !== false) {
# now lets do admin
$plugin = strtolower($plugins[$prefixedPluginKey]);
if ($urlPieces[0] == 'admin') {
$pluginPath = App::pluginPath($plugin);
$controllers = App::objects('controller',
$pluginPath.'controllers');
if(!empty($urlPieces[2])) $controllerKey =
array_search(Inflector::camelize($urlPieces[2]), $controllers);
if ($controllerKey !== false) {
$controller = $controllers[$controllerKey];

Router::Connect('/admin/'.$plugin.'/:controller/:action/*',
array('plugin' = $plugin, 'controller' = $controller, 'admin'=
true));
} else {
$controller = $plugin;
Router::Connect('/admin/'.$plugin.'/:action/*', 
array('plugin' =
$plugin, 'controller' = $controller, 'admin'= true));
}
}
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Getting back 1.2 plugin routing in 1.3 :: (1.3.3 to be exact) :: Round 2

2010-09-01 Thread zuha
I just posted a separate similarly titled post, but this is a separate
issue and I didn't want to complicate by asking two questions in one
thread.  So here's Round 2 :-)

###

Okay, so I know that 1.3 eliminated the old plugin routing that
automagically made it the double reference to plugins/controllers
disappear.   Ie. /admin/projects/projects/view/1 was automagically /
admin/projects/view/1.

So I've been trying to get it back for like a week now, and have it
pretty well done, but something very strange is going on and I was
wondering if anyone might have some ideas to push me in another
direction.  And this specifically relates to needing html-link to
output the right href attribute to match my routing in Round 1 of this
message.


Situation Summary :  I took some points from Mark Story's blog and the
great custom parse routing explanation he gave,
http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp
and tried to re-fashion it into a match routing so that html-link
will output the right href attributes.   It works in almost all cases
except when I am in a sub-controller of a plugin and linking back to
the main controller which has the same name as the plugin.   For
example, I'm in the projects plugin, looking at /admin/projects/
project_issues/view/1  and html- link should be pointing back to /
admin/projects/ or /admin/projects/index and instead it points to /
admin/projects/projects/index which doesn't work because some of my
other routing (referenced in Round 1) is set to eliminate the double
plugin/controller reference.   In all other cases, and even on other
pages, the links work.  The same link exact link even (in my main
navigation for instance) works on every other page, except when I am
in this sub controller of the project.

Routing codes :

/app/config/routes.php

App::import('Lib', 'HtmlLinkRewrite');
Router::connect('/:slug', array(), array('routeClass' =
'HtmlLinkRewrite'));


/app/libs/routes/html_link_rewrite.php

?php

class HtmlLinkRewrite extends CakeRoute {

function match($url) {
if ($url['plugin'] == $url['controller']) {
unset($url['plugin']);
$output = array();
$named = array();
foreach ($url as $key = $value) {
if (!empty($url[0])) {
$output[3] = $url[0];
}

if ($key == 'admin') {
$output[0] = $key;
} else if ($key == 'controller') {
$output[1] = $value;
} else if ($key == 'action') {
$output[2] = $value;
} else {
$named[] = $key.':'.$value;
}
}
ksort($output);
$output = implode('/', $output);
$output = $output.'/'.implode('/', $named);
return $output;
}

$url = parent::match($url);
if(empty($url)) {
return false;
}
return false;
}

}

?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to make folder stacture 4 multiple website

2010-09-01 Thread zuha
I just did this and though I don't think its my ideal and perfect
situation, I do it like this (hope I don't forget anything)

1. Create a folder called /sites
2. Put directories in that folder that match the host name of the the
site (ie. mysite.localhost OR mysite.com OR subdomain.mysite.com)
3. By default I copy the /app/config, /app/locale/, /app/tmp folders
from /app into those new directories.
4. Then inside of /app/webroot I create another directory named after
the site host name (ie. /app/webroot/mydomain.com)

Intermission NOTE :  I create /sites/mydomain.com in order to hold
custom controllers, models and views and overwrite my main /app
controllers models views in case I need something custom for one of
those sites.  (So I'm using the same /app unless its absolutely
necessary to make a one off mvc custom for a site)   I create /app/
webroot/mydomain.com so that I can easily have custom js, css, and img
for each site.  Back to step by step (here's where the magic
happens)...


5.  Open /app/webroot/index.php and change the definition of APP_DIR
to this...


if (!defined('APP_DIR')) {
/* enable this if you want to support multiple domains or sites 
*/
define('APP_DIR', 'sites'.DS.$_SERVER['HTTP_HOST']);
/* disable this if you want to support multiple domains or 
sites */
#define('APP_DIR', basename(dirname(dirname(__FILE__;
}
define('IMAGES_URL', '');
define('CSS_URL', '');
define('JS_URL', '');

6. Open bootstrap.php in each site you have a /sites/mydomain.com/
config/bootstrap.php file and add this...  (this is where you tell it
to look for your custom mvc files first and if they don't exist then
use the main mvc files that all of your sites use)


App::build(array(
'plugins' = array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'plugins'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'plugins'.DS
),
'models' =  array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS
),
'views' = array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'views'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'views'.DS
),
'controllers' = array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'controllers'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'controllers'.DS
),
'datasources' = array(

$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS.'datasources'.DS,

$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS.'datasources'.DS
),
'behaviors' = array(

$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS.'behaviors'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS.'behaviors'.DS
),
'components' = array(

$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'controllers'.DS.'components'.DS,

$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'controllers'.DS.'components'.DS
),
'helpers' = array(
$_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'views'.DS.'helpers'.DS,
$_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'views'.DS.'helpers'.DS
),
#  You could probably do these too, I just haven't had a need for them
yet.
#   'vendors' = array('/full/path/to/vendors/', '/next/full/path/to/
vendors/'),
#   'shells' = array('/full/path/to/shells/', '/next/full/path/to/
shells/'),
#   'locales' = array('/full/path/to/locale/', '/next/full/path/to/
locale/')
));



7.  Go to https://cakeforge.org/projects/zuha/ and become a member so
that you can download a functional version of this and tons more pre-
alpha code (like a CRM, Project Manager, CMS, MU Blogs, Wikis and more
to come)  --- Okay so I stuck some shameless promotion for my app in
here -- shoot me.


Richard @ RazorIT.com






On Sep 1, 7:03 am, drpark webmas...@attractionland.com wrote:
 Hello,
 we are doing this for one of our customer.

 We have 4 cake directory structures pointing with virtual directories
 for /models, /controllers, and /views
 In each of these we have a different database (same structure but
 different datas) and different files in webroot, locale, and tmp
 Like if it was 4 separate applications, but using the same
 models,controllers, views

 Hope this was helpful, my english is poor

 regards

 On 31 août, 04:34, Kazi Harun Or Roshid kharun...@gmail.com wrote:



  Hello Expert,

  I am new on cakephp. I want to develop our website to cakephp.  I want to
  use same application for multiple website different layout and css. and I
  want to use our existing table structure so its not follow the rules on
  cakphp table name Conventions. I dont know this way it will be work or not?
  and how I make folder structure?

  Advance thanks
  Harun

Re: how to make folder stacture 4 multiple website

2010-09-01 Thread zuha
I knew I was going to forget something...


In /app/views/layouts/default.ctp I use code like this to instruct my
apps to look for the default css, js, img etc like this...


# allow over writing of favicon file
if (file_exists($_SERVER['HTTP_HOST'].'/favicon.ico')) {
echo 'link href='.$_SERVER['HTTP_HOST'].'/favicon.ico
type=image/x-icon rel=icon /';
} else {
echo $this-Html-meta('icon');
}

# allow over writing of main css file
if (file_exists($_SERVER['HTTP_HOST'].'/css/screen.css')) {
echo 
$this-Html-css($_SERVER['HTTP_HOST'].'/css/screen');
} else {
echo $this-Html-css('/css/screen');
}


Then if I need a new css file to control the system wide default.ctp I
only need to create that css file and nothing else in /app/webroot/
mydomain.com/css/screen.css



On Sep 1, 11:10 am, zuha slickri...@gmail.com wrote:
 I just did this and though I don't think its my ideal and perfect
 situation, I do it like this (hope I don't forget anything)

 1. Create a folder called /sites
 2. Put directories in that folder that match the host name of the the
 site (ie. mysite.localhost OR mysite.com OR subdomain.mysite.com)
 3. By default I copy the /app/config, /app/locale/, /app/tmp folders
 from /app into those new directories.
 4. Then inside of /app/webroot I create another directory named after
 the site host name (ie. /app/webroot/mydomain.com)

 Intermission NOTE :  I create /sites/mydomain.com in order to hold
 custom controllers, models and views and overwrite my main /app
 controllers models views in case I need something custom for one of
 those sites.  (So I'm using the same /app unless its absolutely
 necessary to make a one off mvc custom for a site)   I create /app/
 webroot/mydomain.com so that I can easily have custom js, css, and img
 for each site.  Back to step by step (here's where the magic
 happens)...

 5.  Open /app/webroot/index.php and change the definition of APP_DIR
 to this...

         if (!defined('APP_DIR')) {
                 /* enable this if you want to support multiple domains or 
 sites */
                 define('APP_DIR', 'sites'.DS.$_SERVER['HTTP_HOST']);
                 /* disable this if you want to support multiple domains or 
 sites */
                 #define('APP_DIR', basename(dirname(dirname(__FILE__;
         }
                 define('IMAGES_URL', '');
                 define('CSS_URL', '');
                 define('JS_URL', '');

 6. Open bootstrap.php in each site you have a /sites/mydomain.com/
 config/bootstrap.php file and add this...  (this is where you tell it
 to look for your custom mvc files first and if they don't exist then
 use the main mvc files that all of your sites use)

 App::build(array(
         'plugins' = array(
                 $_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'plugins'.DS,
                 $_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'plugins'.DS
                 ),
     'models' =  array(
                 $_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS,
                 $_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS
                 ),
     'views' = array(
                 $_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'views'.DS,
                 $_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'views'.DS
                 ),
         'controllers' = array(
                 $_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'controllers'.DS,
                 $_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'controllers'.DS
                 ),
     'datasources' = array(

 $_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS.'datasources'.DS,
                 
 $_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS.'datasources'.DS
                 ),
     'behaviors' = array(
                 
 $_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'models'.DS.'behaviors'.DS,
                 
 $_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'models'.DS.'behaviors'.DS
                 ),
     'components' = array(

 $_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'controllers'.DS.'components'.DS,

 $_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'controllers'.DS.'components'.DS
                 ),
     'helpers' = array(
                 
 $_SERVER['DOCUMENT_ROOT'].DS.APP_DIR.DS.'views'.DS.'helpers'.DS,
                 $_SERVER['DOCUMENT_ROOT'].DS.'app'.DS.'views'.DS.'helpers'.DS
                 ),
 #  You could probably do these too, I just haven't had a need for them
 yet.
 #   'vendors' = array('/full/path/to/vendors/', '/next/full/path/to/
 vendors/'),
 #   'shells' = array('/full/path/to/shells/', '/next/full/path/to/
 shells/'),
 #   'locales' = array('/full/path/to/locale/', '/next/full/path/to/
 locale/')
 ));

 7.  Go tohttps://cakeforge.org/projects/zuha/and become a member so
 that you can download a functional version of this and tons more pre-
 alpha code (like a CRM, Project

Re: Getting back 1.2 plugin routing in 1.3 :: (1.3.3 to be exact) :: Round 1

2010-09-01 Thread zuha
I take it back.  This only works consistently if you always leave
debug set to 2.  If you turn debug mode off for any extended period of
time (1 day) all the page not found errors appear again.  What kind of
routing only works when you have debug mode on?



On Sep 1, 10:14 am, zuha slickri...@gmail.com wrote:
 Okay, so I know that 1.3 eliminated the old plugin routing that
 automagically made it the double reference to plugins/controllers
 disappear.   Ie. /admin/projects/projects/view/1 was automagically /
 admin/projects/view/1.

 So I've been trying to get it back for like a week now, and have it
 pretty well done, but something very strange is going on and I was
 wondering if anyone might have some ideas to push me in another
 direction.

 Situation Summary :  Routing works in most cases, but if debug mode is
 off (ie. set it to 0 in core.php) after a new repository publish
 almost no pages work until I turn on debug mode (set to 2) and refresh
 almost exactly 3 times.   After that it works with debug mode set back
 to zero.   So its obviously some caching issue, but boy is it annoying
 to be working on a project for the first time since publishing a repo
 commit and save some changes and have all of those changes be lost
 because I didn't run the add function three times in full debug mode
 to update the cache.

 Routing Code :

         # shorten up plugin urls
         $controllerKey = false;
         $prefixedPluginKey = false;
         $urlPieces = explode('/', $fromUrl);
         $plugins = App::objects('plugin');
         $pluginKey = array_search(Inflector::camelize($urlPieces[0]),
 $plugins);
         if (!empty($urlPieces[1])) $prefixedPluginKey =
 array_search(Inflector::camelize($urlPieces[1]), $plugins);
         # lets do non-admin or prefixed first
         if ($pluginKey !== false) {
                 # and check if the next url piece is a controller or an 
 action or if
 it even exists
                 $plugin = strtolower($plugins[$pluginKey]);
                 if (!empty($urlPieces[0])) {
                         $pluginPath = App::pluginPath($plugin);
                         $controllers = App::objects('controller',
 $pluginPath.'controllers');
                         $controllerKey = 
 array_search(Inflector::camelize($urlPieces[1]),
 $controllers);
                         if ($controllerKey !== false) {
                                 $controller = $controllers[$controllerKey];
                                 
 Router::Connect('/'.$plugin.'/:controller/:action/*',
 array('plugin' = $plugin, 'controller' = $controller));
                         } else {
                                 $controller = $plugin;
                                 Router::Connect('/'.$plugin.'/:action/*', 
 array('plugin' =
 $plugin, 'controller' = $controller));
                         }
                 }
         } else if ($prefixedPluginKey !== false) {
                 # now lets do admin
                 $plugin = strtolower($plugins[$prefixedPluginKey]);
                 if ($urlPieces[0] == 'admin') {
                         $pluginPath = App::pluginPath($plugin);
                         $controllers = App::objects('controller',
 $pluginPath.'controllers');
                         if(!empty($urlPieces[2])) $controllerKey =
 array_search(Inflector::camelize($urlPieces[2]), $controllers);
                         if ($controllerKey !== false) {
                                 $controller = $controllers[$controllerKey];
                                 
 Router::Connect('/admin/'.$plugin.'/:controller/:action/*',
 array('plugin' = $plugin, 'controller' = $controller, 'admin'=
 true));
                         } else {
                                 $controller = $plugin;
                                 
 Router::Connect('/admin/'.$plugin.'/:action/*', array('plugin' =
 $plugin, 'controller' = $controller, 'admin'= true));
                         }
                 }
         }

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en