Re: Change find type for contained model and other questions

2010-05-15 Thread ramonmaruko
Did it using:

$keys = array();
$values = array();

foreach($question['Choice'] as $choice) {
array_push($keys, $choice['id']);
array_push($values, $choice['choice']);
}
$choices = array_combine($keys, $values);

The above code is located inside the view... would the controller be a
more appropriate place to put it?
The 'original' choices are still inside the $questions array,
unmodified. If anyone knows a better approach, please post it. Thank
you.

On May 15, 1:42 am, ramonmaruko  wrote:
> I have the following model associations:
>
> Response->Survey
> Response->Question
> Response->Choice
> Survey->Question
> Question->Choice
>
> I want to create a form where I could answer all the questions for one
> survey. So I used the following to return the needed data:
>
> $questions = $this->Response->Question->find('all',
> array(
>          'conditions' => array('survey_id' =>
> $id),
>          'contain' =>
> array('Choice')
>         )
> );
>
> Sample debug($questions) is athttp://pastebin.com/AL6kNjnC
>
> Questions:
>
> (1) What should I do so that the Choice index returns a find('list')
> format e.g.http://pastebin.com/mMASg1HYso that I could do:
>
> foreach($question as $questions) {
>     $this->Form->select('0.question', $question['Choice']);
>
> }
>
> (2) Is there any way to just use $this->Form->input() to automagically
> create the multiple select fields for the Question->Choice combo?
>
> e.g.
>
> (1) What is your name?
>                        |-||
>                        |Marco||
>                        |-||
>                        |Marie ||
>                        |Myka ||
>                        |-||
>
> (2) Babs si Marie?
>                        |-||
>                        |Yes   ||
>                        |-||
>                        |No     ||
>                        |-||
>
> FWIW, I have $recursion = -1 in my AppModel.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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: Cake tags

2010-05-15 Thread Ed Propsner
@jeremy

I'll kick it around a bit more sometime later today. I tried a few
variations of your suggestion and although I think it *might* work as well,
I only created a whole different set of issues. I don't have the patience
for it right now :)

On a side note, here are a couple really easy ones for ya': (perhaps I
should ask when I'm a bit more coherent because I'm sure the answer is
obvious in the documentation) Anyhow,

Router::url -> Is set to accept /pages/my-page in lieu of /pages/myPage.
Clicking next in pagination directs you back to /pages/myPage. I have the
Router:: set up incorrectly don't I?

Even easier yet  where should i be looking to find the answer on
defining a path relative to the App? I was looking through the Folder Class
but not seeing what I was looking for. I'm defining them now locally
C:/foo/bar/webroot/img/temp/some_image.jpg. Obviously this will present an
issue when uploading to remote host. I came across the answer to this some
time ago but for the life of me I can't remember where. I know it was
something easy and I'm sure I'll feel like an idiot when I find the answer.

I'll let you know how I make out with the nested loop.

- Ed

On Sat, May 15, 2010 at 6:20 AM, Jeremy Burns  wrote:

> So could you do a nested loop that:
>
>
>1. Steps through your images until they are are processed
>   1. foreach $num_of_cols (or remaining images if less) adds a value
>   to an array (the new value being your td contents)
>   2. Adds blank cells if this row is only half full because the images
>   are processed
>   3. echo $this->Html->tableCells( array( array( $your_td_array ) ) );
>
>
> I haven't tried this, but it *might* work?
>
> Jeremy Burns
> jeremybu...@me.com 
>
>
> On 15 May 2010, at 10:34, Ed Propsner wrote:
>
> $num_of_cols = 6;
>
> echo
> $html->tag('table', null, array(
>   'cellspacing' => 0,
>   'cellpadding' => 5,
>   'border' => 0
>   )
>)
> .$html->tag('tr');
>
> foreach($photos as $photo)
> {
> echo ($i!= 0 && $i%$num_of_cols == 0)?'':'';
> echo $html->tag('td', null, array(
>   'valign' => 'top'
>  )
> )
> .$html->tag('a href="/photos/view/'.$photos[$j++]['Photo']['id'].'"')
> .$html->tag('img', null, array(
>   'src' => Router::url(array(
>'controller' => 'photos',
>'action' => 'displayPhotos/'.$photos[$k++]['Photo']['id']
>   )
>   ),
>   'height' => 90
>  )
>)
> .$html->tag('/a')
> .$html->tag('/td');
> $i++;
> }
>
> echo $html->tag('/tr')
> .$html->tag('/table');
>
>
>  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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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: Sorting using HABTM Join Table's additional field

2010-05-15 Thread Bogdan Bursuc
Try using Containable, it may help you:
http://book.cakephp.org/view/1323/Containable

Try doing something like: $this->Category->find('all', array('contain' =>
array('Post' => array('order' => 'CategoriesPost.postorder';

On Sat, May 15, 2010 at 1:25 PM, ashok.b  wrote:

> If I add a order column in Posts, then I won't be able to order the
> posts per category... What ever order I set to a post will be
> applicable across all categories that post is linked to... I'm looking
> for per category ordering of posts.
>
> On May 15, 8:55 am, Bogdan Bursuc  wrote:
> > Add in your Post Model
> >
> > class Post extends AppModel {
> >  var $order = 'CategoriesPost.postorder';
> >
> > }
> >
> > Anyway I wouldn't do it like so. I would just add an order field on the
> Post
> > model. It's easier.
> >
> >
> >
> > On Sat, May 15, 2010 at 1:24 AM, ashok.b  wrote:
> >
> > > Hello Cake Gurus, here's my problem:
> >
> > > Table1: Posts
> >
> > > id - int
> > > title - varchar
> >
> > > Table2: Categories
> >
> > > id - int
> > > name - varchar
> >
> > > HABTM JoinTable: categories_posts
> >
> > > id - int
> > > post_id - int
> > > category_id - int
> > > postorder - int
> >
> > > As you can see, the join table contains a field called 'postorder' -
> > > This is for ordering the posts in a particular category. For example,
> >
> > > Posts: Post1, Post2, Post3, Post4
> > > Categories: Cat1, Cat2
> > > Ordering:
> > > Cat1 - Post1, Post3, Post2
> > > Cat2 - Post3, Post1, Post4
> >
> > > Now in CakePHP,
> >
> > > $postpages = $this->Post->Category->find('all');
> >
> > > gives me a array like
> >
> > > Array
> > > (
> > >  [0] => Array
> > >(
> > >  [Category] => Array
> > >(
> > >  [id] => 13
> > >  [name] => Cat1
> > >)
> > >[Post] => Array
> > >(
> > >  [0] => Array
> > >  (
> > >[id] => 1
> > >[title] => Post2
> > >[CategoriesPost] => Array
> > >(
> > >  [id] => 17
> > >  [post_id] => 1
> > >  [category_id] => 13
> > >  [postorder] => 3
> > >)
> > >  )
> > >  [1] => Array
> > >  (
> > >[id] => 4
> > >[title] => Post1
> > >[CategoriesPost] => Array
> > >(
> > >  [id] => 21
> > >  [post_id] => 4
> > >  [category_id] => 13
> > >  [postorder] => 1
> > >)
> > >  )
> >
> > >)
> > >)
> > > )
> >
> > > As you can see [Post], they are not ordered according to
> > > [CategoriesPost].postorder but are ordered according to
> > > [CategoriesPost].id. How can I get the array ordered according to
> > > [CategoriesPost].postorder?
> >
> > > The Queries from Cake's SQL Log are:
> >
> > > SELECT `Category`.`id`, `Category`.`name` FROM `categories` AS
> > > `Category` WHERE 1 = 1
> >
> > > SELECT `Post`.`id`, `Post`.`title`, `CategoriesPost`.`id`,
> > > `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id`,
> > > `CategoriesPost`.`postorder` FROM `posts` AS `Post` JOIN
> > > `categories_posts` AS `CategoriesPost` ON
> > > (`CategoriesPost`.`category_id` IN (13, 26, 27, 28, 29, 30, 31, 32,
> > > 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
> > > 50, 51, 52) AND `CategoriesPost`.`post_id` = `Post`.`id`)
> >
> > > What I am looking for is how to make cake put a Order By
> > > CategoriesPost.postorder in that second SELECT SQL Query.
> >
> > > Thanks in advance for your time :)
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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
> >
> > --
> > Bogdan Iulian Bursuc
> >
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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.comFor
> >  more options, visit this group athttp://
> groups.google.com/group/cake-php?hl=en
>
> 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.comFor
>  more options, visit this group at
> http://group

Re: PHP CodeSniffer

2010-05-15 Thread Kei Simone
I second this. though i found the github code for code_check and
autotest. i think having 1 for Php_codesniffer would be a very good
idea to increase cake usage as well.

Braindead wrote:
> Hi Achilleas,
>
> you are right that CodeSniffer validates your code to make sure that
> it follows certain conventions. It is possible to define a validation
> set that reflects CakePHPs conventions. If your code doesn't follow
> these conventions CodeSniffer gives you a warning and you have the
> possibility to correct it (if you want to).
>
> As I'm new to CodeSniffer I thought that there must be someone who
> already uses CodeSniffer with CakePHP and who is willing to share his
> validation set with me (and anyone else ho is interested). I wonder
> how the CakePHP core developers validate for conventions?
>
> Thanks,
> Markus
>
> 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

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: Sorting using HABTM Join Table's additional field

2010-05-15 Thread ashok.b
If I add a order column in Posts, then I won't be able to order the
posts per category... What ever order I set to a post will be
applicable across all categories that post is linked to... I'm looking
for per category ordering of posts.

On May 15, 8:55 am, Bogdan Bursuc  wrote:
> Add in your Post Model
>
> class Post extends AppModel {
>      var $order = 'CategoriesPost.postorder';
>
> }
>
> Anyway I wouldn't do it like so. I would just add an order field on the Post
> model. It's easier.
>
>
>
> On Sat, May 15, 2010 at 1:24 AM, ashok.b  wrote:
>
> > Hello Cake Gurus, here's my problem:
>
> > Table1: Posts
>
> > id - int
> > title - varchar
>
> > Table2: Categories
>
> > id - int
> > name - varchar
>
> > HABTM JoinTable: categories_posts
>
> > id - int
> > post_id - int
> > category_id - int
> > postorder - int
>
> > As you can see, the join table contains a field called 'postorder' -
> > This is for ordering the posts in a particular category. For example,
>
> > Posts: Post1, Post2, Post3, Post4
> > Categories: Cat1, Cat2
> > Ordering:
> >     Cat1 - Post1, Post3, Post2
> >     Cat2 - Post3, Post1, Post4
>
> > Now in CakePHP,
>
> > $postpages = $this->Post->Category->find('all');
>
> > gives me a array like
>
> > Array
> > (
> >  [0] => Array
> >    (
> >      [Category] => Array
> >        (
> >          [id] => 13
> >          [name] => Cat1
> >        )
> >        [Post] => Array
> >        (
> >          [0] => Array
> >          (
> >            [id] => 1
> >            [title] => Post2
> >            [CategoriesPost] => Array
> >            (
> >              [id] => 17
> >              [post_id] => 1
> >              [category_id] => 13
> >              [postorder] => 3
> >            )
> >          )
> >          [1] => Array
> >          (
> >            [id] => 4
> >            [title] => Post1
> >            [CategoriesPost] => Array
> >            (
> >              [id] => 21
> >              [post_id] => 4
> >              [category_id] => 13
> >              [postorder] => 1
> >            )
> >          )
>
> >        )
> >    )
> > )
>
> > As you can see [Post], they are not ordered according to
> > [CategoriesPost].postorder but are ordered according to
> > [CategoriesPost].id. How can I get the array ordered according to
> > [CategoriesPost].postorder?
>
> > The Queries from Cake's SQL Log are:
>
> > SELECT `Category`.`id`, `Category`.`name` FROM `categories` AS
> > `Category` WHERE 1 = 1
>
> > SELECT `Post`.`id`, `Post`.`title`, `CategoriesPost`.`id`,
> > `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id`,
> > `CategoriesPost`.`postorder` FROM `posts` AS `Post` JOIN
> > `categories_posts` AS `CategoriesPost` ON
> > (`CategoriesPost`.`category_id` IN (13, 26, 27, 28, 29, 30, 31, 32,
> > 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
> > 50, 51, 52) AND `CategoriesPost`.`post_id` = `Post`.`id`)
>
> > What I am looking for is how to make cake put a Order By
> > CategoriesPost.postorder in that second SELECT SQL Query.
>
> > Thanks in advance for your time :)
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Bogdan Iulian Bursuc
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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: Sorting using HABTM Join Table's additional field

2010-05-15 Thread ashok.b
Didn't work :(

More over, $this->Post->find('all') starts throwing an SQL error
'CategoriesPost.postorder' not found...

On May 15, 8:55 am, Bogdan Bursuc  wrote:
> Add in your Post Model
>
> class Post extends AppModel {
>      var $order = 'CategoriesPost.postorder';
>
> }
>
> Anyway I wouldn't do it like so. I would just add an order field on the Post
> model. It's easier.
>
>
>
> On Sat, May 15, 2010 at 1:24 AM, ashok.b  wrote:
>
> > Hello Cake Gurus, here's my problem:
>
> > Table1: Posts
>
> > id - int
> > title - varchar
>
> > Table2: Categories
>
> > id - int
> > name - varchar
>
> > HABTM JoinTable: categories_posts
>
> > id - int
> > post_id - int
> > category_id - int
> > postorder - int
>
> > As you can see, the join table contains a field called 'postorder' -
> > This is for ordering the posts in a particular category. For example,
>
> > Posts: Post1, Post2, Post3, Post4
> > Categories: Cat1, Cat2
> > Ordering:
> >     Cat1 - Post1, Post3, Post2
> >     Cat2 - Post3, Post1, Post4
>
> > Now in CakePHP,
>
> > $postpages = $this->Post->Category->find('all');
>
> > gives me a array like
>
> > Array
> > (
> >  [0] => Array
> >    (
> >      [Category] => Array
> >        (
> >          [id] => 13
> >          [name] => Cat1
> >        )
> >        [Post] => Array
> >        (
> >          [0] => Array
> >          (
> >            [id] => 1
> >            [title] => Post2
> >            [CategoriesPost] => Array
> >            (
> >              [id] => 17
> >              [post_id] => 1
> >              [category_id] => 13
> >              [postorder] => 3
> >            )
> >          )
> >          [1] => Array
> >          (
> >            [id] => 4
> >            [title] => Post1
> >            [CategoriesPost] => Array
> >            (
> >              [id] => 21
> >              [post_id] => 4
> >              [category_id] => 13
> >              [postorder] => 1
> >            )
> >          )
>
> >        )
> >    )
> > )
>
> > As you can see [Post], they are not ordered according to
> > [CategoriesPost].postorder but are ordered according to
> > [CategoriesPost].id. How can I get the array ordered according to
> > [CategoriesPost].postorder?
>
> > The Queries from Cake's SQL Log are:
>
> > SELECT `Category`.`id`, `Category`.`name` FROM `categories` AS
> > `Category` WHERE 1 = 1
>
> > SELECT `Post`.`id`, `Post`.`title`, `CategoriesPost`.`id`,
> > `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id`,
> > `CategoriesPost`.`postorder` FROM `posts` AS `Post` JOIN
> > `categories_posts` AS `CategoriesPost` ON
> > (`CategoriesPost`.`category_id` IN (13, 26, 27, 28, 29, 30, 31, 32,
> > 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
> > 50, 51, 52) AND `CategoriesPost`.`post_id` = `Post`.`id`)
>
> > What I am looking for is how to make cake put a Order By
> > CategoriesPost.postorder in that second SELECT SQL Query.
>
> > Thanks in advance for your time :)
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Bogdan Iulian Bursuc
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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: Cake tags

2010-05-15 Thread Jeremy Burns
So could you do a nested loop that:

Steps through your images until they are are processed
foreach $num_of_cols (or remaining images if less) adds a value to an array 
(the new value being your td contents)
Adds blank cells if this row is only half full because the images are processed
echo $this->Html->tableCells( array( array( $your_td_array ) ) );

I haven't tried this, but it *might* work?

Jeremy Burns
jeremybu...@me.com


On 15 May 2010, at 10:34, Ed Propsner wrote:

> $num_of_cols = 6; 
> 
> echo 
> $html->tag('table', null, array(
> 'cellspacing' => 0,
> 'cellpadding' => 5,
> 'border' => 0
> )
>  )
> .$html->tag('tr');
> 
> foreach($photos as $photo)
> {
> echo ($i!= 0 && $i%$num_of_cols == 0)?'':'';
> echo $html->tag('td', null, array(
> 'valign' => 'top'
>)
>   )
> .$html->tag('a href="/photos/view/'.$photos[$j++]['Photo']['id'].'"')
> .$html->tag('img', null, array(
> 'src' => Router::url(array(
>  
> 'controller' => 'photos',
>  
> 'action' => 'displayPhotos/'.$photos[$k++]['Photo']['id']
> )
> ),
> 'height' => 90
>)
>  )
> .$html->tag('/a')
> .$html->tag('/td');
> $i++; 
> }
> 
> echo $html->tag('/tr')
> .$html->tag('/table');

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: Dealing with forms!!!!!

2010-05-15 Thread WebbedIT
Do you have any debug tools running to see if your javascript is being
loaded/executed correctly?

It appears your link should work, although I'm surprised even if it
does reload the page that it comes up with a proper cake page as your
URL array should be

array('controller'=>'users', 'action' => 'login')

not

array('action' => 'users/login')

That's an aside to your main problem though as the fact you have
'onclick'='return false ;' should stop the link from going anywhere.
I can only assume that your Modelbox.show() is having some sort of
issue which is stopping the return false; statement from being
executed.  Can you remove the Modalbox.show() command and check that
return false does stop the link working?

This should work so you need to debug what script errors occur when
you click on the link.

HTH

Paul

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: Cake tags

2010-05-15 Thread Ed Propsner
@jeremy,

The script creates a dynamic table containing images pulled from the
database. The number of columns are adjustable depending on space
requirements and the line in question ends the row and starts another when
it reaches the designated number of columns.

[code]

$num_of_cols = 6;

echo
$html->tag('table', null, array(
  'cellspacing' => 0,
  'cellpadding' => 5,
  'border' => 0
  )
   )
.$html->tag('tr');

foreach($photos as $photo)
{
echo ($i!= 0 && $i%$num_of_cols == 0)?'':'';
echo $html->tag('td', null, array(
  'valign' => 'top'
 )
)
.$html->tag('a href="/photos/view/'.$photos[$j++]['Photo']['id'].'"')
.$html->tag('img', null, array(
  'src' => Router::url(array(
   'controller' => 'photos',
   'action' => 'displayPhotos/'.$photos[$k++]['Photo']['id']
  )
  ),
  'height' => 90
 )
   )
.$html->tag('/a')
.$html->tag('/td');
$i++;
}

echo $html->tag('/tr')
.$html->tag('/table');

[/code]

On Sat, May 15, 2010 at 2:30 AM, Bogdan Bursuc wrote:

> I think you should consider taking a better look at the HtmlHelper, if you
> want all cake. It's now laughable I use it myself.
> http://api13.cakephp.org/class/html-helper
>
> On Sat, May 15, 2010 at 9:26 AM, Ed Propsner  wrote:
>
>> For most of you this is going to seem so trivial that it's almost
>> laughable so laugh if you must :)
>>
>> I wanted to see how far I could make it through a site without using a
>> single standard  ... it's all cake.
>>
>> All arguments aside, I think the gig is up.
>>
>> [code]
>>
>> foreach($photos as $photo)
>> {
>> echo ($i!= 0 && $i%$num_of_cols == 0)?'':'';
>> <--
>> echo $html->tag('td', null, array(  
>>
>> [/code]
>>
>> I can't find a way around it.
>>
>> - Ed
>>
>> 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.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>
>
> --
> Bogdan Iulian Bursuc
>
>  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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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


Auth login redirect after submit a form in a Thickbox

2010-05-15 Thread sherzo

Hi all

I tried to make a ajax login form which is loaded inside a JQuery Thickbox.
but the problem is after entering correct username and password  the
Thickbox returns to the homepage!!! how can I close the Thickbox and
redirect the parent to the homepage?
Any idea?

here is my code:


flash(); 
$session->flash('auth');?>

form(array('type' => 'post',
'class'=>'account',
'options' => array(
'model'=>'User',
'update'=>'login',
'url' => array(
'controller' => 'users',
'action' => 'login'
),
)
));  
 Kullanici Adi:
  text('User.username', array('type'=>'text',
'label'=>false));?> 
  

  
Sifre
  password('User.password', array( 'label'=>false));?>

  
  Beni Hatirla
   #TB_inline?height=400&width=630&inlineId=forgotPass Sifrenizi mi
unuttunuz? 

  

echo $form->submit('giris-yap-button.gif', array( 'class'=>'submit'));?> 

end(); ?> 


-- 
View this message in context: 
http://old.nabble.com/Auth-login-redirect-after-submit-a-form-in-a-Thickbox-tp28567085p28567085.html
Sent from the CakePHP mailing list archive at Nabble.com.

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: Cake tags

2010-05-15 Thread Bogdan Bursuc
I think you should consider taking a better look at the HtmlHelper, if you
want all cake. It's now laughable I use it myself.
http://api13.cakephp.org/class/html-helper

On Sat, May 15, 2010 at 9:26 AM, Ed Propsner  wrote:

> For most of you this is going to seem so trivial that it's almost laughable
> so laugh if you must :)
>
> I wanted to see how far I could make it through a site without using a
> single standard  ... it's all cake.
>
> All arguments aside, I think the gig is up.
>
> [code]
>
> foreach($photos as $photo)
> {
> echo ($i!= 0 && $i%$num_of_cols == 0)?'':'';
> <--
> echo $html->tag('td', null, array(  
>
> [/code]
>
> I can't find a way around it.
>
> - Ed
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Bogdan Iulian Bursuc

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: Sorting using HABTM Join Table's additional field

2010-05-15 Thread Bogdan Bursuc
Add in your Post Model

class Post extends AppModel {
 var $order = 'CategoriesPost.postorder';
}

Anyway I wouldn't do it like so. I would just add an order field on the Post
model. It's easier.

On Sat, May 15, 2010 at 1:24 AM, ashok.b  wrote:

>
>
> Hello Cake Gurus, here's my problem:
>
> Table1: Posts
>
> id - int
> title - varchar
>
> Table2: Categories
>
> id - int
> name - varchar
>
> HABTM JoinTable: categories_posts
>
> id - int
> post_id - int
> category_id - int
> postorder - int
>
> As you can see, the join table contains a field called 'postorder' -
> This is for ordering the posts in a particular category. For example,
>
> Posts: Post1, Post2, Post3, Post4
> Categories: Cat1, Cat2
> Ordering:
> Cat1 - Post1, Post3, Post2
> Cat2 - Post3, Post1, Post4
>
> Now in CakePHP,
>
> $postpages = $this->Post->Category->find('all');
>
> gives me a array like
>
> Array
> (
>  [0] => Array
>(
>  [Category] => Array
>(
>  [id] => 13
>  [name] => Cat1
>)
>[Post] => Array
>(
>  [0] => Array
>  (
>[id] => 1
>[title] => Post2
>[CategoriesPost] => Array
>(
>  [id] => 17
>  [post_id] => 1
>  [category_id] => 13
>  [postorder] => 3
>)
>  )
>  [1] => Array
>  (
>[id] => 4
>[title] => Post1
>[CategoriesPost] => Array
>(
>  [id] => 21
>  [post_id] => 4
>  [category_id] => 13
>  [postorder] => 1
>)
>  )
>
>)
>)
> )
>
> As you can see [Post], they are not ordered according to
> [CategoriesPost].postorder but are ordered according to
> [CategoriesPost].id. How can I get the array ordered according to
> [CategoriesPost].postorder?
>
> The Queries from Cake's SQL Log are:
>
> SELECT `Category`.`id`, `Category`.`name` FROM `categories` AS
> `Category` WHERE 1 = 1
>
> SELECT `Post`.`id`, `Post`.`title`, `CategoriesPost`.`id`,
> `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id`,
> `CategoriesPost`.`postorder` FROM `posts` AS `Post` JOIN
> `categories_posts` AS `CategoriesPost` ON
> (`CategoriesPost`.`category_id` IN (13, 26, 27, 28, 29, 30, 31, 32,
> 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
> 50, 51, 52) AND `CategoriesPost`.`post_id` = `Post`.`id`)
>
> What I am looking for is how to make cake put a Order By
> CategoriesPost.postorder in that second SELECT SQL Query.
>
> Thanks in advance for your time :)
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Bogdan Iulian Bursuc

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: Cake tags

2010-05-15 Thread Jeremy Burns
I do like a challenge...

Can you give a bit more context around what  you are trying to do?

Jeremy Burns
jeremybu...@me.com


On 15 May 2010, at 07:26, Ed Propsner wrote:

> For most of you this is going to seem so trivial that it's almost laughable 
> so laugh if you must :) 
> 
> I wanted to see how far I could make it through a site without using a single 
> standard  ... it's all cake. 
> 
> All arguments aside, I think the gig is up. 
> 
> [code]
> 
> foreach($photos as $photo)
> {
> echo ($i!= 0 && $i%$num_of_cols == 0)?'':''; <-- 
> echo $html->tag('td', null, array(  
> 
> [/code]
> 
> I can't find a way around it. 
> 
> - Ed 
> 
> 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

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: Javascript form validation in cakephp 1.3.0

2010-05-15 Thread Nandan Jana
Please can any one reply.

is it possible to validate a form by javascript in cake 1.3.0 . i have
used validation rules in model, but want a client side checking???

On May 14, 4:47 pm, Nandan Jana  wrote:
> Hi,
>
>       I am a php developer and i never use a frame work. Nowaday's
> frame work is must . so i search a lot in google and decided to use
> CAKEPHP.
>
>       I am using the latest stable version 1.3.0 , Try to develope a
> admin panel first and i have learned a lot about model, controller,
> layout, elements . I have developed a login panel , session
> management, template partition using elements . and  now working for
> to complete a full control panel.
>
>      i have used validation rules in the model class and the form is
> validated by server side.BUT
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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: Javascript form validation in cakephp 1.3.0

2010-05-15 Thread Nandan Jana
Please can any one reply.

is it possible to validate a form by javascript in cake 1.3.0 . i have
used validation rules in model, but want a client side checking???

On May 14, 4:47 pm, Nandan Jana  wrote:
> Hi,
>
>       I am a php developer and i never use a frame work. Nowaday's
> frame work is must . so i search a lot in google and decided to use
> CAKEPHP.
>
>       I am using the latest stable version 1.3.0 , Try to develope a
> admin panel first and i have learned a lot about model, controller,
> layout, elements . I have developed a login panel , session
> management, template partition using elements . and  now working for
> to complete a full control panel.
>
>      i have used validation rules in the model class and the form is
> validated by server side.BUT
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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