Re: Need cakePHP project

2012-01-16 Thread Hung
Hello Thanks ! Pls check your email i sent my portfolio link to you ! On Jan 15, 7:26 pm, gimmebucks sapew...@gmail.com wrote: Can i see your sample works(portfolio). On Jan 14, 1:03 pm, Hung quochung@gmail.com wrote: Hi everyone ! I am Hung in Viet Nam,  I have strong

Some doubts regarding associations in CakePHP

2012-01-16 Thread Angad Nadkarni
Hi I've got a couple of questions regarding associations and how they play in cases of complex find() calls. If I've got a model Post and a model Comment with the latter having a parent_id field and I want to fetch a post with its associated comments threaded, do I simply perform a

how to use media views to count downloads

2012-01-16 Thread ahmed fakher
i see this doc page and i think it can help me to count downloads but i don't understand how to count with this media views http://book.cakephp.org/1.3/en/view/1094/Media-Views this code for extract files dir and title...the user download when clicked the file link..i need to count number of

Re: Need cakePHP project

2012-01-16 Thread Elisio Leonardo
Why not publish the link here for everyone to see, instead of send only by email? -- 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

Re: how to use media views to count downloads

2012-01-16 Thread Muhaimen Ezabbad
Fakher, the $filename, or the download id should be an argument to the download action, then from the download action you can use the Media view and store the download counter in the database or anywhere you want to track the downloads count. regards __ Muhaimen

Re: Users can only edit or delete themselves

2012-01-16 Thread J.
Ok, so here is my User model : public function isEditable($id) { if ($this-Auth-user('role') == 'admin') { // if they are admin, so return the original id they wanted to edit return $id; } // if they

Re: Some doubts regarding associations in CakePHP

2012-01-16 Thread euromark
did you try it? and yes, you should always prefix field names to avoid collisions. On 16 Jan., 11:04, Angad Nadkarni angad.nadka...@gmail.com wrote: Hi I've got a couple of questions regarding associations and how they play in cases of complex find() calls. If I've got a model Post and a

Re: SwiftMailer Component not working CakePHP 2.0.5

2012-01-16 Thread majna
require APP . ' Vendor' . DS . 'Swift' . DS . 'lib' . DS . 'swift_required.php'; What i wrong with that? -- 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

Re: how to use media views to count downloads

2012-01-16 Thread ahmed fakher
thanks Muhaimen Ezabbad for reply ..but can you give me one example because i am newbie in cakephp -- 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

Re: Users can only edit or delete themselves

2012-01-16 Thread jeremyharris
Sorry, I forgot the $this keyword like a dummy $id = $this-isEditable(); on line 60 or anywhere else you call isEditable -- 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

Re: Some doubts regarding associations in CakePHP

2012-01-16 Thread jeremyharris
To answer your second question, yes, you prefix using the association name. So, if you have a User model and then later a Creator association that references the user model, you would use Creator as the model name. It would also appear like that in the results. This allows you to have a single

Unable to save using model-save()

2012-01-16 Thread 24hours
model: class Art extends AppModel { public $name = 'Art'; } controller: class ArtsController extends AppController { public $name = 'Arts'; public function add(){ if($this-request-is('Post')){ pr($this-Art-save($this-request-data));

Re: Users can only edit or delete themselves

2012-01-16 Thread Tilen Majerle
from when can you use AuthComponentn as $this-Auth in model ? :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/1/16 jeremyharris funeralm...@gmail.com Sorry, I forgot the $this keyword like a dummy $id = $this-isEditable(); on line 60 or anywhere else you call isEditable -- Our

Re: Unable to save using model-save()

2012-01-16 Thread jeremyharris
Check the SQL log (use DebugKit or the element). Does it say it's saving there? Are you checking the right database and host to see if the data is in there? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site

Re: Users can only edit or delete themselves

2012-01-16 Thread jeremyharris
I didn't notice that he said model. Yeah you want that in your controller, probably. -- 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

CakePHP 2.x - Call to undefined method View::fetch()

2012-01-16 Thread Anna P
Hello. I'm starting to build an app on CakePHP 2.x - I have been using version 1.2 since now. I downloaded the 2.0.5 Stable version, set it up on my localhost, created DB with simple table 'subpages' and Subpage model, created simple layout with couple of html tags and: body ?php echo

Re: CakePHP 2.x - Call to undefined method View::fetch()

2012-01-16 Thread Tilen Majerle
of course, View::fetch() is available since 2.1, but you have 2.0.5 use $content_for_layout instead -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/1/16 Anna P apad...@o2.pl Hello. I'm starting to build an app on CakePHP 2.x - I have been using version 1.2 since now. I downloaded

How do I find a DB entry with AT LEAST one sub-entry through HABTM?

2012-01-16 Thread Kosmo
Hi there, I am looking for an answer to this common problem, which I regretfully don't find out by searching - perhaps you could help me out with some answers or links... Let's say I've got a DB with tables 'cars' and 'passengers' where 'cars' habtm 'passengers' So how can I find only the

Re: Captcha reload problem

2012-01-16 Thread Daniel
I can now get it to reload the captcha, but the problem is that the users data is lost: ?php echo $this-Js-link('Can not read this code? Reload.', 'add', array('update'='captchaID')); ? ... in other words it is like refreshing the page. How can I retain the users data on the form? -- Our

Re: Captcha reload problem

2012-01-16 Thread jeremyharris
Remember that using the 'update' key will take the content that Js link fetches and place it into the specified selector (in your case, captchaID). If the data is not persisted in the controller, it will be lost. -- Our newest site for the community: CakePHP Video Tutorials

Re: Captcha reload problem

2012-01-16 Thread Daniel
I googled cakephp data persistent and did not find any straight forward answer... so how do you keep the data persistent? -- 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

Re: Captcha reload problem

2012-01-16 Thread jeremyharris
When you submit data it is stored in $this-request-data (or $this-data in 1.3). Assuming this data is not overwritten, it is then passed to the view. The form helper sees this and automatically populates the fields. If you're not using the form helper, you will need to manually tell your

Re: Users can only edit or delete themselves

2012-01-16 Thread J.
So, Last post I hope ! Here is the UsersController : private function isEditable($id) { if ($this-Auth-user('role') == 'admin') { // if they are admin, so return the original id they wanted to edit return $id;

Re: Captcha reload problem

2012-01-16 Thread Daniel
But as I am going through the JS link, the data will not be submitted. I am using the form helper right in my add.ctp: div class=users form ?php echo $this-Form-create('User');? fieldset legend?php __('Register'); ?/legend ?php echo

Re: Users can only edit or delete themselves

2012-01-16 Thread jeremyharris
The stack traces are there to help you. It says it's missing the argument, which means you're not passing it. It's called on line 71, which will show you where you called the function without passing the argument. $id = $this-isEditable(); // no argument $id passed to the function

Re: Users can only edit or delete themselves

2012-01-16 Thread J.
I was just trying this, but it says Undefined variable: id [APP/ Controller/UsersController.php, line 71] But line 71 being$id = $this-isEditable($id); It should be defined ? Full code for help : private function isEditable($id) { if ($this-Auth-user('role') ==

Re: Captcha reload problem

2012-01-16 Thread jeremyharris
You should probably just reset the captcha element then. If you're reloading the entire /users/add view which of course will kill the data, seeing as your JS request is just a GET and not a POST. Try something like this: * * !-- captcha -- div id=captchaID ?php echo

Re: CakePHP 2.x - Call to undefined method View::fetch()

2012-01-16 Thread Anna P
Thanks very much. I've checked Cookbook again - of course I didn't notice a key information which is: New in version 2.1. : On 16 Sty, 17:01, Tilen Majerle tilen.maje...@gmail.com wrote: of course, View::fetch() is available since 2.1, but you have 2.0.5 use $content_for_layout instead --

Re: Users can only edit or delete themselves

2012-01-16 Thread jeremyharris
Look at your code. In isAuthorized you call $this-isEditable($id) without having $id defined to begin with. In my example, 'delete' had an $id argument passed to it. isAuthorized doesn't know what the id of whatever model you are trying to edit... -- Our newest site for the community: CakePHP

Problem with association (3 levels)

2012-01-16 Thread pablosky
Hello, I have 3 models: Comment (belongTo) Content (belongTo) Type I need to access from model to model Type Comment: $this-Comment-find('all', array('recursive' = 2, 'fields' = array('Comment.id', 'Comment.active', 'Content.id', 'Content.slug', 'Type.slug', 'Comment.author',

Re: Problem with association (3 levels)

2012-01-16 Thread jeremyharris
You said they are both belongsTo, but then you said the second relationship is hasMany. hasMany are pulled as a separate query, so calling it like this won't work. You can, however, use containable: $this-Comment-find('all', array( 'fields' = array( 'Comment.id', 'Comment.active',

Re: Captcha reload problem

2012-01-16 Thread Daniel
On Jan 16, 5:45 pm, jeremyharris funeralm...@gmail.com wrote: ... Try something like this:                 ?php echo $this-Js-link('Can not read this code? Reload.', *array('action' = 'captcha')*, array('update'='*#captchaID*')); ? If clicked then this just causes the captcha to be redrawn on

Re: Captcha reload problem

2012-01-16 Thread jeremyharris
Then it sounds like your only option is to submit the form so it saves the data. The issue you might have with this is that reloading the captcha means actually submitting the form, which means validation errors will show up as well as reloading the captcha. If that's what you want, check out

Create own Helper and problem with create Link

2012-01-16 Thread gloop
Hello Cakephp Friends, i try to realize my own Helper, but i have a bit Problems to use the other Helper. Example 1: I must access to the AuthComponent. FIrst i try this with $this-Auth- user(); it didnt work and i found the solution to do this with: AuthComponent::user(); Seems the correct

Re: Create own Helper and problem with create Link

2012-01-16 Thread jeremyharris
Please read this section of the book regarding helpers: http://book.cakephp.org/2.0/en/views/helpers.html To use the HtmlHelper inside your helper, you need to include it: App::uses('AppHelper', 'View/Helper'); class MyHelper extends AppHelper { public $helpers = array('Html');

Custom Find Type Pagination Problem - CakePHP 2.0.5

2012-01-16 Thread Thiago Belem
I created my custom find-type with this code: https://gist.github.com/1617962 Now when i run something like *$this-paginate('Model');* on my controller i get a few warnings (the queries are executed): *Notice* (8): Undefined index: count [*/var/www/cakephp/2.0/lib/Cake/Model/Model.php*, line

Re: Create own Helper and problem with create Link

2012-01-16 Thread gloop
Hi there, i do this, but i overwrite the __construct function. And get this error. Now i write: function __construct(View $view, $settings=array()){ parent::__construct($view, $settings); //other stuff } and all works!!! Yeah many thanks :) On 17 Jan., 01:30, jeremyharris