Re: HABTM saving problem - solved (I think)

2009-07-20 Thread seb

Thanks for posting the solution.

Well I've got the same problem!  But it looks like you have the fix.
However I can't quite get my head around it because in your example
you refer to $category in

$category[CandidateItem][CandidateItem][$count] = this-Category-
CandidateItem-getLastInsertID();

But where does that $category come from?  Is it the $this-data
['Category']? In which case should it be $category[Candidate]
[CandidateItem]?

Seb







On Jul 14, 10:02 pm, cc_humbry conrad.cramp...@gmail.com wrote:
 Finally sorted this for anyone else who has the sameproblem...
 iterate over my array and save each item individually. Get each id of
 inserted row and add to new data array and then save Category. This
 then creates the associations in the link table.

                                         foreach($items as $item) {
                                                 $data = array();
                                                 
 $data[CandidateItem][title] = $item;
                                                 
 $data[CandidateItem][category_id] = $categoryId;

                                                 
 $this-Category-CandidateItem-create($data);
                                                 
 $this-Category-CandidateItem-save($data);
                                                 
 $category[CandidateItem][CandidateItem][$count] = 
 $this-Category-CandidateItem-getLastInsertID();

                                                 $count++;
                                         }
                                 }
                         }
                         $this-Category-create($category);
                         $this-Category-save($category);

 not entirely sure if this is the correct 'Cake' way of doing things
 but hey, I am new to this and it works (as far as I can tell).

 Conrad

--~--~-~--~~~---~--~~
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: blog tutor not working

2008-05-08 Thread seb

 http://localhost/  points to /var/www/html/blog

 http://localhost/posts/

And what about localhost/blog/posts ?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: OT: Shitty Community

2008-05-08 Thread seb

 I feel that if someone comes to the group with a question, EVEN IF
 IT'S BEEN ASKED BEFORE, it deserves an answer, or at least a _polite_
 point in the direction of the answer

Well, IMHO, if the guys are not up to browse the list thru Google Groups 
to find the answer, I think they should stop coding anything.

I try to help as much as I can here and elsewhere. And I can see that 
most of the people not just saying 'thanxx' for being helped are very 
oftenly guys or gals not having some *very basic* knowledge in 
programming. It's boring !

This place is intented to work like a community, not as a free helpdesk.



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: blog tutor not working

2008-05-08 Thread seb

seb wrote:
 http://localhost/  points to /var/www/html/blog
 
 http://localhost/posts/
 
 And what about localhost/blog/posts ?

Ouch. Made a mistake. Forget it.

Do you have a posts_controller.php file in your controllers folder ?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting Cake build version?

2008-05-08 Thread seb

Mathew Nik Foscarini wrote:
 I hope this isn't a stupid question, but how can I check what version of 
 Cake 1.2. is installed?

There's a version.txt file located in cake core files folder.

 I also need to update my Cake 1.2 install with the latest version. When 
 copying files over top my existing install which files should not get 
 modified? are there any I should worry about, or is it safe to write 
 overwrite everything.

Well, you can overwrite all cake core files. This is harmless for your app.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RSS feeds : Something is wrong with Thunderbird

2008-05-07 Thread seb

Hi all bakers outta here !

I've built a RSS feed with the RequestHandler trick. Works like a charm 
in Firefox !

Using the same feed address with Thunderbird fails as it just displays 
the very last article I inserted in my database and not the 10 latest 
ones like in Firefox.

What's wrong ?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: RSS feeds : Something is wrong with Thunderbird

2008-05-07 Thread seb

Sliv (Tim MacAleese) wrote:
 I think your subject is the answer? :P

Damn ! :D

Well, I do not use TB a lot, at all I must admit, for RSS feeds and I 
just wanted to check is everything was okay. Obvisouly, there's a 
gremlins hidden somewhere.

Opera also fails the same way than Thunderbird
A newsfeed agregator like Akregator also fails but it displays the very 
first item from a list of 10.

I really do not understand what's happening there.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: RSS feeds : Something is wrong with Thunderbird

2008-05-07 Thread seb

Sliv (Tim MacAleese) wrote:
 Have you run this through a feed validator like http://validator.w3.org/feed/
 
 It might flag something...

Yes !

Thanxx for giving me the tip :)

I am displaying my news in their complete form on my index page, I do 
not need any 'view' action for each news. So all the links in my feed 
were pointing on my main controller == All the entries were considered 
as duplicates !

Solution = Put an anchor tag in front of each news on main page and 
that rocks  ;)

Again, many thanxx for showing me the path to ultimate wisdom.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP and Oracle... Can't get it to work :(

2008-05-07 Thread seb

 Fatal error: Call to undefined function oci_connect() in XAMPPLite
 \htdocs\cake\cake\libs\model\datasources\dbo\dbo_oracle.php on line
 144
 
 What am I doing wrong here ?

This means that you don't have the Oracle client libraries installed.

http://www.oracle.com/technology/tech/oci/instantclient/index.html

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: drop down question

2008-04-29 Thread seb

Conceptually, this can be done this way :

For the options your users should enter, enclose a textarea field inside 
a DIV that is by default on visibility:hidden CSS style.

On the dropdown, trigger the onChange Javascript event to check out if 
the 'dropdown' option is selected. If yes, change dynamically the 
visibility style of the textarea to visible using Javascript.

That should do the job !

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can Cake Do Calculated Ordered List SQL Queries?

2008-04-26 Thread seb

 Thanks - for what it's worth, I have given your post  a 5* rating on
 Google. Definitely switching from raw PHP to Cake!

Thanxx for it.

The best way to start is to study the official Cookbook doc found here :

http://manual.cakephp.org/

The simple blog tutorial just rocks

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing to RSS feed

2008-04-25 Thread seb

 my only idea would be creating an rss controller and then redirect to
 main/index.rss
 obviously that is not really pretty

Well, that's an idea but it still sounds as a workaround.

For the moment, I've created an empty rss folder at the server root and 
a .htaccess with a redirect permanent inside. Damn :D

Anyway, thanxx to everybody for taking some time ;)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: problem making a select box

2008-04-25 Thread seb

rtanz wrote:
 hi i would like to make a select box with a label and dropdown,
 default value 'Yes' and no empty value. I am trying this code but its
 not working as i want to, can you help me out?

With Cake 1.2, you should try this :

echo 
$form-input(type=select,options=array(0=No,1=Yes),selected=1));


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form data not available in controller

2008-04-25 Thread seb

 Sorry, I just meant the error message I added in my controller (the
 flash message in the else clause) i.e. cakephp doesn't think there's
 anything in $this-data.

In your controller, did you try this :

$this-Model-create();
$this-Model-save($this-data);

instead of :

$this-Model-create($this-data);
$this-Model-save();

Since you say that data are POSTed, $this-data is filled. Seems that 
something is wrong in the save part of your code.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: problem making a select box

2008-04-25 Thread seb

rtanz wrote:
 tried that and got this error
 
 Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/jpgalea/
 public_html/survey/app/views/surveys/edit.ctp on line 9

Sorry for that, I should have done a cut  paste from my own code. Made 
a typo by forgetting to enclose all things related to select field 
inside an array. Hey, this is Friday, I'm a bit tired ! :D

Here is the right syntax :

echo 
$form-input(my_field_name,array(type=select,options=array(0=NO,1=YES),selected=1));

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can Cake Do Calculated Ordered List SQL Queries?

2008-04-25 Thread seb

Mark Lawton wrote:
 Hi Everyone,
 
 I would like to switch to using Cake, but looking at
 http://manual.cakephp.org/view/66/models , I don't see an obvious way
 to ask for a calculated ordered list from a database - and these are
 indispensable to our website. Suppose, for example, one wanted the 10
 healthiest cakes: the SQL query might look like this:
 
 select price, name, 2 * protein + log(fibre) - 10 * salt - sugar - fat
 as health order by health limit 10
 
 Can somebody tell me how we would be able to do such lists in Cake,
 please?

Well, if I understand well what you want to do, this is just as basic as 
doing a Model-query or a Model-find(All)

As a result you get a set of data ordered the way you asked for it 
inside your query. Browse thru them with a simple foreach loop.

Did I missed something ?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Cake 1.2 final release date

2008-04-25 Thread seb

Well, this might have been asked a few times before but does anybody 
have any idea when 1.2 will be available as stable release ?

Yes I know  When it's done 

:D

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: problem making a select box

2008-04-25 Thread seb

rtanz wrote:
 cheers that worked perfectly, another thing while we're at it, i am
 noticing that the code works the same whether you use single or double
 quotes, is one or the other better? Sorry might be a php thing and
 nothing related to cake, im not an expert in php itself either. thanks

Using single or double quotes does not change anything. Both are string 
delimiters.

*BUT* if you use double quotes you'll be able to escape some more sequences.

Have a look at :

http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake 1.2 final release date

2008-04-25 Thread seb

 And looking at the bug list in trac, I wouldn't say there are any
 major changes in the pipeline either.  Going from 1.1 to 1.2 isn't
 totally trivial, so the sooner you get started on such a transition
 the better.  If you are waiting for a final release before making
 that change, I would re-think the strategy, and instead just go with
 the current build.

Well, I've been working with 1.2 beta since a while now. Since the very 
beginning in fact. Changes from 1.1 to 1.2 were so important that after 
2 days learning 1.1, I switched to 1.2 even there was no official doc 
yet. New Cookbook is nice and a good way to start learning :D

I've got a website working with 1.2 beta nicely and I'm currently 
working on a total recode of my good old (and rather badly coded) PHP4 
webstore

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing to RSS feed

2008-04-24 Thread seb

Hi all bakers

I succeded in generating RSS feeds following the marvelous tutorial from 
Jiri Johannes Kupiainen found on webarchives.

I'm still stuck with one thing, though. I want to route 
mydomain.com/app/rss to mydomain/app/index.php/main/index.rss

I'm trying this : 
Router::connect('/rss',array('controller'='main','action'='index.rss')); 
but this fails since there is no index.rss action in my main controller.

Anyone could help ? Thanks in advance !

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Displaying in Input Field Value of Parent Element

2008-04-24 Thread seb

 In my bill add view i've currently this entry:
 
 echo $form-input('member_id');
 
 The result is a dropdownlist with all the ID's available in the
 Members table. But here i don't want to see the ID, i want to see the
 lastname from the lastname column.

In your controller, setup the $names variable this way (assuming the 
members table has its model named Member)

$_names=$this-Member-findAll(,array(Member.id,Member.lastname),Member.lastname
 
asc); 
$this-set(names,Set::combine($_names,{n}.Member.id,{n}.Member.lastname));
 


Then, in you view :

echo $form-input('member_id',array(type=select,options=$names);

Now you should have a dropdown list with members lastnames displayed.

 In the Members table i've two columns lastname and firstname. But
 in the most cases i want to display the two names concatenated
 ($lastname . ' ' . $firstname) for this i want to store the
 concatenated string in a pseudo column completename  (to acess it
 with [member][completename]). How can i do this?

Well, I cannot understand why you want to do this...

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form data not available in controller

2008-04-24 Thread seb

 When I submit the form, the
 controller branches to display the error message in my view, along
 with the following:
 
 1 query took 2 ms
 NrQuery   Error   AffectedNum. rows   Took (ms)
 1 DESCRIBE `contacts` 6   6   2

Well, *which* error message ? It could be helpful :)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing to RSS feed

2008-04-24 Thread seb

MarcS wrote:
 try
 
  Router::connect('/rss',array('controller'='main','action'='index',
 'ext' = 'rss));
 
 I guess this ought to work

This does not work. Gives me 404 :(

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



AppController methods in CakePHP 1.2

2008-01-30 Thread Seb

Hi!

I'm just thinking about moving an App i'm working on to CakePHP 1.2 so
that I can enjoy some of the new features... I seem to have fallen at
the first hurdle though!

In my existing app (for 1.1) I define some functions in my /app/
app_controller.php for use elsewhere. E.g.:

class AppController extends Controller {
  function isAdmin() {
return isset($this-params['admin']);
  }
}

Then from my other controllers (which extend AppController), I can
have things which call it:

class SomeController  extends AppController {
  function doSomething() {
if ($this-isAdmin()) {
  // blah
}
}

This works fine in 1.1, but causes a Call to undefined method
SomeController::isAdmin() in CakePHP 1.2

I can't really think of a better way to do things like that without
duplicating lots of code (which I do my best to avoid at all times) so
would like a way to make the Controllers inherit function properly
from their parent objects...

Please help!

Thanks

Seb
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: AppController methods in CakePHP 1.2

2008-01-30 Thread Seb

I've looked into this a bit more and found that if i stick my custom
functions for AppController in:

/cake/libs/controller/app_controller.php

Then the function is visible in the sub controllers - is Cake 1.2 just
ignoring my /app/app_controller.php completely?! (also i tried putting
it in /app/controllers/app_controller.php and that didn't work
either...)

Thanks!

Seb

On Jan 30, 10:07 am, Seb [EMAIL PROTECTED] wrote:
 Hi!

 I'm just thinking about moving an App i'm working on to CakePHP 1.2 so
 that I can enjoy some of the new features... I seem to have fallen at
 the first hurdle though!

 In my existing app (for 1.1) I define some functions in my /app/
 app_controller.php for use elsewhere. E.g.:

 class AppController extends Controller {
   function isAdmin() {
 return isset($this-params['admin']);
   }

 }

 Then from my other controllers (which extend AppController), I can
 have things which call it:

 class SomeController  extends AppController {
   function doSomething() {
 if ($this-isAdmin()) {
   // blah
 }

 }

 This works fine in 1.1, but causes a Call to undefined method
 SomeController::isAdmin() in CakePHP 1.2

 I can't really think of a better way to do things like that without
 duplicating lots of code (which I do my best to avoid at all times) so
 would like a way to make the Controllers inherit function properly
 from their parent objects...

 Please help!

 Thanks

 Seb
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: AppController methods in CakePHP 1.2

2008-01-30 Thread Seb

OK, now I'm confused.

I've just got the latest nightly, put app_controller.php in /app/
app_controller.php and it seems to be working - looks like there's
something broke in the new year's build?!

Thanks for the help anyway - i'll pseudo protect my functions from
now on :D

Seb

On Jan 30, 10:30 am, grigri [EMAIL PROTECTED] wrote:
 Since a certain revision of 1.2 (not sure which one), your app
 controller must be in

 /app/controllers/app_controller.php

 NOT

 /app/app_controller.php like before

 Also note that in a controller, any 'public' method is potentially an
 action, so you should really pseudo-protect `doSomething` :

 class AppController extends Controller {
   function _doSomething() {
 // ...
   }

 }

 On Jan 30, 10:17 am, Seb [EMAIL PROTECTED] wrote:

  I've looked into this a bit more and found that if i stick my custom
  functions for AppController in:

  /cake/libs/controller/app_controller.php

  Then the function is visible in the sub controllers - is Cake 1.2 just
  ignoring my /app/app_controller.php completely?! (also i tried putting
  it in /app/controllers/app_controller.php and that didn't work
  either...)

  Thanks!

  Seb

  On Jan 30, 10:07 am, Seb [EMAIL PROTECTED] wrote:

   Hi!

   I'm just thinking about moving an App i'm working on to CakePHP 1.2 so
   that I can enjoy some of the new features... I seem to have fallen at
   the first hurdle though!

   In my existing app (for 1.1) I define some functions in my /app/
   app_controller.php for use elsewhere. E.g.:

   class AppController extends Controller {
 function isAdmin() {
   return isset($this-params['admin']);
 }

   }

   Then from my other controllers (which extend AppController), I can
   have things which call it:

   class SomeController  extends AppController {
 function doSomething() {
   if ($this-isAdmin()) {
 // blah
   }

   }

   This works fine in 1.1, but causes a Call to undefined method
   SomeController::isAdmin() in CakePHP 1.2

   I can't really think of a better way to do things like that without
   duplicating lots of code (which I do my best to avoid at all times) so
   would like a way to make the Controllers inherit function properly
   from their parent objects...

   Please help!

   Thanks

   Seb
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Displaying error messages fro validation in element

2008-01-20 Thread seb

Hi all bakers

The problem is : I have 2 columns site layout where a mailing list 
subscription block can be seen on all the pages. So I put it into en 
element.

Basically, this is just a form with text input and subscribe button, so 
I have built a mailinglist model and a mailinglist controller with an 
add function, called on subscribing the form.

Of course, model does a validation of the mail entered. If everything 
goes right, I just do a redirect to the main page. BUT if a validation 
problems occurs, controller calls by default a add view. I do not want 
this ! I just want to stay on the same page (like home, products or 
contact) where the user typed his email in the mailing list subscriber 
form and I want to display the validation error message inside the 
mailing list element.

Sounds like I have to re-render the current view (I mean HOME, 
PRODUCTS or CONTACT view) with an updated mailing list element block 
telling hey buddy, your email is wrong !

I struggle with that since 2 days. Any idea ?

Regards to all !

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



Re: finAll with recursive associated models

2008-01-08 Thread seb

francky06l wrote:
 You can use the fields option in the relation declaration (you can
 also use bindModel prior to your findAll), or use the Bindable
 behavior from Mariano in the Bakery.
 hth

Thanks Franck, I will investigate this way !


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



Nested items with HABTM

2008-01-07 Thread Seb

Hello!

I'm only just starting on the cakephp business, and so far, i'm
impressed - i've run through most of the tutorials i could find on the
web relating to cake, and the IBM ones too so got a fairly good
understanding of what's going on...

I've hit a wall though - in the thing I'm writing at the mo, there is
a tree structure (of sorts) with:

Issue - Section - Article

So, an issue hasMany(Section). Fine.
Section hasMany(Article). Still fine.
Article hasAndBelongsToMany(Article)

It's the last one that's causing problems - my article table structure
is something along the lines of:

article(id, article_id, title, body, created, modified)

so i don't have a join table to join the articles on to themselves,
the article just stores if it has a parent article or not.

I can't get this to work with the scaffolding part I'm working on at
the moment as it keeps trying to look for a articles_articles table
(which i don't think (correct me if i'm wrong) i want nor need)

Any help would be greatly appreciated!

Thanks

Seb Maynard

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



Re: Nested items with HABTM

2008-01-07 Thread Seb

This is interesting - I'd previously tried without using the HABTM
part:

class Article extends AppModel {
  var $name=Article;
  var $hasMany=array(Article);
  var $belongsTo=array(Article);
}

and let Cake deal with the automatic matching of Article names to ids
etc - you've created differently named elements, then mapped them
specifically to Article - i've just tried this and it seems to work!

Thanks for the help - if you can offer any more explanation of why/how
this works, that would be great :D

Thanks

Seb

On Jan 7, 1:22 pm, grigri [EMAIL PROTECTED] wrote:
 If your structure is really tree-like, then a HABTM relationship is
 not really useful.
 The main question to an answer is can one article have several
 parents?. As in direct parents, not hierarchy. If it can, then your
 structure is not a tree, and HABTM should be used, and you'll have to
 create a join table.

 If, as your database structure suggests, each article has one (or
 zero) parents, then the structure is tree-like and HABTM is not
 necessary. Each article hasOne parent article and hasMany child
 articles:

 class Article extends AppModel {
   var $name = Article;

   var $belongsTo = array('Parent' = array('className' = 'Article',
 'foreignKey' = 'article_id'));
   var $hasMany = array('Child' = array('className' = 'Article',
 'foreignKey' = 'article_id'));

 }

 Depending on the complexity of your structure, it might be worth
 looking at the tree behavior. However, if your nestings aren't very
 deep then this approach should work fine.

 On Jan 7, 12:50 pm, Seb [EMAIL PROTECTED] wrote:

  Hello!

  I'm only just starting on the cakephp business, and so far, i'm
  impressed - i've run through most of the tutorials i could find on the
  web relating to cake, and the IBM ones too so got a fairly good
  understanding of what's going on...

  I've hit a wall though - in the thing I'm writing at the mo, there is
  a tree structure (of sorts) with:

  Issue - Section - Article

  So, an issue hasMany(Section). Fine.
  Section hasMany(Article). Still fine.
  Article hasAndBelongsToMany(Article)

  It's the last one that's causing problems - my article table structure
  is something along the lines of:

  article(id, article_id, title, body, created, modified)

  so i don't have a join table to join the articles on to themselves,
  the article just stores if it has a parent article or not.

  I can't get this to work with the scaffolding part I'm working on at
  the moment as it keeps trying to look for a articles_articles table
  (which i don't think (correct me if i'm wrong) i want nor need)

  Any help would be greatly appreciated!

  Thanks

  Seb Maynard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Nested items with HABTM

2008-01-07 Thread Seb

Just to clarify, what i'd done (with both just pointing to Article)
didn't work and borked out with an error non-unique key Article or
something similar...

Seb

On Jan 7, 1:28 pm, Seb [EMAIL PROTECTED] wrote:
 This is interesting - I'd previously tried without using the HABTM
 part:

 class Article extends AppModel {
   var $name=Article;
   var $hasMany=array(Article);
   var $belongsTo=array(Article);

 }

 and let Cake deal with the automatic matching of Article names to ids
 etc - you've created differently named elements, then mapped them
 specifically to Article - i've just tried this and it seems to work!

 Thanks for the help - if you can offer any more explanation of why/how
 this works, that would be great :D

 Thanks

 Seb

 On Jan 7, 1:22 pm, grigri [EMAIL PROTECTED] wrote:

  If your structure is really tree-like, then a HABTM relationship is
  not really useful.
  The main question to an answer is can one article have several
  parents?. As in direct parents, not hierarchy. If it can, then your
  structure is not a tree, and HABTM should be used, and you'll have to
  create a join table.

  If, as your database structure suggests, each article has one (or
  zero) parents, then the structure is tree-like and HABTM is not
  necessary. Each article hasOne parent article and hasMany child
  articles:

  class Article extends AppModel {
var $name = Article;

var $belongsTo = array('Parent' = array('className' = 'Article',
  'foreignKey' = 'article_id'));
var $hasMany = array('Child' = array('className' = 'Article',
  'foreignKey' = 'article_id'));

  }

  Depending on the complexity of your structure, it might be worth
  looking at the tree behavior. However, if your nestings aren't very
  deep then this approach should work fine.

  On Jan 7, 12:50 pm, Seb [EMAIL PROTECTED] wrote:

   Hello!

   I'm only just starting on the cakephp business, and so far, i'm
   impressed - i've run through most of the tutorials i could find on the
   web relating to cake, and the IBM ones too so got a fairly good
   understanding of what's going on...

   I've hit a wall though - in the thing I'm writing at the mo, there is
   a tree structure (of sorts) with:

   Issue - Section - Article

   So, an issue hasMany(Section). Fine.
   Section hasMany(Article). Still fine.
   Article hasAndBelongsToMany(Article)

   It's the last one that's causing problems - my article table structure
   is something along the lines of:

   article(id, article_id, title, body, created, modified)

   so i don't have a join table to join the articles on to themselves,
   the article just stores if it has a parent article or not.

   I can't get this to work with the scaffolding part I'm working on at
   the moment as it keeps trying to look for a articles_articles table
   (which i don't think (correct me if i'm wrong) i want nor need)

   Any help would be greatly appreciated!

   Thanks

   Seb Maynard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: {n} in generateList : What does that mean ?

2008-01-07 Thread seb

 Try checking out this link, it might explain it better:
 
 http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/

Thanks for this link ! It's much more clearer for me now.


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



Re: Calling core devs for a quick brief on Admin Routing in 1.2

2007-09-19 Thread Seb

Right on! Cake is getting sweeter every day! :)

Would it help for me to raise a TRAC ticket or is it all under
control?

Thanks Chris!

Seb.

On Sep 19, 10:45 pm, Chris Hartjes [EMAIL PROTECTED] wrote:
 On 9/19/07,Seb[EMAIL PROTECTED] wrote:



  The error is; You are seeing this error because the private class
  method admin_index should not be accessed directly.
  and it happens the second we add function admin_index() {} to the
  AppController.

 Turns out that a recent commit inadvertently added in a bug that has
 declared all functions in app_controller.php to be considered private.
  I understand that a correction is on the way.

 --
 Chris Hartjes
 Senior Developer
 Cake Development Corporation

 My motto for 2007:  Just build it, damnit!

 @TheBallpark -http://www.littlehart.net/attheballpark
 @TheKeyboard -http://www.littlehart.net/atthekeyboard


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



Re: Calling core devs for a quick brief on Admin Routing in 1.2

2007-09-19 Thread Seb

Mmmm.. quick enough!

fixed in r5672 by phpnut!

Thanks heaps!

Seb.

On Sep 20, 11:28 am, Seb [EMAIL PROTECTED] wrote:
 Right on! Cake is getting sweeter every day! :)

 Would it help for me to raise a TRAC ticket or is it all under
 control?

 Thanks Chris!

 Seb.

 On Sep 19, 10:45 pm, Chris Hartjes [EMAIL PROTECTED] wrote:

  On 9/19/07,Seb[EMAIL PROTECTED] wrote:

   The error is; You are seeing this error because the private class
   method admin_index should not be accessed directly.
   and it happens the second we add function admin_index() {} to the
   AppController.

  Turns out that a recent commit inadvertently added in a bug that has
  declared all functions in app_controller.php to be considered private.
   I understand that a correction is on the way.

  --
  Chris Hartjes
  Senior Developer
  Cake Development Corporation

  My motto for 2007:  Just build it, damnit!

  @TheBallpark -http://www.littlehart.net/attheballpark
  @TheKeyboard -http://www.littlehart.net/atthekeyboard


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



Calling core devs for a quick brief on Admin Routing in 1.2

2007-09-18 Thread Seb

Hi guys,

I'd be interested to hear any of the core developers (nate, nut, gwoo
and co.) to tell me a little more about admin.routing in the latest
1.2 (atm r5669 - though the dispatcher.php was last modified in r5628)

We've ran into a few issues with using admin routing with this
version, to a point where I asked a dev to start a new app from
scratch, with the latest core and configuring admin.routing properly.
The results weren't great to tell you the least. Activating the
Admin.routing by uncommenting the Configure::write('Routing.admin',
'admin'); in the config/core.php just doesn't do it! fiddling around
raised all sorts of errors which I will not list.

Now I had a look at the code and the main problem I found was around
line 173;

// line 160-171
$prefixes = Router::prefixes();
if (!empty($prefixes)) {
if (isset($this-params['prefix'])) {
$this-params['action'] = $this-params['prefix'] . '_' . $this-
params['action'];
} elseif (strpos($this-params['action'], '_') !== false) {
list($prefix, $action) = explode('_', $this-params['action']);
$privateAction = in_array($prefix, $prefixes);
}
}
$protected = array_map('strtolower',
get_class_methods('appcontroller'));
$classMethods = array_map('strtolower',
get_class_methods($controller));

// line 173-175
if (in_array(low($this-params['action']), $protected)  ||
strpos($this-params['action'], '_', 0) === 0) {
$privateAction = true;
}


Calling /admin/controller/index  $this-params['action'] becore
admin_index at line 163 which is quite right, but then the check on
line 173 fails because $protected contains a list of *ALL* methods in
the controller.\

Anyways... we're puzzled around here...

Any body could shed some light on this?

Cheers,

Seb.


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



Re: Calling core devs for a quick brief on Admin Routing in 1.2

2007-09-18 Thread Seb

Mmmm... my dyslexia's getting quite bad ain't it... let me try again

When calling /admin/controller/index  variable $this-
params['action'] becomes
admin_index at line 163 which is quite right, but then the check on
line 173 fails because $protected contains a list of *ALL* methods in
the appcontroller, which includes admin_index.

The results is that protected_action error... saying I can't access
admin_index directly...

Cheers for the inputs!

Seb.

On Sep 18, 5:18 pm, Seb [EMAIL PROTECTED] wrote:
 Hi guys,

 I'd be interested to hear any of the core developers (nate, nut, gwoo
 and co.) to tell me a little more about admin.routing in the latest
 1.2 (atm r5669 - though the dispatcher.php was last modified in r5628)

 We've ran into a few issues with using admin routing with this
 version, to a point where I asked a dev to start a new app from
 scratch, with the latest core and configuring admin.routing properly.
 The results weren't great to tell you the least. Activating the
 Admin.routing by uncommenting the Configure::write('Routing.admin',
 'admin'); in the config/core.php just doesn't do it! fiddling around
 raised all sorts of errors which I will not list.

 Now I had a look at the code and the main problem I found was around
 line 173;

 // line 160-171
 $prefixes = Router::prefixes();
 if (!empty($prefixes)) {
 if (isset($this-params['prefix'])) {
 $this-params['action'] = $this-params['prefix'] . '_' . 
 $this-params['action'];

 } elseif (strpos($this-params['action'], '_') !== false) {
 list($prefix, $action) = explode('_', 
 $this-params['action']);
 $privateAction = in_array($prefix, $prefixes);
 }}

 $protected = array_map('strtolower',
 get_class_methods('appcontroller'));
 $classMethods = array_map('strtolower',
 get_class_methods($controller));

 // line 173-175
 if (in_array(low($this-params['action']), $protected)  ||
 strpos($this-params['action'], '_', 0) === 0) {
 $privateAction = true;

 }

 Calling /admin/controller/index  $this-params['action'] becore
 admin_index at line 163 which is quite right, but then the check on
 line 173 fails because $protected contains a list of *ALL* methods in
 the controller.\

 Anyways... we're puzzled around here...

 Any body could shed some light on this?

 Cheers,

 Seb.


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



Re: Calling core devs for a quick brief on Admin Routing in 1.2

2007-09-18 Thread Seb

Hi Adam,

Good point you're raising! Though we've been updating from that branch
for as long as the project has been going (~6months now) and it't
proved pretty good! Now that's broken more than unstable. But yeah..
awesome point.. I'll give that a try in the morning!!

Cheers mate!

Seb.

On Sep 18, 5:25 pm, Adam Royle [EMAIL PROTECTED] wrote:
 Hi Seb,

 Seems you are looking at the latest branch, which is not necessarily stable.

 Try using the trunk:

 https://svn.cakephp.org/repo/trunk

 Cheers,
 Adam

 - Original Message -
 From: Seb [EMAIL PROTECTED]
 To: Cake PHP cake-php@googlegroups.com
 Sent: Tuesday, September 18, 2007 5:18 PM
 Subject: Calling core devs for a quick brief on Admin Routing in 1.2

  Hi guys,

  I'd be interested to hear any of the core developers (nate, nut, gwoo
  and co.) to tell me a little more about admin.routing in the latest
  1.2 (atm r5669 - though the dispatcher.php was last modified in r5628)

  We've ran into a few issues with using admin routing with this
  version, to a point where I asked a dev to start a new app from
  scratch, with the latest core and configuring admin.routing properly.
  The results weren't great to tell you the least. Activating the
  Admin.routing by uncommenting the Configure::write('Routing.admin',
  'admin'); in the config/core.php just doesn't do it! fiddling around
  raised all sorts of errors which I will not list.

  Now I had a look at the code and the main problem I found was around
  line 173;

  // line 160-171
  $prefixes = Router::prefixes();
  if (!empty($prefixes)) {
  if (isset($this-params['prefix'])) {
  $this-params['action'] = $this-params['prefix'] . '_' . $this-
 params['action'];
  } elseif (strpos($this-params['action'], '_') !== false) {
  list($prefix, $action) = explode('_', $this-params['action']);
  $privateAction = in_array($prefix, $prefixes);
  }
  }
  $protected = array_map('strtolower',
  get_class_methods('appcontroller'));
  $classMethods = array_map('strtolower',
  get_class_methods($controller));

  // line 173-175
  if (in_array(low($this-params['action']), $protected)  ||
  strpos($this-params['action'], '_', 0) === 0) {
  $privateAction = true;
  }

  Calling /admin/controller/index  $this-params['action'] becore
  admin_index at line 163 which is quite right, but then the check on
  line 173 fails because $protected contains a list of *ALL* methods in
  the controller.\

  Anyways... we're puzzled around here...

  Any body could shed some light on this?

  Cheers,

  Seb.


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



Cake admin routing in 1.2.x.x DEV

2007-09-09 Thread Seb

Hi guys...

We're developing an app using 1.2, updating it as often as we can
keeping in sync with the new changes and tweaking the code as we go.
So far everything has been fairly straight forward, and no major
problem happened.

However, we updated the cake core last week, now running version
1.2.0.5427 and it seems like the admin routing has changed a fair bit,
so much that the admin routes are not even recognised anymore!

Looking at the various changes through trac, it seems this bit was
removed - which one would believe its the definition of the admin
routes... ;
174 /**
175  * Initialize the Router object
176  *
177  */
178 function __construct() {
179 if (defined('CAKE_ADMIN')) {
180 $admin = CAKE_ADMIN;
181 if (!empty($admin)) {
182 $this-__admin = array(
183 '/:' . $admin .
'/:controller/:action/*',
184 '/^(?:\/(?:(' . $admin .
')(?:\\/([a-zA-Z0-9_\\-\\.\\;\\:]+)(?:\\/([a-zA-Z0-9_\\-\\.\\;\\:]+)(?:
[\\/\\?](.*))?)?)?))[\/]*$/',
185 array($admin,
'controller', 'action'), array()
186 );
187 }
188 }
189 }

Now when trying to connect to an admin action, we get a
AdminController not found... but we never had one either!

So anyway, I understand this is the latest dev ... we're using it at
our own risks, but I'd appreciate some pointers as to what should be
updated, in our code, to work with what I believe to be a new routing
model.

Also... line 208 is the following;

if ($admin  $default == null  $route == $admin) {
}
$default = am(array('plugin' = null, 'controller' = null, 'action'
= null), $default);

I have a sneaky feeling the curly bracket might not be quite where we
want it...! ;)

Anyway... any input?

Cheers,

Seb.


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



Re: Cake admin routing in 1.2.x.x DEV

2007-09-09 Thread Seb

All right... fixed!
The configuration was changed from defining CAKE_ADMIN to calling
Configure::write('Routing.admin', 'admin'); and our coufig was not
updated for some reason.

Works like a charm now! Hope this helps anyone!

Thanks ladies! ;)

Seb.

On Sep 10, 12:04 pm, Seb [EMAIL PROTECTED] wrote:
 Hi guys...

 We're developing an app using 1.2, updating it as often as we can
 keeping in sync with the new changes and tweaking the code as we go.
 So far everything has been fairly straight forward, and no major
 problem happened.

 However, we updated the cake core last week, now running version
 1.2.0.5427 and it seems like the admin routing has changed a fair bit,
 so much that the admin routes are not even recognised anymore!

 Looking at the various changes through trac, it seems this bit was
 removed - which one would believe its the definition of the admin
 routes... ;
 174 /**
 175  * Initialize the Router object
 176  *
 177  */
 178 function __construct() {
 179 if (defined('CAKE_ADMIN')) {
 180 $admin = CAKE_ADMIN;
 181 if (!empty($admin)) {
 182 $this-__admin = array(
 183 '/:' . $admin .
 '/:controller/:action/*',
 184 '/^(?:\/(?:(' . 
 $admin .
 ')(?:\\/([a-zA-Z0-9_\\-\\.\\;\\:]+)(?:\\/([a-zA-Z0-9_\\-\\.\\;\\:]+)(?:
 [\\/\\?](.*))?)?)?))[\/]*$/',
 185 array($admin,
 'controller', 'action'), array()
 186 );
 187 }
 188 }
 189 }

 Now when trying to connect to an admin action, we get a
 AdminController not found... but we never had one either!

 So anyway, I understand this is the latest dev ... we're using it at
 our own risks, but I'd appreciate some pointers as to what should be
 updated, in our code, to work with what I believe to be a new routing
 model.

 Also... line 208 is the following;

 if ($admin  $default == null  $route == $admin) {}

 $default = am(array('plugin' = null, 'controller' = null, 'action'
 = null), $default);

 I have a sneaky feeling the curly bracket might not be quite where we
 want it...! ;)

 Anyway... any input?

 Cheers,

 Seb.


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



Re: How to reset a form when using an AJAX helper?

2007-04-12 Thread Seb

After a brief discussion on IRC, the answer to that was to use the
'complete' attribute like this;

$ajax-submit('Add', array(condition=checkLogin(),
class=button,url=/projects/$urlname/$pid/comment,
update=project_comment_list, complete=// clear your text box
content here...))

Hope this helps anyone else...

Seb.


On Apr 7, 5:45 am, Andres Monroy-Hernandez [EMAIL PROTECTED]
wrote:
 I have a form with a textarea and a submitbuttongenerated with theAJAXhelper. 
 When clicking on the submitbuttonI want to send the
 request to the server, update the corresponding HTML element *and*
 clear the textarea.

 The onClick event is already defined in the helper method as return
 false;, what is the best way to reset the form?

 This is the code that generates the ajaxified submitbutton:
 $ajax-submit('Add', array(condition=checkLogin(),
 class=button,url=/projects/$urlname/$pid/comment,
 update=project_comment_list) )


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to deal with $this-User-findById('3')['User']['name']

2007-04-07 Thread Seb

no way to do that in PHP, afaik. the { } string operators will not
operate on a function.

However if you add something like this to your app_controller;

[code]

function get($data, $member) {
if (!is_array($member)) {
$member = explode('.', $member);
}
foreach($member as $m) {
if (isset($data[$m])) {
$data = $data[$m];
} else {
trigger_error(Oups! There is no '$m' defined! 
(req:
'.implode('.',$member).'),E_USER_NOTICE);
break;
}
}
return $data;
}
[/code]


You'll be able to do something like this;

$foo = $this-get($this-User-findbyId('3'),'User.name');

and.. for efficiency's sake, you could do something like this instead;
extracts only the username... instead of the whole user obj...
$foo = $this-get($this-User-
findbyId('3',array('name')),'User.name');


Hope this helps!

Seb.


On Apr 7, 5:33 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 when code in cake,I always encounter the situation $this-User-

 findById('3')['User']['name'] ,something like that.

 but it doesn't work.I know.I used to coding like this :$foo = 
 $this-User-findById('3'); $foo['User']['name'],but I am really tired of

 that .

 so what really need to be done in php?


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



Re: CakePHP, mod_rewrite and mod_vhost_alias

2007-04-04 Thread Seb

According to http://manual.cakephp.org/chapter/installing

DocumentRoot should be /path_to_cake/app/webroot and not just /
path_to_cake/app

helps?

Seb.

On Apr 5, 1:49 am, Jason [EMAIL PROTECTED] wrote:
 I am running into some issues regarding mod_rewrite, mod_vhost_alias
 and cake. I am using the latest stable CakePHP and ran through the
 Blog tutorial. Basically, when I setup an explicit VirtualHost, it
 works. When I try to have mod_vhost_alias manage the vhost, it does
 not work. Here is the explicit vhost config:

 VirtualHost *
 Directory /Users/jwalker/dev/test
 AllowOverride All
 /Directory
 ServerAdmin [EMAIL PROTECTED]
 DocumentRoot /Users/jwalker/dev/test
 ServerName test.jwalker.coolbluebeta.com
 /VirtualHost

 If I remove the above config and enter the following, I get a 500
 error:

 VirtualDocumentRoot /Users/%2/dev/%1
 Directory /Users/*
 AllowOverride All
 /Directory

 Here is the error:

 mod_rewrite: maximum number of internal redirects reached. Assuming
 configuration error. Use 'RewriteOptions MaxRedirects' to increase the
 limit if neccessary.

 Can anyone shed some light on this issue?


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



Re: Proposal for killer app

2007-03-29 Thread Seb



On Mar 29, 3:44 pm, Loren [EMAIL PROTECTED] wrote:

 I know the people who developed this framework make me look like a
 bonafide stooge. But all that coding savvy is going to waste if this
 spiffy framework remains an inscrutable tangle of half-baked
 documentation and shallow tutorials. Documentation is no fun (I hate
 writing it, we all hate writing it), but I believe it is KEY to the
 widespread adoption of CakePHP.

 Loren

Ok... we're really getting away from the main thread here... but
somehow I can't help it thinking that in the end... we're pushing that
killer app idea somewhere. All this to say that...

Loren has a good point. I got around CakePHP pretty quick because I
had a strong IT background helping. Plus I will spend 2 days without
sleep digging when there's interest. And then I was comfortable with
the code (or php), comfortable with the pattern (MVC) and comfortable
with the platform (web). I think my learning curve was pretty flat!
Then I use to hangout in the IRC channel trying to do my bit and got
quickly sick of it because of questions like what if I want to remove
the cake logo.

As Tane was saying from a different angle, we need to make sure
documentation is kept and standards are followed religiously. I must
admit the cake code is awesome! I'm a fair bit of a purist and I
literally felt in love with it. The code is nice to a point that it
could even be harmful for the project itself! Contributing back is not
simple; suggestions are vetoe'ed without any further discussions,
enhancement are left to die in trac, which btw is filled with users
who raise a critical bug for the current stable version because some
function doesn't do what THEY want, not realising they're not calling
it properly.
... my point is, the code is very good, fairly documented, but kept on
such a tight lead that is sometimes pisses me off like I'm sure it
pisses others off. But I can live with that. ***

However, beside the tutorial, there is no or very little 'official'
documentation. I'm thinking about Once you understand that cake is
great... what's next!!?, Building applications using cake..., Cake
versus Joomla/Mambo/xoops/phpnuke... what's so different... What is
bake, what isn't it for These are obvious to all/most of us...
but not to everyone trying cake!

This brings us back to the initial thread... the killer app. With
all due respect to cake and the author of the thread, wordpress is a
great blog, joomla a great news/content management, phpBB or vBuletin
great forums, osCommerce or phpShop great shopping cart, and the list
goes on and on and on...

To eveyone who call Cake a CMS, I say you just didn't get it!

This is to say (and this may sound a bit different from my previous
posts in this thread) that Cake is not a cms, it's a framework; an
advanced development toolkit for a web environment, likely to be used
for projects. What projects need, what projects don't want to code
again is;

* Security/authentication (cake is missing docs/have incomplete
implementations),
* ORM (bugs raised in regards to that were fixed very quickly,
congrats Nate!),
* Caching (haven't looked into that aspect of cake much, but I believe
caching the model might not be enough),
* Session management (.NET is still way ahead... cookie or cookie-
less...),
* RAD (Cake is a great starting point, but over 60% of admin views are
pretty much all the same!)

It might even be worth having a big notice on cake's homepage saying
Cake will not build a website FOR you, it will help YOU DO IT!.

Anyways... sorry about the long post!... and.. that's my 2c btw...
don't bother flaming!

Seb.

*** coming back to the code and contributing... judging by the length
of posts, some of us CAN write here. Personally, a while ago I was
even willing to put a few hours a week, sometimes a day to push things
forward. But the process of convincing 'the project' something could
be worth it down the track is just too time consuming). I gave up (and
have been involved in open source projects before, never seen such a
strong objection to change). So.. when I have the opportunity of doing
something I'm good at (writing code or documentation) to help out or
charge a few hundred $/h for my services... sometimes the choice is
just too obvious!

so anyway... again, my 2 c!


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



Re: Proposal for killer app

2007-03-29 Thread Seb



On Mar 29, 2:47 pm, Dr. Tarique Sani [EMAIL PROTECTED] wrote:

 Just build it, damnit!

 :P

 Tarique



Heheheh!! funny indeed! a little bit like a business I use to work
for! They would talk about things for ages... and never make any
decision which would involve long term risk, or require a vision!
Successful businesses are a lot about taking risk? no! Businesses are
a lot about taking intelligent/knowledgeable risks!

Same here... build it?! build what? we don't even know what we're
building!

anyway... not flaming here, just explaining my views! ;)

:oÞ

Cheers,

Seb.


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



Re: Link / URL Best Practices

2007-03-29 Thread Seb



On Mar 30, 11:12 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 ?=$value? will echo $value to the page
 Basically it's the same as ?php echo $value; ? but much quicker to
 type.


And depends on a php config, so you code may not work if you move it
to a differently configured server!

Just so that everyone know!

Seb.


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



Re: Proposal for killer app

2007-03-28 Thread Seb

I haven't looked at the 1.2 component throughly enough, but as far as
I know, no components support this;

groups
permissions
users
group_permissions
user_permissions

and because you don't want to define 150 000 permissions, you need url
based (/admin/users/*) permissions and itemized
(published_revised_article) permissions.

As for Nate's idea,
Here's a model;
We're working on this; http://www.mydr.com.au/v2/physical_diagram_(draft).png
(note the 'draft' status!)
I'm fine with adapting it and generalizing it a bit more (ie,
replacing enums by properly modeled tables).
But then if you think that could become an interesting 'starting
point', I could have a chat with the business and contribute it back
if we get help from a few dev. I believe this could be a fair
agreement. The business has agreed to fund and allocate resources to
rebuild the site, work quoted to between 225 000 and 350 000$ by
outsourcing companies, and so this will go forward.

Any feed back welcome!

Seb.

On Mar 29, 5:00 am, digital spaghetti
[EMAIL PROTECTED] wrote:
 Another point I forgot to make is I see a lot of people re-inventing
 the wheel.  How many different Auth components are there out there
 (not to mention the official one in 1.2) for example.  [...]

 Tane


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



Re: Proposal for killer app

2007-03-28 Thread Seb

That I have to agree with, entirely. However the web is growing
heavily from the new 'half-computer-literate' generations.

I have build myself a very simple 'page management', where our various
clients can simply edit a web 'page' (no concept of articles, news,
content_type whatsoever). It's just an on or off page, with minimal
admin security.

Where it becomes interesting and that's where I see a point in having
a good starting point for Cake users, is that when a client wants
something more, cake makes my life so easy. Then a user wants
something more, it'd be pretty straight forward to add it, or have
someone to. The point is they got started with Cake and will keep
using it.

Anyway, I realize the project I posted above might be too big ...

anyways.. my 2c!

Seb.

On Mar 29, 5:02 am, John David Anderson [EMAIL PROTECTED]
wrote:
 On Mar 28, 2007, at 12:49 PM, digital spaghetti wrote:

 This is my own personal take, but I don't think CakePHP is in the
 same category as Wordpress, Drupal, etc. There is a significant
 difference between a CMS and an Application Framework. CakePHP isn't
 a content mangement system, though it's pretty easy to create one
 using it.

 We're not aiming for end users, we're aiming for developers.


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



Re: Proposal for killer app

2007-03-28 Thread Seb

Oh.. and.. last point, last post... Tane, I second retty much
everything you said so far. You and I have the same vision of IT,
system design and collaborative work apparently!

;)

SEb.


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



Re: How to measure Loading time in AJAX for each div

2007-03-27 Thread Seb

Ajax is 'asynchrounous', meaning you can have many calls at the same
time, meaning you would require multiple start/end time to get what
you want. I could tell you how in a few paragraphs, but the short
answer is much better and way simpler;

1. Get Firefox
2. Get Firebug (and addon to firefox)

the process is easy; visit your page using firefox, click the profile
button in firebug, then do whatever ajax call, script operation,...
you want, and finally click profile again.

You will see information avour the scripts run, how long it took, what
(ajax) calls were made, and how long it took for the response to come
back.

I've been using that Profiler for a while.. and I'd doubt you'd need a
custom profiler! ;)

Hope this help!

Seb.

On Mar 28, 2:01 pm, skyblueink [EMAIL PROTECTED] wrote:
 Next snippet is supposed to show 10 divs, each displays the loading
 time. Loading time is the difference between endTime and startTime:
 startTime and endTime was given by javascript Date.getTime method at
 the time of 'loading' and 'complete' for each run of $i. But the
 calculated time is always 0, that is startTime and endTime are always
 the same values in the php for loop.
 I'm a newbie programmer and this might be a silly question, but I'd
 really like to know how to get load time in VakePHP AJAX operation.
 The action url '/test/content/?i=$i' usually takes 5 seconds for
 loading, but it is not reflected in the loadTime below.

 script type=text/javascript
 var now = new Date();
 /script

 ?php
 for ($i = 0; $i  10; $i++){
  $view = 'view' . $i;
  echo div id=$view/div;

 $options = array(
  'update'   = $view,
  'url'  = /test/content/?i=$i,
  'type' = 'asynchronous',
  'loading'  = Element.hide($view);startTime=now.getTime();,
  'complete' =
 Effect.Appear($view);endTime=now.getTime();loadTime=endTime-
 startTime;Element.update('$view','$i'+':'+loadTime);
  );

 echo 
 $javascript-event('window','load',$ajax-remoteFunction($options),false);
 }

 ?


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



(My)SQL functions in 1.2.0.4605alpha

2007-03-20 Thread Seb


I've been pulling my hair out for a few days trying to find out
whether I was doing something wrong...

I have this 'records filtering' in place:

[code]
$filter = LOWER(Article.title) LIKE 'a%';
// ... more stuff... then I do a...
$this-Article-findAll($filter);
[/code]

Now in version 1.2.0.4605, the generated sql is: (field list stripped
down to * for argument sake)
SELECT * FROM `articles` AS `Article` WHERE LOWER `Article`.`title`)
LIKE 'a%' ORDER BY `Article`.`title` ASC LIMIT 10
Notice how the first '(' for the MySQL LOWER function gets stripped
off? obviously, that's not valid SQL.

My question is... is that something I'm doing wrong from 4605 or is
this a bug.. (the same code use to work like a beauty in previous
releases.

Can anyone comment that?

I've raised a ticket last week.. with no feedbak/comment/log/attention
https://trac.cakephp.org/ticket/2256

Cheers,

Seb.


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



Re: (My)SQL functions in 1.2.0.4605alpha

2007-03-20 Thread Seb

Additionally, could any one else using the latest SVN try that out...
to see if i'm just freaking out...?!

Thx!

On Mar 21, 2:58 pm, Seb [EMAIL PROTECTED] wrote:
 I've been pulling my hair out for a few days trying to find out
 whether I was doing something wrong...

 I have this 'records filtering' in place:

 [code]
 $filter = LOWER(Article.title) LIKE 'a%';
 // ... more stuff... then I do a...
 $this-Article-findAll($filter);
 [/code]

 Now in version 1.2.0.4605, the generated sql is: (field list stripped
 down to * for argument sake)
 SELECT * FROM `articles` AS `Article` WHERE LOWER `Article`.`title`)
 LIKE 'a%' ORDER BY `Article`.`title` ASC LIMIT 10
 Notice how the first '(' for the MySQL LOWER function gets stripped
 off? obviously, that's not valid SQL.

 My question is... is that something I'm doing wrong from 4605 or is
 this a bug.. (the same code use to work like a beauty in previous
 releases.

 Can anyone comment that?

 I've raised a ticket last week.. with no 
 feedbak/comment/log/attentionhttps://trac.cakephp.org/ticket/2256

 Cheers,

 Seb.


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



Re: Multiple Paths for Models/Views/Controllers in paths.php

2007-02-23 Thread Seb

for the record... in bootstrap.php, you can use

$modelPaths
$viewPaths
$controllerPaths
$helperPaths
$componentPaths
$behaviorPaths

To add one or more paths to be looked up.

I've submitted a patch (dams simple) to add additional paths for
vendors (so that a vendor be reused across multiple projects) and I
have the weird feeling it's going to fall through the cracks! So
anyway!
The future will tell us!


On Feb 23, 2:58 pm, Mariano Iglesias [EMAIL PROTECTED]
wrote:
 Regarding point 1 below: I was looking at loadModels(), but loadModel() has
 the same:

 function loadModel($name = null) {
 // ...

 if (!is_null($name)  !class_exists($name)) {
 $name = Inflector::underscore($name);
 $paths = Configure::getInstance();

 foreach($paths-modelPaths as $path) {
 if (file_exists($path . $name . '.php')) {
 // ...
 }
 }
 }

 }

 -MI

 ---

 Remember, smart coders answer ten questions for every question they ask.
 So be smart, be cool, and share your knowledge.

 BAKE ON!

 blog:http://www.MarianoIglesias.com.ar

 -Mensaje original-
 De: Mariano Iglesias [mailto:[EMAIL PROTECTED]
 Enviado el: Viernes, 23 de Febrero de 2007 12:54 a.m.
 Para: 'cake-php@googlegroups.com'
 Asunto: RE: Multiple Paths for Models/Views/Controllers in paths.php

 1. cake/basics.php - loadModels() has this:


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



Re: best practice multiple checkboxes

2007-02-23 Thread Seb

hum... Honnest I haven't had a look at the $html-checkboxesMultiple
yet but well.. here's how my apps do it;

I've extended the html helper as I've got quite a few 'custom'
functions. One of them I called checkboxGroup (and other one is
radioGroup, which I though looks better than a select box in some
cases)

The function behaves pretty much like the input one, so my views don't
have any more 'layout processing' to do. So I call it like this;
param1 is the association name, and $keywords the list of all keywords
an article could be assigned to (~100).

?php echo $eoHtml-checkboxGroup('Keyword',$keywords); ?

The signature for the method is ;

function checkboxGroup ($assocName, $items, $htmlAttributes = null,
$separator = null, $selected_label = null, $selected_key = null, $div
= true ) {

* @param string $assocName the name of the association Model. Used to
generate the proper input name.
* @param array $items collection of items to display (from
generatedList is fine).
* @param array $htmlAttributes to assign to the wrapping div
* @param string $separator to be inserted between every elements
(default is br/)
* @param string $selected_label attribute from a $item to use as a
label (default: name)
* @param string $selected_id attribute from the $item object to map
the selection to (default: id)
* @param bool $div wrap the whole thing in a div or not - same as the -
submit behavior in 1.2+
* @return string html generated

Same as most other HtmlHelper method, the values (selected items) are
pulled out of the current data. The function then generates;

div class=checklist
input type=check.../label for...label/labelbr/
input type=check.../label for...label/labelbr/
/div

The to make a nice look and feel, I use the css to give the checklist
div a fixed height and make the overflow scroll (auto). Looks like
this;
http://img341.imageshack.us/my.php?image=untitledes0.png

Hope this helps!

Seb

'
On Feb 23, 9:56 pm, szeta [EMAIL PROTECTED] wrote:
 Does anybody have an idea here?

 Every hint is appreciated. :-)
 Regards
 Ralph

 On 22 Feb., 10:23, szeta [EMAIL PROTECTED] wrote:

  Hello,

  I'm using CakePHP now for a few months on a project and I really love
  the framework.
  It helped me to safe a lot of time!

  But one thing, I always run into is, that it's not so easy to generate
  comfortable checkboxes (e.g. for maintaining HABTM relations).

  I tried e.g. $html-checkboxMultiple and it works, that's already much
  better than the scroll-box baked by default.

  But I'd like to give more Information to the related items (not only
  the primary key, but also the name or something else..)

  How do you handle this? Is there a method I have overseen?

  Best wishes!
  Ralph


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



Re: Custom Validate

2007-02-21 Thread Seb

Hey,

You might want to give this article from the bakery a look;
http://bakery.cakephp.org/articles/view/55

I've been using it and extending it for months now and it works like a
charm!

Hope this helps!

Seb.

Grant Cox wrote:
 I haven't really looked at the new Validation options, but the
 traditional way is to do this in your model beforeValidate callback.


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



Re: pagination component / question / typo

2007-02-21 Thread Seb

Hey there,

For I have use that same pagination helper, I'm almost sure there is
no way to add more param/value pairs to the generated Url.
However I extended it to add a 'filterBy' and it ended up being fairly
simple (minimal coding).

I haven't had the time to have a good look at the new paginator from
1.2, so I can't say if it provides what you are looking for.
Anyone?

I don't mind sending you my code if you want to look into it, however
there is very little new stuff.. mostly duplicating+adating the
current SortBy stuff.

Hope this helps!

Seb.


jyrgen wrote:
 i installed this pagination component:

 http://bakery.cakephp.org/articles/view/65

 which does a fine job, but i'm not getting further with query
 constraints that i would like to maintain across pages.

 i have selectbox with different time intervals constraining
 the data amount being pulled from the db. for example i
 would like to generate pagination html links like this :

 articles/index?page=2interval=2months

 the helper methods only generate links like this:

 articles/index?page=2

 -- how can i attach further parameters to this link ? --
 param1=value1param2=value2


 there was(is?) a typo in the helper class, line 326:

 if ($this-_pageDetails['page']$this-_page['pageCount'])

 should read

 if ($this-_pageDetails['page']$this-_pageDetails['pageCount'])


 thanks a ton
 ( and please don't point me to the new 1.2 version which comes
 with a builtin pagination facility...)

 jyrgen


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



Re: hasMany/belongsTo

2007-02-21 Thread Seb

Uuummm, I must say I don't really understand what your problem
precisely is, however I can spot a few mistakes in the code you
provided;

* using the HtmlHelper the tagName param should be User/id, not User/
user_id (that's if you're using the cake naming conventions)
* also if your relations are defined properly, you shouldn't have to
$this-data['User']['profile_id']=array($this-Profile-
getLastInsertId());

if I understand your app properly (Please, provide more details!) you
should have something like this for a one to one relationship;

User Model:
$hasOne = array('Profile');

Profile Model:
$belongsTo = array('User');

However, I see you have a Users_Profiles, meaning your having a many
to many relationship...??!

If that's the case, make sure your table is named Profiles_Users
(alphabetical) and you should not have a profile_id in the user table
nor in the user model.

Then try that; (assuming you have used the proper naming conv...!)

User Model:
var $hasAndBelongsToMany = array('Profile');

and the Profile Model should have the reverse;
var $hasAnd BelongsToMany = array('User');


So anyway, again, I'm really not sure where you're heading... but post
some more code (models, views and tbl structure) and we'll see what we
can do!

Hope it helps!

Seb./

Kathrin wrote:
 Hello,
 ich have Problems to save data in a hasMany/belonsto
 Users_ProfilesTable.
 Sie Array is OK.
 My source:

 View User:
 ?php // echo $html-hidden('User/user_id', array('value' =
 $post['User']['id']));?
 post to  User/Controller save the data and post user_id to Profile/
 controller
 View/Profile
 echo $form-hidden('User/user_id', array('value'= $userid));
 Controller/Profile
 function addprofile($userid=0) {
   $this-set('userid',$userid);
 if (!empty ($this-data)) {  #Formular wurde
 abgeschickt-eingegebene Datenspeichern
 $this-cleanUpFields();
 $this-Profile-create();
   
 $this-data['Profile']['user_id']=array($this-data['User']
 ['user_id']);
 $this-Profile-save($this-data);
   $this-data['User']['profile_id']=array($this-Profile-
 getLastInsertId());
   //error_log(print_r($this-data,true));
   $this-Session-setFlash('The Profile-Data has been 
 saved');
 exit();
 }
 Have somebody an idea?
 Sincerely Kathrin


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



Re: filesystem browser with cakephp

2007-02-15 Thread Seb

Hey,

Personally I wouldn't even consider writing my own filemanager
(whatever you call it) unless I'd have some pretty specific
requirements or license to abide to. I've implemented the MoxieCode
FileManager (not free but cheap, and very well integrated with free
tinyMCE) before and I know there are other good ones out there (the
one you mentioned seems nice too). Basically you want file creation,
rename, zip/unzip, resize/crop images maybe, move, and so on.

Basically, it's a matter of configuring the manager properly. Most of
the work is done in a view. the manager is quite simply iframed. I
have however tweaked bits and pieces in the controler in order for the
security with the filemanager to be seemless and still strong. I have
no clue how that *afb* is secured though. The implementation I'm
talking about even have different security groups, so that if the user
is in a specific group, I render on configuration, disallowing for
instance file deletion.

Hope this helps!

Seb.

On Feb 16, 2:57 pm, Fedya [EMAIL PROTECTED] wrote:
 i'm new to cakephp and have yet to try to create anything with it. i
 need to create a file browser and am considering using cake, but i
 can't see how it would work exactly. from what i've gathered from
 watching the different tutorials i would need to create a component?
 how would i interface with the filesystem, for example let's say cake
 is installed in /var/www/cake and the root of the file repository is /
 var/files which the file browser is supposed to see. i'd like to come
 up with something along the lines of this:http://blog.jc21.com/
 2006-08-21/php-ajax-file-browser/

 any guidance is appreciated :)


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



Re: Help! Invalid argument supplied for foreach() dbo_mysql.php

2007-02-14 Thread Seb

Hi Dom. This is quite interesting indeed. Of course we all know Linux
*IS* case sensitive and Windows *isn't*... but I've always experienced
Cake using the correct case. I wonder if that has anything to do with
the table prefix...?! Also.. can you see if the DESC statement is
checking for T_User or T_user on the windows box?

Best I can say if to digg down the core code.. or the API. First let
me know if you still experience the issue... (it HAS been two days..!)
and if so.. I could probably try to give it a look myself!

It's weird though... Cake should handle it.. I have developed apps on
Win and made them live on a nux box...! never userd the table prefix
though...

Cheers,

Seb.

On Feb 12, 3:50 pm, DominiqueM [EMAIL PROTECTED]
wrote:
 Hi Seb,

 Just tried accessing the Linux maching with Putty, MySql worked fine.
 The DB on the Server is already configured by a collegue of mine,
 so that shouldnt be the reason.

 I'm just wondering. I have a model object called User, but the debug
 statement says Cake is asking for user.
 Is that something anyone has encountered?

 The Debug mentions:
 DESC `T_portalnutzer` ?

  I just don't know how to convince Cake to ask for the Capitalised
 Table.

 thanks for help :)

 Dominique

 On Feb 12, 4:57 am, Seb [EMAIL PROTECTED] wrote:

  Hey Dom...

  How did you imported the data? I ran into a similar problem about a
  month ago after the mysql tables got locked in read only (phpMyAdmin
  displaying them as 'in use'). That's likely to happen if you use
  InnoDB tables and mysql is not properly shutdown. I'm assuming you
  knew that already, but if anybody else didn't, the best way to
  transfer mysql data is still through a dump (a full sql file building
  the tables and/or the data). Copying the various database files
  (.frm, ...) works in some instances (same db version, same
  filesystem, ...) but definitely not on two different OS.

  When I had the problem, I dug down the dbo_mysql.php code and the only
  thing I can tell you is that something is preventing cake from running
  the sql statement properly. It's nothing to do with the mod_rewrite.
  Maybe try to connect to the mysql server running of the SUSE box,
  using the same credentials as the cake app, and see if you can run the
  sql manually.

  Again.. that's very likely to be a mySQL server prob.

  Hope that helps!

  Seb.

  On Feb 12, 1:58 pm, DominiqueM [EMAIL PROTECTED]
  wrote:

   Hija,

   Problem:
   Deployment of a functional App (Windows XAMP PHP 4) to a Suse Linux
   Server
   causes the error mentioned above to appear when i try to access app on
   server.

   Warning: Invalid argument supplied for foreach() in /usr/share/php/
   cake/cake/libs/model/dbo/dbo_mysql.php on line 171

   Does anybody know why this could happen? Even better how I could fix
   it

   I've only got two models atmo and they both have their $name
   specified.
   The DB config file is:
   var $default = array('driver' = 'mysql',
   'connect' 
   = 'mysql_connect',
   'host' = 
   'localhost',
   'login' 
   = 'root',
   
   'password' = 'password',
   
   'database' = 'Name',
   'prefix' 
   = 'T_');

   Cake Build: cake_1.1.13.4450
   The application works fine on the windows machine.
   Mod_Rewrite is off on both.

   Any help appreciated,

   Dominique


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



Re: Help with a $hasMany, $belongsTo association...

2007-02-13 Thread Seb

@alexxwiz.. and make sure you read Eric's post about $recursive!

;)

S.

On Feb 13, 11:27 pm, alexxwiz [EMAIL PROTECTED] wrote:
 I have same problem.
 Two tables:

 CREATE TABLE `maincats` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `title` varchar(255) default NULL,
   `visible` tinyint(4) NOT NULL default '1',
   `created` datetime NOT NULL,
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM;

 CREATE TABLE `categories` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `title` varchar(255) default NULL,
   `maincat_id` int(11) default NULL,
   `visible` tinyint(4) NOT NULL default '1',
   `created` datetime NOT NULL,
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM;

 Two models:

 class Maincat extends AppModel {
 var $name = 'Maincat';
 var $hasMany =
 array('Category'=array('className'='Category','foreignKey' =
 'maincat_id'));

 }

 class Category extends AppModel {
 var $name = 'Category';

 }

 print_r($this-Maincat-findAll());

 returns only maincats content and none sub-categories.

 Array
 (
 [0] = Array
 (
 [Maincat] = Array
 (
 [id] = 1
 [title] = Some first
 [visible] = 1
 [created] = 2007-02-13 14:39:28
 )

 )

 [1] = Array
 (
 [Maincat] = Array
 (
 [id] = 2
 [title] = Some second
 [visible] = 1
 [created] = 2007-02-13 00:00:00
 )

 )

 )

 Where is my mistake?


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



Re: Help with a $hasMany, $belongsTo association...

2007-02-13 Thread Seb

@alexxwiz : try adding this to your Category model;
var $belongsTo = array ('Maincat');

@shoesole : note how you don't have to use the className value if you
stick to the naming convention, hence your
var $belongsTo  = array('Blog' = array('className' = 'Blog') );
can become
var $belongsTo  = array('Blog');

Hope that helps!

Cheers,

Seb.

On Feb 13, 11:27 pm, alexxwiz [EMAIL PROTECTED] wrote:
 I have same problem.
 Two tables:

 CREATE TABLE `maincats` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `title` varchar(255) default NULL,
   `visible` tinyint(4) NOT NULL default '1',
   `created` datetime NOT NULL,
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM;

 CREATE TABLE `categories` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `title` varchar(255) default NULL,
   `maincat_id` int(11) default NULL,
   `visible` tinyint(4) NOT NULL default '1',
   `created` datetime NOT NULL,
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM;

 Two models:

 class Maincat extends AppModel {
 var $name = 'Maincat';
 var $hasMany =
 array('Category'=array('className'='Category','foreignKey' =
 'maincat_id'));

 }

 class Category extends AppModel {
 var $name = 'Category';

 }

 print_r($this-Maincat-findAll());

 returns only maincats content and none sub-categories.

 Array
 (
 [0] = Array
 (
 [Maincat] = Array
 (
 [id] = 1
 [title] = Some first
 [visible] = 1
 [created] = 2007-02-13 14:39:28
 )

 )

 [1] = Array
 (
 [Maincat] = Array
 (
 [id] = 2
 [title] = Some second
 [visible] = 1
 [created] = 2007-02-13 00:00:00
 )

 )

 )

 Where is my mistake?


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



Re: beforeSave return false, what with afterFind...?!

2007-02-11 Thread Seb

If anybody is interested in that thread, solution 1 and 2 proposed by
Nate don't work because merging two arrays recursively returns
something like this;

[code]
Array
(
[Article] = Array
(
[id] = Array
(
[0] = 1
[1] = 1
)
[title] = Array
(
[0] = This is some MODIFIED title
[1] = This is some title
[/code]

The last solution does work, but requires a fair bit of time to
implement and make creating a new virtual field a pain.

I'll keep looking into it!

Cheers,

Seb.



On Jan 22, 4:51 pm, nate [EMAIL PROTECTED] wrote:
 Sorry, didn't see you the first time.  Okay, as I see it, there are 4
 ways to solve your problem, 3 of which are basically variations on the
 same theme.  The first three ways are these:

 // Controller: re-query your entire User model, and merge it with
 $this-data:
 $this-data = array_merge_recursive($this-User-findById($id),
 $this-data);

 // Controller: slightly optimized version of the above:
 $user = list($this-User-findById($id, array('relevant', 'fields',
 'only')));
 $this-data['User']['name_if'] = $user['name_if'];

 // Controller: just re-query and blow away the POST data completely:
 $this-data = $this-User-findById($id);

 And the final solution is view based:
 // Add a hidden field for the virtual field, to persist it across
 pages:
 ?=$form-hidden(User/name_if); ?

 - Nate
   You know my name, Google the number.


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



Re: Help! Invalid argument supplied for foreach() dbo_mysql.php

2007-02-11 Thread Seb

Hey Dom...

How did you imported the data? I ran into a similar problem about a
month ago after the mysql tables got locked in read only (phpMyAdmin
displaying them as 'in use'). That's likely to happen if you use
InnoDB tables and mysql is not properly shutdown. I'm assuming you
knew that already, but if anybody else didn't, the best way to
transfer mysql data is still through a dump (a full sql file building
the tables and/or the data). Copying the various database files
(.frm, ...) works in some instances (same db version, same
filesystem, ...) but definitely not on two different OS.

When I had the problem, I dug down the dbo_mysql.php code and the only
thing I can tell you is that something is preventing cake from running
the sql statement properly. It's nothing to do with the mod_rewrite.
Maybe try to connect to the mysql server running of the SUSE box,
using the same credentials as the cake app, and see if you can run the
sql manually.

Again.. that's very likely to be a mySQL server prob.

Hope that helps!

Seb.


On Feb 12, 1:58 pm, DominiqueM [EMAIL PROTECTED]
wrote:
 Hija,

 Problem:
 Deployment of a functional App (Windows XAMP PHP 4) to a Suse Linux
 Server
 causes the error mentioned above to appear when i try to access app on
 server.

 Warning: Invalid argument supplied for foreach() in /usr/share/php/
 cake/cake/libs/model/dbo/dbo_mysql.php on line 171

 Does anybody know why this could happen? Even better how I could fix
 it

 I've only got two models atmo and they both have their $name
 specified.
 The DB config file is:
 var $default = array('driver' = 'mysql',
 'connect' = 
 'mysql_connect',
 'host' = 
 'localhost',
 'login' = 
 'root',
 'password' = 
 'password',
 'database' = 
 'Name',
 'prefix' = 
 'T_');

 Cake Build: cake_1.1.13.4450
 The application works fine on the windows machine.
 Mod_Rewrite is off on both.

 Any help appreciated,

 Dominique


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



Re: A Virtual Fields solution using afterFind

2007-01-22 Thread Seb

As per the php doc...

As of PHP 5, this function returns the name of the methods as they were
declared (case-sensitive). In PHP 4 they were lowercased.

Seb.

On Jan 22, 9:55 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 Crap, I'm stupid.  The example method should be...

 function addFieldFullName($x) {
 return $x['first_name'] . ' ' . $x['last_name'];
 
 }My bad!


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



Re: beforeSave return false, what with afterFind...?!

2007-01-21 Thread Seb

mmm... are ^^BUMPS^^ ok in google groups...?!

;)

Seb.

On Jan 8, 10:06 am, Seb [EMAIL PROTECTED] wrote:
 Hey Nate,

 Thanks for your time! What I'm trying to do evolves around virtual
 fields. For instance in the user model, the afterFind() method creates
 2 virtual fields, one named name_lf and containing a user full name in
 'lastname, firstname' format. This works like a charm.

 Now if I edit a user, and save my changes, if the beforeSave() in the
 User Model returns false, nothing is saved to the db, and the 'error
 mode' is triggered, the edit form shown again. (that's a pretty
 standard cake behaviour)

 Now that's from where my question was raised; because the user data is
 stored in the post, it's not pulled from the DB again - which is great.
 However because it's not pulled again, the afterFind() in the User
 Model is not called, and the name_lf virtual field not created. Because
 of that and because I'm using this virtual field in the edit form, I
 get an error about this name_lf not being defined, hence my question,
 when should a beforeSave return false..?!

 Code?
 function afterFind($results) {
 if (is_array($results)) {
 foreach ($results as $key = $obj) {
 if (!isset($obj[$this-name]['id'])) {
 continue;
 }
 $results[$key][$this-name]['name_lf'] =
 ($obj[$this-name]['lname'] ? $obj[$this-name]['lname'] . ', ' : '') .
 $obj[$this-name]['fname'];
 }
 }
 return parent::afterFind($results);
  }

 function beforeSave() {
 // say I was to do something here... db related or not... and
 something fails... which is possible according to the manual
 return false;

 } end code

 So.. yeah... I don't think I'm doing anything wrong... and am just
 wondering why this all could be...

 Cheers!

 Seb.

 On Jan 6, 5:09 am, nate [EMAIL PROTECTED] wrote:

  Ummm.  beforeSave() and afterFind() are normally completely
  unrelated.  It might help to post a code sample so we can see what it
  is that you're trying to do.


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



Re: beforeSave return false, what with afterFind...?!

2007-01-07 Thread Seb


Hey Nate,

Thanks for your time! What I'm trying to do evolves around virtual
fields. For instance in the user model, the afterFind() method creates
2 virtual fields, one named name_lf and containing a user full name in
'lastname, firstname' format. This works like a charm.

Now if I edit a user, and save my changes, if the beforeSave() in the
User Model returns false, nothing is saved to the db, and the 'error
mode' is triggered, the edit form shown again. (that's a pretty
standard cake behaviour)

Now that's from where my question was raised; because the user data is
stored in the post, it's not pulled from the DB again - which is great.
However because it's not pulled again, the afterFind() in the User
Model is not called, and the name_lf virtual field not created. Because
of that and because I'm using this virtual field in the edit form, I
get an error about this name_lf not being defined, hence my question,
when should a beforeSave return false..?!

Code?
function afterFind($results) {
   if (is_array($results)) {
   foreach ($results as $key = $obj) {
   if (!isset($obj[$this-name]['id'])) {
   continue;
   }
   $results[$key][$this-name]['name_lf'] =
($obj[$this-name]['lname'] ? $obj[$this-name]['lname'] . ', ' : '') .
$obj[$this-name]['fname'];
   }
   }
   return parent::afterFind($results);
}

function beforeSave() {
   // say I was to do something here... db related or not... and
something fails... which is possible according to the manual
   return false;
}

 end code


So.. yeah... I don't think I'm doing anything wrong... and am just
wondering why this all could be...

Cheers!

Seb.


On Jan 6, 5:09 am, nate [EMAIL PROTECTED] wrote:

Ummm.  beforeSave() and afterFind() are normally completely
unrelated.  It might help to post a code sample so we can see what it
is that you're trying to do.



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



beforeSave return false, what with afterFind...?!

2007-01-04 Thread Seb


Hi guys...

I'm not really having any problem but I found this one out this morning
and it intrigues me...

Question:
In which case should a beforeSave() return false...?

Context:
I use afterFind() to create virtual fields ... and when the
beforeSave() returns false, the afterFind is not called (because the
data is not pulled off, resonably!).. but then any virtual fields are
GONE!

Any thoughts welcome!

Cheers, 


SEb.


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



1.1x to 1.2x and backward compat...

2007-01-02 Thread Seb


Guys...

anybody has any idea why was the function strip_plugin() removed from
basics.php in 1.2.x... or where it's gone...?

I can easily work around it, but I'm just intrigued as to why is it
gone...?!

cheers, 


Seb.


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



Re: 1.1x to 1.2x and backward compat...

2007-01-02 Thread Seb


Question was (half) self-replied!

https://trac.cakephp.org/changeset/3854

moved to Router.. so

old: $base = strip_plugin($this-base, $this-plugin);
new: $base = Router::stripPlugin($this-base, $this-plugin);

I can't really say why... but one could assume... cuz it makes sense!
;)

Cheers,

Seb.

On Jan 3, 12:50 pm, Seb [EMAIL PROTECTED] wrote:

Guys...

anybody has any idea why was the function strip_plugin() removed from
basics.php in 1.2.x... or where it's gone...?

I can easily work around it, but I'm just intrigued as to why is it
gone...?!

cheers,

Seb.



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



Re: $html-tableHeaders using the colspan for a single TH

2006-12-14 Thread Seb

I came accross this same problem 2 wks or so ago and decided I coun't
live without that...! So I created my own helper, extending HtmlHelper
and implemented the function as follow;

[code location=my custom/extended helper]
/**
 * Returns a row of formatted and named TABLE headers.
 *
 * @param array $names  Array of tablenames - if a tablename is an
array, index 1 should contain th options.
 * @param array $trOptions  HTML options for TR elements.
 * @param array $thOptions  HTML options for TH elements.
 * @param  boolean $return  Wheter this method should return a value
 * @return string
 */
function tableHeaders($names, $trOptions = null, $thOptions = null,
$return = false) {

$out = array();
foreach($names as $arg) {
if (is_array($arg)  isset($arg[0])  isset($arg[1])) { // 
the 2x
isset() are pretty useless really... but well for the sake of
robustness!
$out[] = sprintf($this-tags['tableheader'],
$this-parseHtmlOptions(array_merge($thOptions,$arg[1])), $arg[0]);
} else {
$out[] = sprintf($this-tags['tableheader'],
$this-parseHtmlOptions($thOptions), $arg);
}
}

$data = sprintf($this-tags['tablerow'],
$this-parseHtmlOptions($trOptions), join(' ', $out));
return $this-output($data, $return);
}
[/code]

then, I use it like this;

[code location=any view]
$th = array (
array($pagination-sortBy('weight','Order'),
array('width'='60px')),
$pagination-sortBy('name'),
array($pagination-sortBy('status'), 
array('width'='150px')),
array('Actions', array('class' = 'actions')),
);

$eoHtml-tableHeaders($th);

//
// note that you could still provide 'global' th options like this;
// $eoHtml-tableHeaders($th,null,array('class'='whatever'));
///
[/code]

I don't quite like the fact that names are linked with options, but I
really wanted to keep the same signature... plus, it makes a bit of
sense to link a specific header name with it's option(s)!

so.. the above code will generate a 4 column table headers,
column 1 is labeled Order, is sortable (because of the
$pagination-sortBy()), and has a fixed width of 60px;
column 2 is labeled Name, and is sortable - no other options (the
defautl css still applies)
column 3 is labeled Status, is sortable (...) and has a fixed width of
150px;
and finally
column 4 is labeled Actions, and will be generated a class=actions
attribute.

Hope this helps...

Seb.

On Dec 15, 10:22 am, Falagar [EMAIL PROTECTED] wrote:
 The html Helper does not implement such a behavior. You either have
 attributes for all th's or for none.

 So you have a number of possibilities: you either don't use a helper
 and write the HTML yourself (which shouldn't be hard).

 Or (if you make use of this helper function very often and changing all
 instances would be tedious) you write your own function (probably
 similar to the one in html Helper) that does excactly what you want.

 Another very ugly possibility would be to change the core html Helper
 code to do what you want, which I do not recommend.

 On Dec 14, 6:39 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

  I need add an attribute for only a th, but the $helper extend to every
  TH.
  I want create a colspan for the 3 th.
  Ho I can?

  $thop=array(COLSPAN=1);
  $th = array (
  $pagination-sortBy('id'),
  $pagination-sortBy('title'),
  $pagination-sortBy('created'),
  Actions
  ); // Generate the pagination sort links
  echo $html-tableHeaders($th,null,$thop); // Create the table headers
  with sort links if desired
 
  Thanks!


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



Re: Helpers scope in Elements...

2006-12-13 Thread Seb

Mmmm.. sorry, that should've been am I right to thinK the element
creates a new instance of the helpers?!

... so after a bit more investigation, it seems to be the case. Now
what I did to fix it... if anyone wonders is adding an init() function
to the pagination helper, and making sure the helper was initialised
before any other function would proceed...


code: (goes in the pagination helper)

var $initialized = false;

function init() {
if(!$this-initialized) {
if ( !empty($this-view-_viewVars['paging']) ) {
$this-setPaging($this-view-_viewVars['paging']);
}
$this-initialized = true;
}
}

then in every other function of the helper, I added $this-init();

Hope this helps anyone else! Anyhow... if somebody could confirm how
right or wrong I am.. I'd appreciate!

Cheers,

Seb.

On Dec 13, 5:06 pm, Seb [EMAIL PROTECTED] wrote:
 M...

 The pagination helper requires to be initialised... with
 $pagination-setPaging($paging);

 Interesting fact... if I duplicate that initialisation to add it to the
 element... it works. In other words... am I right to thing the element
 creates a new instance of the helpers?!

 I might drill down the pagination component and helper tomorrow morning
 to see if I could make that a bit more seemless... surely there is a
 way...

 still.. any thoughts welcome!

 Seb.

 On Dec 13, 4:22 pm, Seb [EMAIL PROTECTED] wrote:

  Hi everyone...

  I've been pulling my hair out for the past 2 hours and I can't see
  what's wrong; am I missing something... or am I trying to do the
  impossible.. please... if you know... tell me!!

  I use the Pagination helper, which works like a charm in any view. I
  also use the html and the form helpers which also, you guessed it, work
  like a cham in any view.

  Now... there is this piece of html I'd like to move in an element. When
  I do, the html and form helpers work like a charm still, whereas the
  pagination doesn't.

  I debugged it pretty deep only to find out what doesn't make it though
  is the helper config...

  am I going crazy??!

  some code?

  these, from within the view, work perfect;
  ?php echo $pagination-pageNumbers(); ?
  ?php echo $html-submit('Create');?

  whereas from the element, this returns only the submit(Create) button.
  ?php echo $pagination-pageNumbers(); ?
  ?php echo $html-submit('Create');?

  I call the element like this;
  echo $this-renderElement('index' /*no parameters*/ ) );

  Both of the helpers are defined in the app_controler.php

  again.. am I going crazy?!!
 
  Cheers for any input!
 
  SEb.


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



Helpers scope in Elements...

2006-12-12 Thread Seb

Hi everyone...

I've been pulling my hair out for the past 2 hours and I can't see
what's wrong; am I missing something... or am I trying to do the
impossible.. please... if you know... tell me!!

I use the Pagination helper, which works like a charm in any view. I
also use the html and the form helpers which also, you guessed it, work
like a cham in any view.

Now... there is this piece of html I'd like to move in an element. When
I do, the html and form helpers work like a charm still, whereas the
pagination doesn't.

I debugged it pretty deep only to find out what doesn't make it though
is the helper config...

am I going crazy??!

some code?

these, from within the view, work perfect;
?php echo $pagination-pageNumbers(); ?
?php echo $html-submit('Create');?

whereas from the element, this returns only the submit(Create) button.
?php echo $pagination-pageNumbers(); ?
?php echo $html-submit('Create');?

I call the element like this;
echo $this-renderElement('index' /*no parameters*/ ) );

Both of the helpers are defined in the app_controler.php

again.. am I going crazy?!!

Cheers for any input!

SEb.


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



Re: custom html helper

2006-12-04 Thread Seb

Dude!!

loadHelper('html'); is what I was missing! cheers for that!

Braces... I'll take a good note of it! ;)

Cheers!


Seb.

On Dec 5, 9:04 am, Mariano Iglesias [EMAIL PROTECTED]
wrote:
 Extend the helper this way:

 1. Create a file called myhtml.php on your app/views/helpers directory.

 2. Have its contents be something like the following. I'm overriding method
 selectTag as in your example, with some small changes, like... PLEASE USE
 BRACES! :)

 ?php

 loadHelper('html');

 class MyhtmlHelper extends HtmlHelper
 {
 function selectTag($fieldName, $optionElements, $selected = null,
 $selectAttr = array(), $optionAttr = null, $showEmpty = true, $return =
 false)
 {
 if (!$selected)
 {
 $selected = parent::tagValue($fieldName);
 }

 return parent::setFormTag($fieldName, $optionElements,
 $selected, $selectAttr, $optionAttr, $showEmpty, $return);
 }

 }?

 So you see whenever you need to call cake's html helper you just do
 parent::method()

 3. Then on your controllers add the helper:

 var $helpers = array ( 'Myhtml' );

 4. And use it on your views:

 $myhtml-selectTag(...)

 -MI

 ---

 Remember, smart coders answer ten questions for every question they ask.
 So be smart, be cool, and share your knowledge.

 BAKE ON!

 -Mensaje original-
 De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
 de Ryders
 Enviado el: Lunes, 04 de Diciembre de 2006 06:35 p.m.
 Para: Cake PHP
 Asunto: Re: custom html helper

 I still didn't figure out how to 'extend' a helper... but I hope this
 will help;


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



manually update datetime field...

2006-12-04 Thread Seb

Hi everyone,

I'm still experimenting with Cake and feel I'm missing something; upon
login, I do this;

$someone['User']['last_login'] = date('Y-m-d H:i:s');
$this-User-save($someone);

Which should be updating the last_login field with the current
datetimestamp; though it doesn't work. however this;

$someone['User']['last_login'] = date('Y-m-d H:i:s');
$this-User-save($someone, false);

works like a charm (added the no validation flag to the save command).

Why?!

additionnally, any way I could get the db server time? thus unserting
now() in mysql instead of the webserver time...?

Any thoughts welcome!

Cheers,

Seb.


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



formatting model values

2006-09-20 Thread seb

Hello,
I got one issue with cake and would need your help.
I have a model called Spot with different attribut.
For example, one of its variable is type. In my database type is an
integer, but when I display the data on the web page, I want to map
each value with a specific text :
db value / value to display
0 / text0
1 / text1
2 / text3

etc 

I could do this mapping in the view but I would like to put it on a
more centralized place as this mapping will be used at differents
places in my application.


Any idea / advice ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: install cakephp; Rootserver needed?

2006-09-03 Thread Seb-el

Cool, thanks. It was just the Zip file that I put into the html folder.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



install cakephp; Rootserver needed?

2006-09-02 Thread Seb-el

Hi there,
my server supports php and 2 sql Databases. It is not a root server! Do
I need one to install cakePHP?

I don't know, which format I should install on the server. There are 3
different types:
.tar.bz2
.tar.gz
.zip

When I enter my webspace I have 6 folders:
/backup
/files
/html
/log
/phptmp
/restore

I cannot create a folder in this level. Where do I have to put which
above mentioned file?

Sorry for asking those basic questions. I searched already a lot but
had not found answers, tutorials or anything concerning them.

Cheers,
Seb-el


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: stats for cakephp

2006-06-30 Thread Seb

phpMyVisites is great too (http://www.phpmyvisites.net)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---