Re: Cannot modify header information

2011-02-13 Thread Ryan Schmidt

On Feb 12, 2011, at 10:08, tubiz wrote:

 PLease presently i am testing my cakephp application online but when i
 tried to visit my admin page at testserver.tunsicash.co.cc/admin i am
 getting this error Cannot modify header information - headers already
 sent by (output started at /home/tunsicas/public_html/testserver/app/
 models/behaviors/increment
 
 Please you can visit the link and check as well would like to know how
 i can overcome this problem.  Thanks.

In fact the full error message your server provided is:

output started at 
/home/tunsicas/public_html/testserver/app/models/behaviors/increment.php:105

So, check line 105 of the file increment.php and see why it's outputting 
something there, and make it stop doing that.


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


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


$html versus $this-Html (is it the same?)

2011-02-13 Thread Rumkuchen
I have red an article about autocomplete-netbeans-cakephp:
http://www.tiplite.com/cakephp-support-in-netbeans/
In this article, they use the variable $html instead of $this-Html.
Is it the same? Which variable shoud be used?
regards
rumkuchen

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


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


Re: $html versus $this-Html (is it the same?)

2011-02-13 Thread cricket
On Sun, Feb 13, 2011 at 11:50 AM, Rumkuchen reinwe...@gmail.com wrote:
 I have red an article about autocomplete-netbeans-cakephp:
 http://www.tiplite.com/cakephp-support-in-netbeans/
 In this article, they use the variable $html instead of $this-Html.
 Is it the same? Which variable shoud be used?

If you're running 1.3.x use $this-Html.

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


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


Re: $html versus $this-Html (is it the same?)

2011-02-13 Thread Rumkuchen
Hi cricket!
thanks for quick answering
Yes, I use 1.3.7 - But I would prefer to use $html  - because with
$this-Html the autocomplete does not work in the described way.
What is the disadvantage of using $Html - or - is there a possibility
to use autocomplete in netbeans AND using $this-Html.
Which IDE do you use?
regards

On 13 Feb., 18:28, cricket zijn.digi...@gmail.com wrote:
 On Sun, Feb 13, 2011 at 11:50 AM, Rumkuchen reinwe...@gmail.com wrote:
  I have red an article about autocomplete-netbeans-cakephp:
 http://www.tiplite.com/cakephp-support-in-netbeans/
  In this article, they use the variable $html instead of $this-Html.
  Is it the same? Which variable shoud be used?

 If you're running 1.3.x use $this-Html.

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


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


Re: $html versus $this-Html (is it the same?)

2011-02-13 Thread Michael Carriere
IIRC, $html is from cake 1.2 or earlier.

$this-Html is for 1.3 and going forward.

If you use $html, you are at risk of having to fix all of your code when newer 
versions of cake come out that don't support it anymore.


On Feb 13, 2011, at 12:47 PM, Rumkuchen wrote:

 Hi cricket!
 thanks for quick answering
 Yes, I use 1.3.7 - But I would prefer to use $html  - because with
 $this-Html the autocomplete does not work in the described way.
 What is the disadvantage of using $Html - or - is there a possibility
 to use autocomplete in netbeans AND using $this-Html.
 Which IDE do you use?
 regards
 
 On 13 Feb., 18:28, cricket zijn.digi...@gmail.com wrote:
 On Sun, Feb 13, 2011 at 11:50 AM, Rumkuchen reinwe...@gmail.com wrote:
 I have red an article about autocomplete-netbeans-cakephp:
 http://www.tiplite.com/cakephp-support-in-netbeans/
 In this article, they use the variable $html instead of $this-Html.
 Is it the same? Which variable shoud be used?
 
 If you're running 1.3.x use $this-Html.
 
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
 
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

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


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


Re: $html versus $this-Html (is it the same?)

2011-02-13 Thread cricket
On Sun, Feb 13, 2011 at 12:47 PM, Rumkuchen reinwe...@gmail.com wrote:
 Hi cricket!
 thanks for quick answering
 Yes, I use 1.3.7 - But I would prefer to use $html  - because with
 $this-Html the autocomplete does not work in the described way.
 What is the disadvantage of using $Html

It's deprecated, so it will eventually not work.

 or - is there a possibility
 to use autocomplete in netbeans AND using $this-Html.

No idea.

 Which IDE do you use?

I don't. I use JEdit. Without autocomplete. Can't stand it.

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


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


Re: $html versus $this-Html (is it the same?)

2011-02-13 Thread euromark
there are several IDEs which you can easily tweak to autocomplete
correctly

i use phpdesigner:
http://www.dereuromark.de/2010/09/22/setting-up-phpdesigner-for-cakephp/

script:
http://www.dereuromark.de/2010/06/28/code-completion-console-script/


On 13 Feb., 19:52, cricket zijn.digi...@gmail.com wrote:
 On Sun, Feb 13, 2011 at 12:47 PM, Rumkuchen reinwe...@gmail.com wrote:
  Hi cricket!
  thanks for quick answering
  Yes, I use 1.3.7 - But I would prefer to use $html  - because with
  $this-Html the autocomplete does not work in the described way.
  What is the disadvantage of using $Html

 It's deprecated, so it will eventually not work.

  or - is there a possibility
  to use autocomplete in netbeans AND using $this-Html.

 No idea.

  Which IDE do you use?

 I don't. I use JEdit. Without autocomplete. Can't stand it.

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


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


How to validate a dropdown list with months

2011-02-13 Thread Diogo
Hi! I've been seraching for weeks how to do that but didn't find any
good answer. I mean I thought it was supposed to be easy to do that,
but not at all. Here's the thing, I have to ask the user to choose a
month interval so I can show the right data to him. Since it's not
related to any table I have on my database, I just did this (sorry
don't know how to put tags to format as a code):

?php
echo $this-Form-create(false);
echo $this-Form-month('m1', null, array('monthNames' = false));
echo ' until ';
echo $this-Form-month('m2', null, array('monthNames' = false));
echo $this-Form-end('Choose');
?

And then created a simple rule at the model (there's only a rule for
one field, for test purpose):

var $validate = array('m1' = array('rule' = 'notEmpty', 'required'
= true, 'message' = 'Error!'));

Here's my controller:

function choose_date ($id = null) {
if (!empty($this-data)) {
$this-Frequency-set($this-data);
if ($this-Frequency-validates()) {
$fD = $this-data['m1']['month'].'/'.date('Y');
$tD = $this-data['m2']['month'].'/'.date('Y');
$this-Session-write('Frequency.fromDate', 
$fD);
$this-Session-write('Frequency.toDate', $tD);
$this-redirect(array('action' = 'view'));
}
} else { $this-Session-write('Worker.id', $id); }
}

So what happens is that it just freezes at the choose_date view,
doesn't matter if do or don't select anything on the list. How can I
validate it?  It's probably a simple task but it's getting me crazy!

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


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


Moving servers

2011-02-13 Thread Adam Harness
I am moving a cake built website to another server. All pages in the
cake app directory are not found when attempting to open in the
browser.

Any insight would be helpful and greatly appreciated.

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


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


Re: Moving servers

2011-02-13 Thread acl68

Thanks in advance for any help

Anja


Am Sonntag, 13. Februar 2011, um 22:03:14 schrieb Adam Harness:
 I am moving a cake built website to another server. All pages in the
 cake app directory are not found when attempting to open in the
 browser.
 
 Any insight would be helpful and greatly appreciated.

Did you also move the .htaccess files?


Anja

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


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


Re: Redirect URL format not as expected.

2011-02-13 Thread adam_g2000
Thank you Jeremy, you've saved me a great deal of time going forward.
I now really have got to grips with the base routing and have
redeveloped the work done so far using your suggested method - much
quicker, easier to read through the code and tighter. I can't thank
you enough.

Before I continue, I switched from passing the title to the ID, some
of the users titles featured : in them, and the obvious started to
happen, passed in the URL Cake was interpreting them as key, value...

However I still have the problem with redirect. It doesn't seem to be
sending the variable, or my controller is not reading it. When I
reference the variable in the view, I get the error Notice 8:
Undefined variable: categoryID [APP/views/subcategories/index.ctp,
line 44] Here is my revised code:


function edit($id = null, $categoryID = null) {
App::import('Model','Category');
$cat = new Category();
$category = $cat-field('title', array('id' = $categoryID));
$this-set('category', $category);
if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid subcategory', 
true));
$this-redirect(array('action' = 'index'));
}
if (!empty($this-data)) {
if ($this-Subcategory-save($this-data)) {
$this-Session-setFlash(__('The subcategory 
has been saved',
true));
$this-redirect(array(
'controller' = 'subcategories',
'action' = 'index',
$categoryID
));
} else {
$this-Session-setFlash(__('The subcategory 
could not be saved.
Please, try again.', true));
}
}
if (empty($this-data)) {
$this-data = $this-Subcategory-read(null, $id);
}
$categories = $this-Subcategory-Category-find('list');
$resources = $this-Subcategory-Resource-find('list');
$this-set(compact('categories', 'resources'));
}

In the view...

div class=subcategories form
?php echo $this-Form-create('Subcategory');?
fieldset
legend?php __('Edit Subcategory'.$category); ?/legend
?php
echo $this-Form-input('id');
echo $this-Form-input('title');
echo $this-Form-input('order');
echo $this-Form-input('status');
echo $this-Form-input('category_id');
echo $this-Form-input('Resource');
?
/fieldset
?php echo $this-Form-end(__('Submit', true));?
/div
div class=actions
h3?php __('Actions'); ?/h3
ul

li?php echo $this-Html-link(__('Delete', true), 
array('action'
= 'delete', $this-Form-value('Subcategory.id')), null,
sprintf(__('Are you sure you want to delete # %s?', true), $this-Form-
value('Subcategory.id'))); ?/li
li?php echo $this-Html-link(__('List Subcategories', true),
array('action' = 'index'));?/li
li?php echo $this-Html-link(__('List Categories', true),
array('controller' = 'categories', 'action' = 'index')); ? /li
li?php echo $this-Html-link(__('New Category', true),
array('controller' = 'categories', 'action' = 'add')); ? /li
li?php echo $this-Html-link(__('List Resources', true),
array('controller' = 'resources', 'action' = 'index')); ? /li
li?php echo $this-Html-link(__('New Resource', true),
array('controller' = 'resources', 'action' = 'add')); ? /li
/ul
/div

... I know it's working to this point because this line is acting as a
test legend?php __('Edit Subcategory'.$category); ?/legend and
it displays (for example) *Edit SubcategoryFashion Design*, which must
mean that the edit method received the variables for category and is
working with them, so they should be available to 'redirect', yet when
redirect bounces back to the subcategories/index page, it defaults to
the ELSE part of the IF statement.

Once again, thanks for looking Jeremy, if you (or any others) can
offer any further advice I'd be hugely grateful.

Adam.

On Feb 12, 5:51 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 Take out your customer route - you don't need it. Just use links in the 
 format:

 echo $this-Html-link(
         'Text',
         array(
                 'controller' = 'controller_name',
                 'action' = 'action_name',
                 $variable
         )
 );

 Cake will sort the rest out for you. $variable can be the id if you want, or 
 the category.

 The reason you are getting the funny url is because you are specifying names 
 for the third and forth parameters (id and category), so they 

Re: Redirect URL format not as expected.

2011-02-13 Thread adam_g2000
In case the index controller is useful, here it is.

function index($categoryID = null) {
if (!empty($categoryID)) {
App::import('Model','Category');
$cat = new Category();
$category = $cat-field('title', array('id' = 
$categoryID));
$this-set('category', $category);
$this-set('categoryID', $categoryID);
$conditions = array(
'conditions' = array(
'Category.id' = 
$categoryID),
'order' = 'Subcategory.order 
ASC'
);
$subcategories = $this-Subcategory-find('all', 
$conditions);
} else {
$this-set('category', 'All');
$conditions = array(
'order' = array(
'Category.title' = 
'ASC',
'Subcategory.order' = 
'ASC'
)
);
$subcategories = $this-Subcategory-find('all', 
$conditions);
}
$this-Subcategory-recursive = 0;
$this-set('subcategories', $subcategories);
}

On Feb 14, 11:48 am, adam_g2000 a...@designcollective.co.nz wrote:
 Thank you Jeremy, you've saved me a great deal of time going forward.
 I now really have got to grips with the base routing and have
 redeveloped the work done so far using your suggested method - much
 quicker, easier to read through the code and tighter. I can't thank
 you enough.

 Before I continue, I switched from passing the title to the ID, some
 of the users titles featured : in them, and the obvious started to
 happen, passed in the URL Cake was interpreting them as key, value...

 However I still have the problem with redirect. It doesn't seem to be
 sending the variable, or my controller is not reading it. When I
 reference the variable in the view, I get the error Notice 8:
 Undefined variable: categoryID [APP/views/subcategories/index.ctp,
 line 44] Here is my revised code:

         function edit($id = null, $categoryID = null) {
                 App::import('Model','Category');
                 $cat = new Category();
                 $category = $cat-field('title', array('id' = $categoryID));
                 $this-set('category', $category);
                 if (!$id  empty($this-data)) {
                         $this-Session-setFlash(__('Invalid subcategory', 
 true));
                         $this-redirect(array('action' = 'index'));
                 }
                 if (!empty($this-data)) {
                         if ($this-Subcategory-save($this-data)) {
                                 $this-Session-setFlash(__('The subcategory 
 has been saved',
 true));
                                 $this-redirect(array(
                                         'controller' = 'subcategories',
                                         'action' = 'index',
                                         $categoryID
                                 ));
                         } else {
                                 $this-Session-setFlash(__('The subcategory 
 could not be saved.
 Please, try again.', true));
                         }
                 }
                 if (empty($this-data)) {
                         $this-data = $this-Subcategory-read(null, $id);
                 }
                 $categories = $this-Subcategory-Category-find('list');
                 $resources = $this-Subcategory-Resource-find('list');
                 $this-set(compact('categories', 'resources'));
         }

 In the view...

 div class=subcategories form
 ?php echo $this-Form-create('Subcategory');?
         fieldset
                 legend?php __('Edit Subcategory'.$category); ?/legend
         ?php
                 echo $this-Form-input('id');
                 echo $this-Form-input('title');
                 echo $this-Form-input('order');
                 echo $this-Form-input('status');
                 echo $this-Form-input('category_id');
                 echo $this-Form-input('Resource');
         ?
         /fieldset
 ?php echo $this-Form-end(__('Submit', true));?
 /div
 div class=actions
         h3?php __('Actions'); ?/h3
         ul

                 li?php echo $this-Html-link(__('Delete', true), 
 array('action'
 = 'delete', $this-Form-value('Subcategory.id')), null,
 sprintf(__('Are you sure you want to delete # %s?', true), 
 $this-Form-value('Subcategory.id'))); ?/li

                 li?php echo $this-Html-link(__('List Subcategories', 
 true),
 array('action' = 'index'));?/li
                 li?php 

Re: Redirect URL format not as expected.

2011-02-13 Thread Ryan Schmidt
On Feb 13, 2011, at 16:50, adam_g2000 wrote:
 On Feb 14, 11:48 am, adam_g2000 wrote:
 However I still have the problem with redirect. It doesn't seem to be
 sending the variable, or my controller is not reading it. When I
 reference the variable in the view, I get the error Notice 8:
 Undefined variable: categoryID [APP/views/subcategories/index.ctp,
 line 44] Here is my revised code:
 
 In case the index controller is useful, here it is.
 
 function index($categoryID = null) {
   if (!empty($categoryID)) {
   App::import('Model','Category');
   $cat = new Category();
   $category = $cat-field('title', array('id' = 
 $categoryID));
   $this-set('category', $category);
   $this-set('categoryID', $categoryID);
   $conditions = array(
   'conditions' = array(
   'Category.id' = 
 $categoryID),
   'order' = 'Subcategory.order 
 ASC'
   );
   $subcategories = $this-Subcategory-find('all', 
 $conditions);
   } else {
   $this-set('category', 'All');
   $conditions = array(
   'order' = array(
   'Category.title' = 
 'ASC',
   'Subcategory.order' = 
 'ASC'
   )
   );
   $subcategories = $this-Subcategory-find('all', 
 $conditions);
   }
   $this-Subcategory-recursive = 0;
   $this-set('subcategories', $subcategories);
   }
 

Well, I see a path through this code that would result in categoryID not being 
set in the view. Do you? When function index is called without a parameter 
(i.e. when you access a URL without the id), then $this-set('categoryID', 
$categoryID) is not called, hence categoryID is not set in the view, hence PHP 
tells you that.

If you're going to set up your controller's index method that way (where the 
categoryID is optional), then you need to code your index template to allow 
categoryID to be optional as well.


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


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


Re: Blog example not working - need edit in View

2011-02-13 Thread dalvarez

I actually ran across the same exact problem. After looking at CakePHP's
downloads page on Github, I noticed that 1.3-dev.zip was listed higher than
1.3.7.zip. I think that the confusion lies in the fact that I (and maybe
others) mistook this to be a newer version than 1.3.7 and downloaded that
version instead. I'm downloading the 1.3.7 version now to try it out.
-- 
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Blog-example-not-working-need-edit-in-View-tp3367716p3383722.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


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


Re: How to inherit / extend a content class

2011-02-13 Thread ShadowCross
Hi Ryan:

With your proposed design, you can control the Content isOnlyOneOf
using the beforeSave(), but consider the following:

1) What if, in the future, you want to create another specialized
Content class?  That means you will need to not only create a new
table, but also add another column to the contents table.  Changing
the table structure when you've already accumulated a lot of rows can
take a while, and will require a table lock.

2) Since the Content will generally be accessed in the context of the
specialized class, each of the 'specialized_id' fields should be
indexed; without these individual indexes, the database will need to
execute a table scan to find the appropriate Content matching the
selected Bookmark/Message/Post, and can take longer as the contents
table grows.  The more indexes a table has, the more overhead involved
when changing the rows (INSERT/UPDATE/DELETE), since it needs to
update the associated indexes as well (even NULL values might be
processed by the database when updating the indexes, see:
http://stackoverflow.com/questions/289001/does-mysql-index-null-values).
Depending on the database vendor implementation, as well as the
storage medium for the tables (MySQL allows MyISAM, and InnoDB as some
of the options), this could have implications, such as a full table
lock for the duration of the DML (delaying other users from making
changes to other rows in the contents table until complete) or
increased storage requirements.  Updating a single 2-column index
*MAY* be more efficient than multiple 1-column indexes.

To address your concern about wasted space, one variation to the model/
model_id design is to define the model field as an integer instead of
a string.  Your Content class can define constants to map the values
to the appropriate model names (see:
http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/).
Another alternative if you are using MySQL, is to define the column as
enum; note, however, that CakePHP doesn't directly support enum
datatypes, and is discouraged by some programmers because it prevents
the app from being portable.  Using the enum datatype also has the
same disadvantage as item #1 above -- you need to change the table
structure if you want to add additional values.

Regarding foreign keys with the model/model_id design: I haven't tried
this, and it may introduce other problems, but...

  CREATE VIEW content_models AS
  SELECT id AS model_id, 'Bookmark' AS model
FROM bookmarks
  UNION
  SELECT id AS model_id, 'Message' AS model
FROM messages
  UNION
  SELECT id AS model_id, 'Post' AS model
FROM posts;

  ALTER TABLE contents
ADD FOREIGN KEY fk_content_model (model_id, model)
REFERENCES content_models (model_id, model);

You should carefully test this because
a) you cannot create an index on a view (at least, not in MySQL).
Hopefully, by using model_id as the FIRST column in the foreign key
clause, it would utilize the primary key of the underlying tables to
access the reference quickly
and
b) foreign key constraints add overhead like indexes do, as each row
in an INSERT/UPDATE/DELETE statement has to be validated against each
constraint, blocking other access to the table until it completes.

I have my preferences, but am open to other suggestions on design
patterns addressing this issue, as well as other advantages/
disadvantages/clarifications of these patterns.


On Feb 12, 10:42 am, Ryan Schmidt google-2...@ryandesign.com wrote:
 I've heard that recommended before. Is that really the best practice? (I 
 honestly don't know, and am trying to learn.) It surprises me, because it 
 means that I cannot (in my database engine) declare a foreign key on the 
 model_id column, which means I lose the benefits that in-database foreign key 
 definitions provide. It also seems to waste space, storing the model name 
 string over and over again in every record.

 If I were designing this, I think my contents table would have fields 
 bookmark_id, message_id and post_id, each of which is defined as allowing 
 NULL, with the intention that only one of these be filled for any given 
 record; I'd have a beforeSave() method in the Content model ensuring that. 
 Does that make sense, or is there a reason why I wouldn't want to do it that 
 way?

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


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


Is there a better way?

2011-02-13 Thread Krissy Masters
When using selects for years 19xx - 20xx in different places on the site I
found in the new year I had to go thru sites and set the max year to select
from. Pain!

So I now have done in core.php

Configure::write('MAX_YEAR_SELECT', '2011');
Configure::write('MIN_YEAR_SELECT', '1980');

Then in select inputs for the range simply 

echo $this-Form-year(
'School.year_set', 
Configure::read('MAX_YEAR_SELECT');
Configure::read('MIN_YEAR_SELECT');

So next year simply update in 1 place. Is there a better, cleaner way?

Thanks

K




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


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


Re: Redirect URL format not as expected.

2011-02-13 Thread adam_g2000
Thanks for pointing that out Ryan, I'm sorry I should have been more
clear. I know why the error is occurring in the page (I can see
currently there is the opportunity for it not to be set, and will
revise that once I've finished sorting out the fact that it's not
being sent by 'redirect'), it's the cause of the variable being MIA
when redirect should be sending it that I need to fix first.

The bug you've pointed out is (right now), kinda helpful in that it
lets me know that categoryID is missing when it should be populated by
redirect.

I still have no idea why I'm not getting any parameters from redirect
in my edit method:

 $this-redirect(array(
   'controller' = 'subcategories',
   'action' = 'index',
   $categoryID
));

On Feb 14, 11:58 am, Ryan Schmidt google-2...@ryandesign.com wrote:
 On Feb 13, 2011, at 16:50, adam_g2000 wrote:





  On Feb 14, 11:48 am, adam_g2000 wrote:
  However I still have the problem with redirect. It doesn't seem to be
  sending the variable, or my controller is not reading it. When I
  reference the variable in the view, I get the error Notice 8:
  Undefined variable: categoryID [APP/views/subcategories/index.ctp,
  line 44] Here is my revised code:

  In case the index controller is useful, here it is.

  function index($categoryID = null) {
             if (!empty($categoryID)) {
                     App::import('Model','Category');
                     $cat = new Category();
                     $category = $cat-field('title', array('id' = 
  $categoryID));
                     $this-set('category', $category);
                     $this-set('categoryID', $categoryID);
                     $conditions = array(
                                             'conditions' = array(
                                                     'Category.id' = 
  $categoryID),
                                             'order' = 'Subcategory.order 
  ASC'
                                             );
                     $subcategories = $this-Subcategory-find('all', 
  $conditions);
             } else {
                     $this-set('category', 'All');
                     $conditions = array(
                                             'order' = array(
                                                     'Category.title' = 
  'ASC',
                                                     'Subcategory.order' = 
  'ASC'
                                                     )
                                             );
                     $subcategories = $this-Subcategory-find('all', 
  $conditions);
             }
             $this-Subcategory-recursive = 0;
             $this-set('subcategories', $subcategories);
     }

 Well, I see a path through this code that would result in categoryID not 
 being set in the view. Do you? When function index is called without a 
 parameter (i.e. when you access a URL without the id), then 
 $this-set('categoryID', $categoryID) is not called, hence categoryID is not 
 set in the view, hence PHP tells you that.

 If you're going to set up your controller's index method that way (where the 
 categoryID is optional), then you need to code your index template to allow 
 categoryID to be optional as well.

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


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


Re: Is there a better way?

2011-02-13 Thread John Hardy
http://php.net/date with http://php.net/strtotime 

Sent from my iPhone

On Feb 13, 2011, at 8:02 PM, Krissy Masters naked.cake.ba...@gmail.com wrote:

 When using selects for years 19xx - 20xx in different places on the site I
 found in the new year I had to go thru sites and set the max year to select
 from. Pain!
 
 So I now have done in core.php
 
 Configure::write('MAX_YEAR_SELECT', '2011');
 Configure::write('MIN_YEAR_SELECT', '1980');
 
 Then in select inputs for the range simply 
 
 echo $this-Form-year(
 'School.year_set', 
Configure::read('MAX_YEAR_SELECT');
Configure::read('MIN_YEAR_SELECT');
 
 So next year simply update in 1 place. Is there a better, cleaner way?
 
 Thanks
 
 K
 
 
 
 
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
 
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

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


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


Re: Moving servers

2011-02-13 Thread adam_g2000
Has anything changed in the location of the filestructure that would
need anything to be altered in the .htaccess files in you folders?

In webroot/index.php there is a line, around the early 50's, that
defines a static variable for the path to the core files,
CAKE_CORE_INCLUDE_PATH

Is it possible that you need to change this to point to the core on
the server?

Hope that helps.

On Feb 14, 10:03 am, Adam Harness des...@ahdindy.com wrote:
 I am moving a cake built website to another server. All pages in the
 cake app directory are not found when attempting to open in the
 browser.

 Any insight would be helpful and greatly appreciated.

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


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


Re: Does the CakePHP ready for 'Large Scale' web applications?

2011-02-13 Thread Okto Silaban
AFAIK it doesn't work on Cake = 1.2.x
From comment on that post :

The approach using beforeSave() no longer works for cake 1.2. Looking at
CAKE/libs/model/model.php:save() the call to beforeSave() happens long after
variable $db has been set using the old value of $this-useDbConfig .


On Fri, Feb 11, 2011 at 6:39 PM, majna majna...@gmail.com wrote:

 Cleaner solution for master/slave using callbacks (or Behavior)

 function beforeSave() {
$this-useDbConfig = 'master';
return true;
 }

 function afterSave() {
$this-useDbConfig = 'default';
return true;
 }

 function beforeDelete() {
$this-useDbConfig = 'master';
 return true;
 }

 function afterDelete() {
$this-useDbConfig = 'default';
 return true;
 }


 http://bakery.cakephp.org/articles/eagerterrier/2007/05/26/load-balancing-and-mysql-master-and-slaves-2

 On Feb 10, 6:14 pm, ibejohn818 john.c.ha...@gmail.com wrote:
  This what I am using.
  ===
  class AppModel extends Model {
 
  public function save($data = null, $validate = true, $fieldList =
  array()) {
 
  $this-useDbConfig = 'master';
 
  $success = parent::save($data,$validate,$fieldList);
 
  $this-useDbConfig = 'default';
 
  return $success;
 
  }
 
  public function saveAll($data = null, $options = array()) {
 
  $this-useDbConfig = 'master';
 
  $status = parent::saveAll($data,$options);
 
  $this-useDbConfig = 'default';
 
  return $status;
 
  }
 
  public function updateAll($fields, $conditions = true) {
 
  $this-useDbConfig = 'master';
 
  $status = parent::updateAll($fields,$conditions);
 
  $this-useDbConfig = 'default';
 
  return $status;
 
  }
 
  public function delete($id = null, $cascade = true) {
 
  $this-useDbConfig = master;
 
  $status = parent::delete($id,$cascade);
 
  $this-useDbConfig = 'default';
 
  return $status;
 
  }
 
  }
 
  
 
  For multiple Slaves you should use a load balancer to RoundRobin
  Balance the requests to your slaves.
 
  On Feb 10, 9:05 am, Okto Silaban o...@silaban.net wrote:
 
   That's what I'm trying to do.
   I've setup 1 master and 2 slaves. But CakePHP doesn't support read 
 write
   query separation.
   So, do you have any information how can I split the read  write query?
   *other than rewrite all my models
 
   thanks.
 
   On Wed, Feb 9, 2011 at 10:03 AM, Dr. Tarique Sani 
 tariques...@gmail.comwrote:
 
Have you split the reads and the writes?
 
All the writes go to the master which is on a server of its own and
the reads are from the slaves which are typically on the same machine
as the webserver and of course use very aggressive caching
 
Cheers
Tarique

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


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


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


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


I want to add Auth authentication in all views.

2011-02-13 Thread sanjibdhar...@gmail.com
I have a app where I want to add Auth authentication in all
views.There will be one rule as only admin can access add
views.Other views can be accessed by everybody.

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


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


Is there anyway to add Auth authentication on each and every views into a built application?

2011-02-13 Thread sanjibdhar...@gmail.com
Is there anyway to add Auth authentication on each and every views
into a built application?The rule will be only admin can access the
add view.Other can access all views and admin can add users.

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


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


Re: Redirect URL format not as expected.

2011-02-13 Thread adam_g2000
I've been playing around with this further, and have made a discovery.
Redirect is not to blame. Therefore let's say this one is solved
(thank you Jeremy) and I'll repost the real problem under a more
appropriate title.

Thanks Jeremy and Ryan for your invaluable assistance.

Adam.

On Feb 14, 5:02 pm, adam_g2000 a...@designcollective.co.nz wrote:
 Thanks for pointing that out Ryan, I'm sorry I should have been more
 clear. I know why the error is occurring in the page (I can see
 currently there is the opportunity for it not to be set, and will
 revise that once I've finished sorting out the fact that it's not
 being sent by 'redirect'), it's the cause of the variable being MIA
 when redirect should be sending it that I need to fix first.

 The bug you've pointed out is (right now), kinda helpful in that it
 lets me know that categoryID is missing when it should be populated by
 redirect.

 I still have no idea why I'm not getting any parameters from redirect
 in my edit method:

  $this-redirect(array(
                        'controller' = 'subcategories',
                        'action' = 'index',
                        $categoryID
 ));

 On Feb 14, 11:58 am, Ryan Schmidt google-2...@ryandesign.com wrote:



  On Feb 13, 2011, at 16:50, adam_g2000 wrote:

   On Feb 14, 11:48 am, adam_g2000 wrote:
   However I still have the problem with redirect. It doesn't seem to be
   sending the variable, or my controller is not reading it. When I
   reference the variable in the view, I get the error Notice 8:
   Undefined variable: categoryID [APP/views/subcategories/index.ctp,
   line 44] Here is my revised code:

   In case the index controller is useful, here it is.

   function index($categoryID = null) {
              if (!empty($categoryID)) {
                      App::import('Model','Category');
                      $cat = new Category();
                      $category = $cat-field('title', array('id' = 
   $categoryID));
                      $this-set('category', $category);
                      $this-set('categoryID', $categoryID);
                      $conditions = array(
                                              'conditions' = array(
                                                      'Category.id' = 
   $categoryID),
                                              'order' = 'Subcategory.order 
   ASC'
                                              );
                      $subcategories = $this-Subcategory-find('all', 
   $conditions);
              } else {
                      $this-set('category', 'All');
                      $conditions = array(
                                              'order' = array(
                                                      'Category.title' = 
   'ASC',
                                                      'Subcategory.order' = 
   'ASC'
                                                      )
                                              );
                      $subcategories = $this-Subcategory-find('all', 
   $conditions);
              }
              $this-Subcategory-recursive = 0;
              $this-set('subcategories', $subcategories);
      }

  Well, I see a path through this code that would result in categoryID not 
  being set in the view. Do you? When function index is called without a 
  parameter (i.e. when you access a URL without the id), then 
  $this-set('categoryID', $categoryID) is not called, hence categoryID is 
  not set in the view, hence PHP tells you that.

  If you're going to set up your controller's index method that way (where 
  the categoryID is optional), then you need to code your index template to 
  allow categoryID to be optional as well.

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


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


Re: Is there anyway to add Auth authentication on each and every views into a built application?

2011-02-13 Thread andy_the ultimate baker
hi,
for that u need to use condition,
$user=$this-Session-read('Auth.user');
if($user=='username here'){
( remaining code)
}


i am not sure that it  100 perfect but u should go through this way,
or try to give a unique id to each action and then use it in action,if
condition true show the form else hide, for that u also need to use
javascript.

hope this will give u some trick,

happy valentine day!

best regards

andy
On Feb 14, 10:56 am, sanjibdhar...@gmail.com
sanjibdhar...@gmail.com wrote:
 Is there anyway to add Auth authentication on each and every views
 into a built application?The rule will be only admin can access the
 add view.Other can access all views and admin can add users.

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


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


RE: Is there anyway to add Auth authentication on each and every views into a built application?

2011-02-13 Thread Krissy Masters
Yes.

http://book.cakephp.org/#!/view/1250/Authentication

Did you even look at the book? The is a book in case your unaware.

http://book.cakephp.org/

Give that a look. It has the answer right there clearly written out and
reading it is much faster than waiting for someone to answer.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of sanjibdhar...@gmail.com
Sent: Monday, February 14, 2011 2:27 AM
To: CakePHP
Subject: Is there anyway to add Auth authentication on each and every views
into a built application?

Is there anyway to add Auth authentication on each and every views
into a built application?The rule will be only admin can access the
add view.Other can access all views and admin can add users.

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


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

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


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


Variable scope problem

2011-02-13 Thread adam_g2000
The edit method in my controller is successfully being passed a
variable called $categoryID. I'm using the variable to query another
model, which happens successfully and the title field from the model
is displayed in the view via the variable defined here.

App::import('Model','Category');
$cat = new Category();
$category = $cat-field('title', array('id' = $categoryID));
$this-set('category', $category);

My problem arises in the second if statement in the method. By the
time I need the variable to pass through redirect it seems to have
fallen out of scope and I cannot figure out why - the variable appears
to be empty.

Here is the method.

function edit($id = null, $categoryID = null) {
App::import('Model','Category');
$cat = new Category();
$category = $cat-field('title', array('id' = $categoryID));
$this-set('category', $category);
if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid subcategory', 
true));
$this-redirect(array('action' = 'index'));
}
if (!empty($this-data)) {
if ($this-Subcategory-save($this-data)) {
$this-Session-setFlash(__('The subcategory 
has been saved',
true));
$this-redirect(array(
'controller' = 'subcategories',
'action' = 'index',
$categoryID
));
} else {
$this-Session-setFlash(__('The subcategory 
could not be saved.
Please, try again.', true));
}
}
if (empty($this-data)) {
$this-data = $this-Subcategory-read(null, $id);
}
$categories = $this-Subcategory-Category-find('list');
$resources = $this-Subcategory-Resource-find('list');
$this-set(compact('categories', 'resources'));
}

Please be gentle, I've spent a couple of months now reading the
cookbook and a textbook and a series of tutorials - though I am a
newbie! If anyone can offer any assistance and point out why this
might be I'd be very grateful. Thanks in advance.

Adam.

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


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


Re: Is there anyway to add Auth authentication on each and every views into a built application?

2011-02-13 Thread andy_the ultimate baker
reading cake book is now become a headache,
no index, no proper search,
it has nothing like to get  help, irritating, tedious, and painfull,
what u say krissy!




On Feb 14, 11:25 am, Krissy Masters naked.cake.ba...@gmail.com
wrote:
 Yes.

 http://book.cakephp.org/#!/view/1250/Authentication

 Did you even look at the book? The is a book in case your unaware.

 http://book.cakephp.org/

 Give that a look. It has the answer right there clearly written out and
 reading it is much faster than waiting for someone to answer.

 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf

 Of sanjibdhar...@gmail.com
 Sent: Monday, February 14, 2011 2:27 AM
 To: CakePHP
 Subject: Is there anyway to add Auth authentication on each and every views
 into a built application?

 Is there anyway to add Auth authentication on each and every views
 into a built application?The rule will be only admin can access the
 add view.Other can access all views and admin can add users.

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

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

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


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


reading new cake book is painful than the old one.

2011-02-13 Thread andy_the ultimate baker
hi,
i am very sory to say that the new cake book is not helping as it was
before,
so many issues, its not even user friendy.
it sah no proper search box, no tree structure index fo containts, and
not even eye catching view.
what u say gyes??

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


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


RE: Variable scope problem

2011-02-13 Thread Krissy Masters
Assuming by 2nd if you refer to 

if ($this-Subcategory-save($this-data)) {
//the save happens fine?
//$this-Session-setFlash(__('The subcategory has been saved',
true));

debug($categoryID);
exit();
//so you can see if there is fact anything up to this point in
$categoryID before you try redirecting


}

K

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of adam_g2000
Sent: Monday, February 14, 2011 2:58 AM
To: CakePHP
Subject: Variable scope problem

The edit method in my controller is successfully being passed a
variable called $categoryID. I'm using the variable to query another
model, which happens successfully and the title field from the model
is displayed in the view via the variable defined here.

App::import('Model','Category');
$cat = new Category();
$category = $cat-field('title', array('id' = $categoryID));
$this-set('category', $category);

My problem arises in the second if statement in the method. By the
time I need the variable to pass through redirect it seems to have
fallen out of scope and I cannot figure out why - the variable appears
to be empty.

Here is the method.

function edit($id = null, $categoryID = null) {
App::import('Model','Category');
$cat = new Category();
$category = $cat-field('title', array('id' =
$categoryID));
$this-set('category', $category);
if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid subcategory',
true));
$this-redirect(array('action' = 'index'));
}
if (!empty($this-data)) {
if ($this-Subcategory-save($this-data)) {
$this-Session-setFlash(__('The subcategory
has been saved',
true));
$this-redirect(array(
'controller' = 'subcategories',
'action' = 'index',
$categoryID
));
} else {
$this-Session-setFlash(__('The subcategory
could not be saved.
Please, try again.', true));
}
}
if (empty($this-data)) {
$this-data = $this-Subcategory-read(null, $id);
}
$categories = $this-Subcategory-Category-find('list');
$resources = $this-Subcategory-Resource-find('list');
$this-set(compact('categories', 'resources'));
}

Please be gentle, I've spent a couple of months now reading the
cookbook and a textbook and a series of tutorials - though I am a
newbie! If anyone can offer any assistance and point out why this
might be I'd be very grateful. Thanks in advance.

Adam.

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


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

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


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


Re: reading new cake book is painful than the old one.

2011-02-13 Thread Miles J
There is a tree structure and search on the left sidebar.

It requires JS enabled to work correctly.

On Feb 13, 10:36 pm, andy_the ultimate baker
anandghaywankar...@gmail.com wrote:
 hi,
 i am very sory to say that the new cake book is not helping as it was
 before,
 so many issues, its not even user friendy.
 it sah no proper search box, no tree structure index fo containts, and
 not even eye catching view.
 what u say gyes??

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


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


Re: reading new cake book is painful than the old one.

2011-02-13 Thread Ryan Snowden
I love the new book. Fuzzy logic frontside searching score ftw, page
cache, less clutter.

On 14 February 2011 14:36, andy_the ultimate baker
anandghaywankar...@gmail.com wrote:
 hi,
 i am very sory to say that the new cake book is not helping as it was
 before,
 so many issues, its not even user friendy.
 it sah no proper search box, no tree structure index fo containts, and
 not even eye catching view.
 what u say gyes??

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


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


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


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


Re: reading new cake book is painful than the old one.

2011-02-13 Thread andy_the ultimate baker
i know it requires java script enabled i have it,
but u really examine it properly, the cursor in text box goes
somewhere and the result comes out is not also in proper view.

where is the tree structure i could not see it, and neither many other
sitting beside me?



On Feb 14, 11:48 am, Miles J mileswjohn...@gmail.com wrote:
 There is a tree structure and search on the left sidebar.

 It requires JS enabled to work correctly.

 On Feb 13, 10:36 pm, andy_the ultimate baker

 anandghaywankar...@gmail.com wrote:
  hi,
  i am very sory to say that the new cake book is not helping as it was
  before,
  so many issues, its not even user friendy.
  it sah no proper search box, no tree structure index fo containts, and
  not even eye catching view.
  what u say gyes??

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


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


Re: Variable scope problem

2011-02-13 Thread Jeremy Burns | Class Outfit
I have a couple of suggestions - unless I am missing the point here.

Is category_id a field on the subcategories table? If so, presumably it's in 
$this-data, so why not just collect the value from there?

You can then use model validation to check it is populated. If it isn't, send 
the user back to the edit view with an appropriate error message. If it is 
there, this bunch of code:

App::import('Model','Category');
$cat = new Category();
$category = $cat-field('title', array('id' = $categoryID));
$this-set('category', $category);

..can be rewritten as follows:

$category = $this-Subcategory-Category-field('title', array('id' = 
$this-data['Subcategory']['category_id']));

I'd also say that you picking up the value of $category before checking for the 
presence of $id. If $id is missing you are redirecting out of there anyway; so 
move the $category code down a bit to save unnecessary work. 


Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 14 Feb 2011, at 06:28, adam_g2000 wrote:

 The edit method in my controller is successfully being passed a
 variable called $categoryID. I'm using the variable to query another
 model, which happens successfully and the title field from the model
 is displayed in the view via the variable defined here.
 
 App::import('Model','Category');
 $cat = new Category();
 $category = $cat-field('title', array('id' = $categoryID));
 $this-set('category', $category);
 
 My problem arises in the second if statement in the method. By the
 time I need the variable to pass through redirect it seems to have
 fallen out of scope and I cannot figure out why - the variable appears
 to be empty.
 
 Here is the method.
 
   function edit($id = null, $categoryID = null) {
   App::import('Model','Category');
   $cat = new Category();
   $category = $cat-field('title', array('id' = $categoryID));
   $this-set('category', $category);
   if (!$id  empty($this-data)) {
   $this-Session-setFlash(__('Invalid subcategory', 
 true));
   $this-redirect(array('action' = 'index'));
   }
   if (!empty($this-data)) {
   if ($this-Subcategory-save($this-data)) {
   $this-Session-setFlash(__('The subcategory 
 has been saved',
 true));
   $this-redirect(array(
   'controller' = 'subcategories',
   'action' = 'index',
   $categoryID
   ));
   } else {
   $this-Session-setFlash(__('The subcategory 
 could not be saved.
 Please, try again.', true));
   }
   }
   if (empty($this-data)) {
   $this-data = $this-Subcategory-read(null, $id);
   }
   $categories = $this-Subcategory-Category-find('list');
   $resources = $this-Subcategory-Resource-find('list');
   $this-set(compact('categories', 'resources'));
   }
 
 Please be gentle, I've spent a couple of months now reading the
 cookbook and a textbook and a series of tutorials - though I am a
 newbie! If anyone can offer any assistance and point out why this
 might be I'd be very grateful. Thanks in advance.
 
 Adam.
 
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
 
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

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


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


Re: reading new cake book is painful than the old one.

2011-02-13 Thread Ryan Snowden
Adblock enabled? Tried different browsers? Using a proxy? Any jS Errors?

On 14 February 2011 15:06, andy_the ultimate baker
anandghaywankar...@gmail.com wrote:
 i know it requires java script enabled i have it,
 but u really examine it properly, the cursor in text box goes
 somewhere and the result comes out is not also in proper view.

 where is the tree structure i could not see it, and neither many other
 sitting beside me?



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


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


Re: reading new cake book is painful than the old one.

2011-02-13 Thread nurvzy
I like the new book, but I agree it needs a little polish. I've tried
to edit it a few times to add some more information and I was met with
a white screen of death each time. With Chrome and FF. Happened after
requiring login. Then I couldn't get to the book at all without a
white screen. Cleared cache and cookies, logged in first, then was
able to get to the edit screen. Added the text to be approved, hit
submit and was met with another white screen of death. I just gave up
in it.

Looks good though.

Nick



On Feb 14, 12:06 am, andy_the ultimate baker
anandghaywankar...@gmail.com wrote:
 i know it requires java script enabled i have it,
 but u really examine it properly, the cursor in text box goes
 somewhere and the result comes out is not also in proper view.

 where is the tree structure i could not see it, and neither many other
 sitting beside me?

 On Feb 14, 11:48 am, Miles J mileswjohn...@gmail.com wrote:



  There is a tree structure and search on the left sidebar.

  It requires JS enabled to work correctly.

  On Feb 13, 10:36 pm, andy_the ultimate baker

  anandghaywankar...@gmail.com wrote:
   hi,
   i am very sory to say that the new cake book is not helping as it was
   before,
   so many issues, its not even user friendy.
   it sah no proper search box, no tree structure index fo containts, and
   not even eye catching view.
   what u say gyes??

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


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


Re: Variable scope problem

2011-02-13 Thread Jeremy Burns | Class Outfit
I know you've already had a few replies, but can you outline in a simple 
non-code sentence exactly what you are trying to achieve (rather than why your 
code isn't working)?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 14 Feb 2011, at 06:28, adam_g2000 wrote:

 The edit method in my controller is successfully being passed a
 variable called $categoryID. I'm using the variable to query another
 model, which happens successfully and the title field from the model
 is displayed in the view via the variable defined here.
 
 App::import('Model','Category');
 $cat = new Category();
 $category = $cat-field('title', array('id' = $categoryID));
 $this-set('category', $category);
 
 My problem arises in the second if statement in the method. By the
 time I need the variable to pass through redirect it seems to have
 fallen out of scope and I cannot figure out why - the variable appears
 to be empty.
 
 Here is the method.
 
   function edit($id = null, $categoryID = null) {
   App::import('Model','Category');
   $cat = new Category();
   $category = $cat-field('title', array('id' = $categoryID));
   $this-set('category', $category);
   if (!$id  empty($this-data)) {
   $this-Session-setFlash(__('Invalid subcategory', 
 true));
   $this-redirect(array('action' = 'index'));
   }
   if (!empty($this-data)) {
   if ($this-Subcategory-save($this-data)) {
   $this-Session-setFlash(__('The subcategory 
 has been saved',
 true));
   $this-redirect(array(
   'controller' = 'subcategories',
   'action' = 'index',
   $categoryID
   ));
   } else {
   $this-Session-setFlash(__('The subcategory 
 could not be saved.
 Please, try again.', true));
   }
   }
   if (empty($this-data)) {
   $this-data = $this-Subcategory-read(null, $id);
   }
   $categories = $this-Subcategory-Category-find('list');
   $resources = $this-Subcategory-Resource-find('list');
   $this-set(compact('categories', 'resources'));
   }
 
 Please be gentle, I've spent a couple of months now reading the
 cookbook and a textbook and a series of tutorials - though I am a
 newbie! If anyone can offer any assistance and point out why this
 might be I'd be very grateful. Thanks in advance.
 
 Adam.
 
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
 
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

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


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