Layout and Views

2011-09-23 Thread Claudia Demers
Hello Folks,

I am kinda new with CakePHP and I still try to figure out how to set
you layout with your view. There so many tutorials but no one talk
about it. Ok, we got it how to make a blog and all, but HOW integrate
your layout, set page title of the page and all those things.

Thank you so much
Claudia

-- 
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: localization

2008-09-17 Thread Claudia

Hi there

I haven't read the article, so I am not sure whether this fits in with
whatever the article says.
I always use utf-8 as character encoding and never had any troubles
with Cake localisation.

In the views you simply use the function __() (or one of the other
translation functions)
to get the translations of your messages. Just remember to enable l10n
in the corresponding controllers.

The models are a bit more complicated, as you cannot call a function
in the declaration of a class member (the $validate array).
I simply gave the appModel a function loadValidation which is called
in the constructor. This loadValidation() function then fills the
class member $validate with the validation array.

Please note that I had to load L10n already in the bootstrap, as
otherwise the error messages always appear in the default language
(english).
I believe this is because the models are loaded before the
controllers, but I am not sure.

I use Cake 1.2.0.5427alpha

Good luck

Claudia

On Sep 17, 2:28 am, cem [EMAIL PROTECTED] wrote:
 Hi ;
   I am reading the localization article in the cakePHP . And in that
 article it says that I have to include the uses('L10n'); in the
 controllers I want to use . But I want to change the validation errors
 in the models and some messages in the views what should I do ?

  The second question about that is it is using the ISO639-2 character
 encoding . What should I put in the doctype of my default.ctp ? Can
 anyone give me an example of Doctypes in Cakephp ? For various
 Languages please ?
--~--~-~--~~~---~--~~
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: Model find() and a BETWEEN clause

2008-09-10 Thread Claudia

It is a bit different from your example but here is how I use between:
$startDateCond = array('Event.start_date' = 'BETWEEN ' . UDAYSTART .
' AND ' . (UDAYSTART + MONTH + MONTH));

The resulting SQL is something like:
(`Event`.`start_date` BETWEEN '1218405600' AND '1226181600')

which works fine.

Cake version is 1.2.0.5427alpha

Claudia


On Sep 10, 4:32 am, Daniel [EMAIL PROTECTED] wrote:
 Hello everyone,

 I'm trying to perform a find operation on my 'event' model in order to
 retrieve events that fall within a specific date range. I've read
 the manual on the process to do complex find conditions but thus far
 I've been unable to get it to generate working SQL code that will
 accomplish my goal.

 The following is my find statement (here's to hoping the formatting
 sticks somewhat) :

 $events = $this-Event-find('all', array('recursive' = 1,
                         'conditions' = array(
                           'User.id' = $currUser['id'],
                         'or' = array(
                           'Event.startTime BETWEEN ? AND ?' =
 array($bottomSearchBound,$topSearchBound),
                           'Event.endTime BETWEEN ? AND ?' =
 array($bottomSearchBound,$topSearchBound)
                       )
                     )
             ));

 The sql it generates (snipped version) is as follows:

 WHERE `User`.`id` = 7 AND ((`Event`.`startTime BETWEEN ? AND ?` IN
 ('2008-08-01', '2008-10-01') ) OR (`Event`.`endTime BETWEEN ? AND ?`
 IN ('2008-08-01', '2008-10-01') ))

 And the error it generates is:

 Warning (512): SQL Error: 1054: Unknown column 'Event.startTime
 BETWEEN ? AND ?' in 'where clause'

 Obviously the ? token replacement isn't being completed
 successfully.

 Any help would be _greatly_ appreciated!

 - Daniel
--~--~-~--~~~---~--~~
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: Problems using Postgres with cake

2008-08-29 Thread Claudia

Hi there

Most likely this means that your PHP does not have the postgres
library installed.
You can check that quickly checking the information returned by
phpinfo(),
if postgres is enabled there should be a block with some information
about it.

Claudia

On Aug 29, 4:57 pm, phanorcoll [EMAIL PROTECTED] wrote:
 hello,

 im trying to use postgres with cake, but when i configure de
 database.php file and chance mysql for postgres, i get the following
 error:

 Fatal error: Call to undefined function pg_connect() in /Library/
 WebServer/Documents/cake_app/cake/libs/model/datasources/dbo/
 dbo_postgres.php on line 114,

 do i have to configure a path somewhere?

 im using the latest postgres version on a mac
--~--~-~--~~~---~--~~
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: Mod_Rewrite problem...

2008-07-11 Thread Claudia

Just for explanation - I think the following happened:

Your original htaccess:

IfModule mod_rewrite.c
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
/IfModule

This means that
- if the requested file is not a directory (RewriteCond %
{REQUEST_FILENAME} !-d)
- and if the requested file is not a file (RewriteCond %
{REQUEST_FILENAME} !-f)
- then apply the rewrite rule to send everything to htaccess
(RewriteRule ^(.*)$ index.php?url=$1 [QSA,L])

Problem:
The url 'localhost' maps to a directory for apache, so the rewrite
rule was never applied.

Then you added a silly rewrite rule to your htaccess:
IfModule mod_rewrite.c
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^silly\.html$ /exists.html [L]
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
/IfModule

A rewrite condition always applies just to the first rewrite rule that
comes after the condition(s),
so now the conditions were only applied to the silly rewrite rule.
That again means that everything was now directed to the index.php,
also your pictures and css files.

Now you added index.php as DirectoryIndex. This means that whenever
you supply a directory
without a filename in the url, apache looks for the file index.php in
this directory. So if you now request
http://localhost, the rewrite rule still will not apply, but as apache
uses the index.php anyway,  this does not matter.

When you request any cake url like http://localhost/foo, the rewrite
condition evaluates to true
(as the directory foo is neither a directory nor a file) and thus the
rewrite rule is applied.


Hope it helps you understand what was actually going on.

Claudia


On Jul 11, 3:05 pm, Hitsugaya [EMAIL PROTECTED] wrote:
 Hey there, im been working on this problem for some time now and i
 solved it. It turns out mod_rewrite was working properly from the
 verry start accept somehow it is was not property sending me to the
 CakePHP mainpage onhttp://localhost/, i still get the directory
 listing.

 But when i dithttp://localhost/somethingi get a new page saying
 missing somethingcontroller. So i figured...euh...it...it..it´s
 working!! Only problem is that i got the directory listing. After some
 googling and searching the apache conf i fount the following:
 DirectoryIndex. entered index.php there and now all is working. Still
 don´t quite know why that change was needed but im not complaining
 since its working. Now i can finally start brushing up my PHP skills
 and doing some coding.

 I just thought i post the solution to support other starting people. I
 wanna thank everybody posting in this thread for helping out, hope is
 can return the favor sometime. Cheers!

 On 8 jul, 19:37, Hitsugaya [EMAIL PROTECTED] wrote:

  I've been trying, yet again, to get mod_rewrite to work. Now i've gome
  accros something that is to me (begin a apache AND mod_rewrite noob)
  quite strange:

  I have the following file:
  C:/Program Files/Apache Group/Apache2/htdocs/cakePHP/app/
  webroot/.htaccess with the following content:
  IfModule mod_rewrite.c
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
  /IfModule
  When i hithttp://localhost/iget a directory listing off: :/Program
  Files/Apache Group/Apache2/htdocs/cakePHP/app/webroot
  This i think means that mod_rewrite is not functioning correclty.

  BUT, now comes the crazy thing: when i change the file to:

  C:/Program Files/Apache Group/Apache2/htdocs/cakePHP/app/
  webroot/.htaccess with the following content:
  IfModule mod_rewrite.c
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^silly\.html$ /exists.html [L]
  RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
  /IfModule

  I've added a second rewrite rule wich is a dummy rule (it makes
  absolutely no sense :P) BUT when i now hithttp://localhost/iget my
  CakePHP mainpage!!!

  That indicates that mod_rewrite now is working. However, with this
  little hack all images and styles dissapear. I googled it and i think
  a .htaccess file can only have one rewrite rule.
  Then howcome that the .htaccess file finally does what i needs to do
  when i add a second rewrite rule? I think that something is wrong with
  that file but i don't know what.

  Help would be GREATLY appriciated!

  On 8 jul, 14:38, Hitsugaya [EMAIL PROTECTED] wrote:

   I think they are. Just to be sure...there are .htaccess files in:

   C:/Program Files/Apache Group/Apache2/htdocs/cakePHP (the root folder
   of cakePHP). Content:
   IfModule mod_rewrite.c
  RewriteEngine on
  RewriteRule^$ app/webroot/[L]
  RewriteRule(.*) app/webroot/$1 [L]
   /IfModule

   C:/Program Files/Apache Group/Apache2/htdocs/cakePHP/app. Content:
   IfModule

Re: view caching problem

2008-03-05 Thread Claudia

That sounds good - thank you.

Claudia

On Mar 4, 6:34 pm, Christian Winther [EMAIL PROTECTED] wrote:
 Hello,
 I believe that the code is in the file to make sure that Components ect. are 
 run even if the page is cached (Might be useful for auth amongst many things).

 https://trac.cakephp.org/ticket/4245andhttps://trac.cakephp.org/ticket/2329discusses
  this issue already.

 I have made a modified CacheHelper (1.2x) that does not add the php in the 
 top if there is no cake:nocache blocks.

 http://cakephp.dk/app/webroot/patches/cache.phps

 -Original Message-
 From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Claudia
 Sent: 4. marts 2008 18:09
 To: Cake PHP
 Subject: view caching problem

 Hi there

 I have a question regarding view caching:
 I have a controller foo where I want to cache the result of action
 bar.
 Therefore I put a line
 $this-cacheAction = 3600;
 in the action.
 The cache file is created fine, but when I fetch a page from the cache
 it takes almost as much time as without caching, about 0.2 seconds.
 I have confirmed that the file comes from the cache.

 When I check the cache file I see that there is a lot of php in there,
 starting with
 loadController('foo');
 loadModels();
 $this-controller = new fooController();
 $this-controller-plugin = '';
 $this-controller-_initComponents();
 ...

 which needs a lot of time to execute. The php is then followed by the
 html output of the view.
 If I delete the php part of the cache file manually and reload the
 webpage, the page is pretty
 fast (about 0.02 seconds) and everything works fine until the cache
 file is recreated.

 Thus my question(s):
 What is the purpose the PHP part of the cache file?
 In case the PHP part is not really necessary, is there a way to tell
 Cake to cache only the output of the view, without adding the PHP
 stuff?

 I use Cake 1.2.0.5427alpha

 Thank you

 Claudia
--~--~-~--~~~---~--~~
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: short answer question: how to create a function definition/call

2008-03-04 Thread Claudia

Hi there

This would be way easier to answer if you would post the code where
you define the function and where you call it.
Generally you would call such a function like this:
$this-User-MYFUNC()

$this is the Userscontroller, the controller has the attached model as
property,
so you can access the model with $this-User
and then you call the function on the model:
$this-User-MYFUNC()

If that does not work for you, post some code.

Claudia

On Mar 4, 6:09 am, yohann305 [EMAIL PROTECTED] wrote:
 hey poeple,
 this is the first time i ask something in here.
 neway, here is the deal.
 I'm defining a function MYFUNC inside the User model.
 Then i try to call it from a function INDEX inside the controller, and
 i get the Call to undefined function: message

 There is a scope problem isnt it?
 whats the solution, pretty please
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



view caching problem

2008-03-04 Thread Claudia

Hi there

I have a question regarding view caching:
I have a controller foo where I want to cache the result of action
bar.
Therefore I put a line
$this-cacheAction = 3600;
in the action.
The cache file is created fine, but when I fetch a page from the cache
it takes almost as much time as without caching, about 0.2 seconds.
I have confirmed that the file comes from the cache.

When I check the cache file I see that there is a lot of php in there,
starting with
loadController('foo');
loadModels();
$this-controller = new fooController();
$this-controller-plugin = '';
$this-controller-_initComponents();
...

which needs a lot of time to execute. The php is then followed by the
html output of the view.
If I delete the php part of the cache file manually and reload the
webpage, the page is pretty
fast (about 0.02 seconds) and everything works fine until the cache
file is recreated.

Thus my question(s):
What is the purpose the PHP part of the cache file?
In case the PHP part is not really necessary, is there a way to tell
Cake to cache only the output of the view, without adding the PHP
stuff?

I use Cake 1.2.0.5427alpha

Thank you

Claudia

--~--~-~--~~~---~--~~
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: Missing Controller ... Why What How

2008-02-22 Thread Claudia

Check whether you named the class correctly and whether the
permissions of the file are ok.
Claudia

On Feb 22, 10:16 am, Comida411 [EMAIL PROTECTED] wrote:
 I am getting the following error...

 Missing Controller

 Error: AccountsController could not be found.

 Error: Create the class AccountsController below in file: app
 \controllers\accounts_controller.php

 You can already guess the problem.. of course I have that controller
 in the appcontoller folder.. Why can't cake see it..  I already
 checked on spelling

 Helpme
 Thak you
 Comida

 mu contoller is names accounts_controller.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: Problem merging arrays. String-keys are cast as numners.

2008-02-07 Thread Claudia

I am not sure whether this will bring the desired result but have a
look at the union operator
http://lu.php.net/manual/en/language.operators.array.php

Good luck

Claudia

On Feb 7, 4:07 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 This is not strictly a CakePHP question but I hope that is OK.

 I am trying to merge two arrays. One containing dummy-data for each
 hour of the day, the other containing actual data extracted from a
 model for only some hours.

 All keys are strings but keys that looks like nice integers to php
 gets treated as such. That sucks. I specifically set them as string
 for a reason. for a number of good and bad reasons I really don't want
 to rethink everything around this by using all numbers. I also would
 like to avoid using another for-loop when there are merge-functions.

 Is there a way to get array_merge() or Set::merge() to comply?
 Is there a way to merge these two arrays in the way I would expect
 them to be merged?

 code:
 Part of the dummy array
 (
 [08] = 0
 [09] = 0
 [10] = 0
 [11] = 0
 [12] = 0
 )
 Part of the data to merge int it
 (
 [10] = 5
 [12] = 3
 [09] = 4
 )
 Value '09' is padded and thus still a string. 10 and 12 is treated as
 numbers (dispite being generated as strings) and totally mess up the
 resulting array. The mess is different depending on the merge function
 I use.
--~--~-~--~~~---~--~~
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 on ubuntu

2008-01-23 Thread Claudia

Hi there

Most likely there are no read permissions on the cake folder and/or
its content.
Mot ftp programs allow to set permissions by making a right
click on the folder and then selecting permissions from the submenu.
If you have only shell access you can use the chmod command.

It is working fine in Windows because Windows usually does not care
about permissions.

Claudia

On Jan 23, 8:56 am, Nil [EMAIL PROTECTED] wrote:
 Hi,
  I am trying to run my Cakephp script on ubuntu but when I give URL
 for my script then following error message is display.

 Warning: require(cake/config/paths.php) [function.require]: failed to
 open stream: Permission denied in /var/www/hoteljobs/index.php on line
 56

 Fatal error: require() [function.require]: Failed opening required
 'cake/config/paths.php' (include_path='.:/usr/share/php:/usr/share/
 pear:/var/www/hoteljobs:/var/www/hoteljobs/app/') in /var/www/
 hoteljobs/index.php on line 56

 I dont know what is the problem in index.php.
 This application on windows is working but no luck on ubuntu.

 Can anybody help me.

 Thanks in advance.
--~--~-~--~~~---~--~~
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: query on a component?

2008-01-23 Thread Claudia

Hi there

You cannot make a query on a controller, only on a model.

Assuming that the model related to this controller is called Post,
you can try using $this-controller-Post-query(...)

I haven't tried this yet, but it might work.

A better idea might be to write a method in the controller that makes
the query
and returns the result. Then use this method in your component.

Claudia


Claudia

On Jan 23, 9:30 am, Louie Miranda [EMAIL PROTECTED] wrote:
 Am i wrong?

 On Jan 23, 2008 1:37 PM, Louie Miranda [EMAIL PROTECTED] wrote:



  I am trying to query some table on a component. But, this error keeps on
  showing up.

  *Fatal error*: Call to undefined method PostsController::query() in *
  /site/www/app/controllers/components/web_logs.php* on line *21*

  My code:

  *my controller (note: i already declared WebLogs on var $components =
  array('WebLogs');*

   *$this-WebLogs-ActivityLog('[EMAIL PROTECTED]'); // get from
   session*

  *my component*

   *class WebLogsComponent extends Object {

   var $controller = true;

   function initialize($controller) { // used initialize, instead of
   startup?
   $this-controller = $controller;
   }

   function ActivityLog($username) {
   $this-controller-query(select * from table where username =
   '$username'); // check mysql.log if it is being executed
   ..
   return true;
   }
   }*

  Please help!

  --
  Louie Miranda ([EMAIL PROTECTED])
 http://www.axishift.com

  Security Is A Series Of Well-Defined Steps
  chmod -R 0 / ; and smile :)

 --
 Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com

 Security Is A Series Of Well-Defined Steps
 chmod -R 0 / ; and smile :)
--~--~-~--~~~---~--~~
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: parameters help needed

2008-01-23 Thread Claudia

The form submits to whatever you supply in the action attribute of the
form tag.
So simply include the parameters in the url of the action attribute.

Claudia

On Jan 23, 9:09 am, bob [EMAIL PROTECTED] wrote:
 if i have the url as follows
 localhost/controller/action/param1/param2

 and i also have a form and a submit button and i am doing a POST.

 If i press the submit button, the url becomes localhost/controller/
 action/ (without the param1 and param2)

 How do i keep the parameters intact after the form submit?

 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: Simple GROUP BY ?

2008-01-21 Thread Claudia

Hi there

Something like this might work (untested):
$conditionsArr = array('HotelDescriptionPhoto.hotel_id' = $hotel_id,
   '1=1 GROUP BY HotelDescriptionPhoto.photo_id');

$hotel = $this-Hotel-findAll($conditionsArr);

Although you should make sure that you really need a group by -
grouping by one column when selecting multiple columns often yields
arbitrary results.

Good luck

Claudia


On Jan 20, 11:10 pm, cronet [EMAIL PROTECTED] wrote:
 Hi,

 I'm siting here for about 2 hours and get it not work. I need a simple
 group by in an association.

 This is in my controller:

 $this-Hotel-bindModel(
array('hasMany' =
 array(
 'HotelDescriptionTranslation' = array(
 'className' =
 'HotelDescriptionTranslation',
 'foreignKey' = 
 'hotel_id',
 'conditions' = $cond1
   
   ),
 'HotelDescriptionPhoto' = array(
 'className' = 
 'HotelDescriptionPhoto',
 'foreignKey' = 'hotel_id',
 'conditions' =
 $cond2
)
 )
 ), FALSE
 );
 $hotel = $this-Hotel-findByHotelId($hotel_id);

 Results in this query:

 SELECT `HotelDescriptionPhoto`.`id`,
 `HotelDescriptionPhoto`.`descriptiontype_id`,
 `HotelDescriptionPhoto`.`hotel_id`,
 `HotelDescriptionPhoto`.`photo_id`,
 `HotelDescriptionPhoto`.`url_max300`,
 `HotelDescriptionPhoto`.`url_original`,
 `HotelDescriptionPhoto`.`url_square60`,
 `HotelDescriptionPhoto`.`created`, `HotelDescriptionPhoto`.`modified`
 FROM `hotel_description_photos` AS `HotelDescriptionPhoto` WHERE
 (descriptiontype_id = '5' OR descriptiontype_id = '10') AND
 `HotelDescriptionPhoto`.`hotel_id` IN (60160)

 But I need a GROUP BY `HotelDescriptionPhoto`.`photo_id` inside the
 query...

 Is there an easy(?!) way to achieve this? (I would not want to create
 a custom query)...

 Regards,
 Alexander
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



prevent parsing of query parts

2008-01-04 Thread Claudia

Hi there

Is there a way to prevent Cake from parsing the $order argument of a
call to findAll?
Example:
$conditions = null;
$fields= null;
$order= 'Object__distance::text::integer';

$model-findAll($conditions, $fields, $order);

The resulting order by clause produced by Cake is
ORDER BY Employee__distance::text::integer
Note the unnecessary (and unterminated) quotation mark at the end
which messes up the SQL.

I have tried prepending the order statement with a -! as this seems to
prevent CakePHP from parsing the condition part of queries but this
workaround does not help for the order part.

I know that I can write the SQL statement manually and then use $model-
query() But I would rather use as much cake as possible.

Thanks for any tips

Claudia
--~--~-~--~~~---~--~~
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: js and css packager for cake 1.1?

2007-11-20 Thread Claudia

Hi there

I don't know whether there is a packager/minifier for Cake1.1.
Nevertheless have a look here:
http://www.ejeliot.com/blog/72
This should be pretty easy to adapt to Cake 1.1.

Good luck

Claudia


On Nov 19, 4:54 pm, keymaster [EMAIL PROTECTED] wrote:
 Does anyone know of any packager for js/css for cake 1.1?

 What have people done in 1.1 to reduce http requests for multiple js/
 css files?

  (I know there are a couple in the bakery for cake 1.2, but alas, we
 are still in 1.1)

 Thanks very much.
--~--~-~--~~~---~--~~
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: findall on 3 models chained with belongsto

2007-11-06 Thread Claudia

Hi there

Thanks for your answers.

I am not that worried about the number of queries although the 20 was
just an example.
Although on the index page of my website I would have around 200 extra
queries which (during testing)
sometimes causes a page delay of about half a second - not a huge
problem but not very good.
The bigger problem is that I cannot have the query conditions that I
want (with some conditions
being in the first model, some in the second and some in the third).
I'll have a look at the dbo-patch
the AD mentioned in the reply as this seems to solve this problem.

Thanks again

Claudia

On Nov 6, 10:09 am, AD7six [EMAIL PROTECTED] wrote:
 On Nov 5, 4:33 pm, Claudia [EMAIL PROTECTED] wrote:



  Hi there

  I have three models that are chained with belongsTo in one direction
  and hasMany in the other direction:
  Model1 belongsTo Model2 belongsTo Model3
  and
  Model3 hasMany Model2 hasMany Model1

  Now I need to query model1 and also get the related data from model2
  and model3 which can be easily achieved by settings model1-recursive
  = 2 and then use model1-findall.
  The resulting SQL ( I use postgres but mysql should be similar):
  Cake makes a join on the model1 and model2, keeps the resulting ids of
  the entries in model2, then makes a query for each of these ids on
  model2 and a query for the related model3.

  This causes two problems:
  a) I cannot restrict the result depending on some columns on model3 as
  the first query fails with 'missing from-clause entry for table
  model3'.

 Some interesting 
 reading:https://trac.cakephp.org/ticket/633http://lloydhome.com/blog/archives/2007/02/Recursive-Association-Supp...

  b) The query is really inefficient: Example: If the first query
  returns 10 results we need 21 queries for in total (the join query and
  then 10 queries each for model2 and model3). We could get the same
  result by having only one query which uses a left join for joining
  model1 and model2 and another left join for joining model2 and model3.

  I have found a trac issue regarding this but it was closed as 
  wontfix:https://trac.cakephp.org/ticket/2931

 Reducing the number of queries isn't the be all and end all. as
 clearly stated in that ticket if you attach a patch to it it'll be
 marked as an enhancement and considered.

 hth,

 AD


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



findall on 3 models chained with belongsto

2007-11-05 Thread Claudia

Hi there

I have three models that are chained with belongsTo in one direction
and hasMany in the other direction:
Model1 belongsTo Model2 belongsTo Model3
and
Model3 hasMany Model2 hasMany Model1

Now I need to query model1 and also get the related data from model2
and model3 which can be easily achieved by settings model1-recursive
= 2 and then use model1-findall.
The resulting SQL ( I use postgres but mysql should be similar):
Cake makes a join on the model1 and model2, keeps the resulting ids of
the entries in model2, then makes a query for each of these ids on
model2 and a query for the related model3.

This causes two problems:
a) I cannot restrict the result depending on some columns on model3 as
the first query fails with 'missing from-clause entry for table
model3'.
b) The query is really inefficient: Example: If the first query
returns 10 results we need 21 queries for in total (the join query and
then 10 queries each for model2 and model3). We could get the same
result by having only one query which uses a left join for joining
model1 and model2 and another left join for joining model2 and model3.

I have found a trac issue regarding this but it was closed as wontfix:
https://trac.cakephp.org/ticket/2931

Any tips on how to solve this?

I use Cake 1.2.0.5427alpha.


Claudia


--~--~-~--~~~---~--~~
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: Can i have url like domain/username

2007-10-31 Thread Claudia

You can set up a custom route like this (Cake 1.2 alpha):

Router::connect('/:username', array('controller' = 'users', 'action'
= 'showUserPage'));

This will connect all Urls http://domain/USERNAME to the controller
users and the action showUserPage.
The username part of the url is then available via $this-
params['username'].

Please note that this serves as kind of catchall - no matter what you
specify in the url, it will be routed to your users controller. So if
you need other controllers, you need to specify the route to these
controllers before this route but as mentioned before in this case you
can't have users with the same name as these controllers.

Claudia

On Oct 31, 6:27 pm, MrTufty [EMAIL PROTECTED] wrote:
 All things are possible with CakePHP. Well, almost - it won't make
 your dinner for you or anything.

 You need to look into custom routes, which you can set up in /app/
 config/routes.php - that's about as much as I can tell you, because
 I'm not 100% experienced with that aspect of Cake myself yet. But as
 far as I can see, this would be very much possible.

 One thing you should be aware of though - if you set up the routing
 for this, you should also block users from having names which would
 conflict with your controllers. Otherwise, you're going to run into
 some rather nasty issues.

 Good luck!

 On Oct 31, 11:25 am, HostOnNet.com [EMAIL PROTECTED] wrote:

  Hi,

  I have a web site that have user url like

 http://domain/USERNAME

  I know Cake PHP can handle url like

 http://domain/controller/USERNAME

  I want with out a controller name, likehttp://domain/USERNAME

  Is this possible with Cake PHP ?

  Thanks,

  Yujin


--~--~-~--~~~---~--~~
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: Use Multiple Two Database's Tables In Single Controller...

2007-10-31 Thread Claudia

Maybe this helps?
http://groups.google.com/group/cake-php/browse_thread/thread/eacfade1d52c9071/f5e3c395037043b3

Good luck

Claudia

On Oct 31, 11:35 am, Daivat [EMAIL PROTECTED] wrote:
 Hi,

 I have one major problem for that i am not getting the proper
 solution.

 I need to use two different tables in a single controller, but both
 tables are from two different databases.

 my database.php is as below:

 class DATABASE_CONFIG
 {
 var $default = array('driver' = 'mysql',
 'connect' = 
 'mysql_connect',
 'host' = 
 'localhost',
 'login' = 
 'root',
 'password' = 
 '**',
 'database' = 
 'database1',
 'prefix' = 
 '');

 var $test = array('driver' = 'mysql',
 'connect' = 
 'mysql_connect',
 'host' = 
 'localhost',
 'login' = 
 'root',
 'password' = 
 '**',
 'database' = 
 'database2',
 'prefix' = 
 '');}

 ?

 my model class contains code like below:

 ?php
 class ModelName2 extends AppModel {
 var $name = 'ModelName2';
 var $useDbConfig = 'test';
 //var $useTable = 'model_names';}

 ?

 controller contains:

 class MyController extends AppController {
   var $name = 'My';
   var $uses = array('ModelName1','ModelName2');
...
...
...
...

 }

 But such code give me error like below:
 Fatal error: Cannot redeclare class dbosource in /www/
 */cake/libs/model/datasources/dbo_source.php on line
 1716

 Please help me to fix this problem


--~--~-~--~~~---~--~~
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: Empty page response

2007-10-30 Thread Claudia

I fixed this problem on my (local) machine by changing the translation
function __ in the basics.php file.

The translation function __ uses debug_backtrace() to find out where a
translation was called from which can cause problems in combination
with the zend optimizer extension. But as all the translations for my
app are in the translation file default, I do not need to check
whether the translation is called from.

Therefore I replaced to code of __ by this one:
code
function __($singular, $return = false) {
  if (!class_exists('I18n')) {
uses('i18n');
  }
  if ($return === false) {
echo I18n::translate($singular, null, 'default');
  }
  else {
return I18n::translate($singular, null, 'default');
  }
}
/code

and the translation function __n by this one:
code
function __n($singular, $plural, $count, $return = false) {
  if (!class_exists('I18n')) {
uses('i18n');
  }
  if ($return === false) {
echo I18n::translate($singular, $plural, 'default', 5, $count);
  }
  else {
return I18n::translate($singular, $plural, 'default', 5, $count);
  }
}
/code

Hope it helps

Claudia


On Oct 27, 11:16 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I have submitted a request with my hosting provider. I am hoping he
 will respond soon.

 On Oct 26, 7:01 pm, francky06l [EMAIL PROTECTED] wrote:

  have you tried to ask your hosting peovider ?
  I had the same problem and I asked if I could tweak as follow :

  - having a CGI that would run php using a special .ini (they have done
  it, since I can't control everything in it)
  - make it workd in my htaccess as :

  Action application/x-httpd-php5 /php5.cgi

  the cgi does contain :

  #!/bin/sh
  exec /usr/local/cpanel/cgi-sys/php5 -c /home/mydomain/php.ini

  hope this helps

  On Oct 26, 11:48 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

   Hi,

   As I had written in my previous post:cannot access php.ini as I am
   using a shared hosting.
   So, I need some .htaccess based solution.

   I am running cake 1.1, 1.2-alpha and 1.2-pre-beta on the same server
   but only pre-beta is giving problems.

   regards,
   Prateek

   On Oct 25, 9:15 pm, francky06l [EMAIL PROTECTED] wrote:

To disable Zend optimiser you need to comment the lines in php.ini.

On Oct 25, 5:01 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Hi all,

 I tried the following:

 1. lempReplace __(CakePHP: the rapid development php framework,
 true)  ... did not work

 2. Kuntharadding php_flag display_errors on in .htaccess file ...
 did not work

 3. Zend Optimizer was running. I tried disabling it by adding the
 following lines in .htaccess file. I was not able to disable it.
 php_flag display_errors on
 php_flag zend_optimizer.optimization_level 0
 php_flag eaccelerator.enable 0
 php_flag eaccelerator.optimizer 0
 php_flag zlib.output_compression off

 Does anybody have a better idea of how to disable Zend Optimizer? I
 cannot access php.ini as I am using a shared hosting.
 Zend Optimizer version is 3.2.2.
 This problem only appears on the above server configuration. I am
 running WAMP on my laptop and it does not appear there.

 Still no luck. Thanks to all for your suggestions. If there are any
 other ideas, do let me know.

 regards,
 Rex

 On Oct 25, 2:53 am, francky06l [EMAIL PROTECTED] wrote:

  The zend optimizer fails on the __() ..I had to remove from 
  php.ini
  in order to avoid the crash ..Maybe this is linked.

  On Oct 24, 11:40 pm, lemp [EMAIL PROTECTED] wrote:

   On Oct 24, 6:22 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

After install, when I go to the cake link, a blank page is 
returned.

   Had the same problem.

   In cake/libs/view/templates/layouts/default.ctp at line 59

   Replace __(CakePHP: the rapid development php framework, true) 
   by
   any string and it will work.

   The same function is used on line 45, so I presume the problem is
   contextual but I don't know why yet.

   Someone has a suggestion?


--~--~-~--~~~---~--~~
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: Baffling error when trying to put ACL check in beforeFilter

2007-10-30 Thread Claudia

In case someone else searches for it:
Adding the line
$this-Acl-startup($this);
before the call to $this-Acl-check seems to work fine.

Claudia

On Sep 21, 10:03 pm, 2000Man [EMAIL PROTECTED] wrote:
 What was the final solution to this problem (putting
 parent::beforeFilter(); as first line of code in my
 AppController::beforeFilterdoesn't work)?

 On 30 aug, 12:58, Jon Bennett [EMAIL PROTECTED] wrote:

   ...I think you may be right (from looking at dispatcher.php in the
   cake source code).

   However, that's got me wondering... how do any of those examples
   (including some in the bakery I seem to recall) that putACLcalls in
  beforeFilterever work...?

  add parent::beforeFilter(); above youbeforeFiltercode, eg:

  functionbeforeFilter()
  {
  parent::beforeFilter();
  //

  }

  does that sort it?

  jb

  --

  jon bennett
  w:http://www.jben.net/
  iChat (AIM): jbendotnet Skype: jon-bennett


--~--~-~--~~~---~--~~
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: Error when use $html-image and __()

2007-10-15 Thread Claudia

Have a look here:
http://groups.google.com/group/cake-php/browse_thread/thread/eda86379e16f165e/cea227d8a8602c7c

In short: the translation function __ makes use of debug_backtrace
which sometimes causes Apache to die (especially if you have Zend
optimizer running).
Either use __d as translation function or first create the translation
string and then use the result in the html-image call.

Claudia

On Oct 15, 9:41 am, william [EMAIL PROTECTED] wrote:
 Hello all,
 When I run these code in cake\libs\view\templates\layouts\default.ctp
 ?php echo $html-image('cake.power.png',
 array('alt'=__(test,true), 'border'=0));?

 It made apache died.

 Why I get this fatal error? What is going on?

 Thank you for your help and time!

 William


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



comments for translation

2007-10-01 Thread Claudia

Hi there

I am using the translation function __ in Cake 1.2.

Is there a way to add a comment to a translatable string (in a ctp
file) to provide some context?
Example: The English word 'contact' can mean either the noun contact
or the verb 'to contact' so the French translation would be different
depending on the meaning. At the moment I use strings like
contact_noun or contact_verb which works alright but using the correct
English string would be much easier.

Aside from having a word with multiple meanings it would also be nice
to have context as a help for the translator. Especially if you
translate short phrases it is sometimes difficult to get the supposed
meaning without knowing any context.

Thanks for any tips

Claudia


--~--~-~--~~~---~--~~
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: Form data not being posted ( $_POST not being populated ) after first submission - Driving me INSANE

2007-09-27 Thread Claudia

Hi Jon

Just quick status report: I have just tried with FF 2 on winXP. If I
disable the browser cache it is working fine, if the browser cache is
enabled only the first post goes through, all the others not.
Unfortunately I don't know why though - my forms have a similar setup
and work just fine (without having to set any cache headers or so).
Maybe you could post the relevant part of your controller?

Claudia

Jon Hinson wrote:
 I'm not sure what the nocache trick is. I tried sticking META Http-
 Equiv=Pragma Content=no-cache in my head, adding the hidden
 field with a random value, and adding a random number as a parameter
 to the end of my URL. I'm still getting the same outcome. What's
 weird, even if $_POST isn't being populated, I can refresh Firefox,
 and the popup box that says The page you are trying to view contains
 POSTDATA comes up. So it has been posted to, but I think $this-data
 is not being populated by cake for some reason. If we can somehow find
 out why $this-data is not being populated, we can get to the bottom
 of this.

 Jon

 On Sep 26, 5:56 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Okay, I tried using Galeon a few more times.
 
  1) Enter abc / def
  2) Submit
  3) Page draws with post
  4) Sumbit again.
  5) Page draws with no post (clears fields)
  6) Enter abc / def
  7) Submit
  8) Page draws with post
  9) add d to the end of abc
  10) Submit again
  11) Page draws with post
 
  So maybe it is a cache thing.  maybe try the nocache trick
 
  And if all else fails try sticking this:
 
  ? unset($User['User']['random']); ?
  ?= $html-hidden('User/random', random()) ?
 
  in your form.  As that should change every time.
 
  Jeff


--~--~-~--~~~---~--~~
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 1.2 (latest alpha) persistModel + behavior = Fatal error ?

2007-09-22 Thread Claudia

Hi there

I get the same error as you.I have tried to trace it down and the
problem seems to be
caused by Object::__openPersistent, as this only tries to load models,
even if one of
the unserialized objects is actually a behaviour. Therefore the class
definition of the
behaviour does not exist and PHP can't recreate the object.

A dirty fix might be to check whether the key contains the string
'_behavior' and
in this case load the behavior instead of trying to load a model.
This at least gets rid of the error message, but I don't know enough
yet
about the inner workings of Cake to be know whether doing this is a
good idea.

I'll report a bug about this - let's see what the gurus say.

Claudia


On Sep 5, 10:39 am, thequietlab [EMAIL PROTECTED] wrote:
 can someone do me a favor and try it ? I'd like to know if this is a
 cake bug or I'm doing something wrong.

 Thanks,
 Andrzej


--~--~-~--~~~---~--~~
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: using adodb?

2007-09-22 Thread Claudia

Hi there

The sourcecode of dbo_adodb.php seems to imply that you specify only
'adodb' as driver
and 'mysql' in the parameter 'connect' - maybe you should try this.

Claudia

On Sep 20, 8:39 am, Brent Rieck [EMAIL PROTECTED] wrote:
 Hello,
I'm new to Cake and have a question about how to use adodb rather
 than the default database drivers as I keep getting the following error:

Fatal error: Unable to load DataSource file dbo/dbo_adodb-mysql.php in
/web/websites/asdf/cake/libs/model/connection_manager.php on line 163

I haven't been able to find any working examples of a cake app that
 uses adodb yet, and after searching the google groups archive for hints
 it seems nobody else has had this problem (or if they have they haven't
 posted about it), the manual is a little thin on adodb, and the search
 feature on the cakephp.org website and bakery is broken right now it
 seems too.

 Here's my details:

 I've got a copy of adodb stuffed in vendors/adodb

 Here's the relevant snippet from my app/config/database.php file:

var $default = array('driver'   = 'adodb-mysql',
 'connect'  = 'mysql_connect',
 'host' = 'localhost',
 'login'= 'asdf',
 'password' = 'asdf',
 'database' = 'asdf',
 'prefix'   = '');

 I'm using cake version 1.1.17.5612

 Any ideas?  Am I doing something boneheaded?

 Thanks,
 Brent


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



log php error messages

2007-09-18 Thread Claudia

Hi there

How can I log any notice/warning/error thrown by php?

I know how to log cakeerrors like missing_controller
(I adapted http://www.ad7six.com/MiBlog/EmailMeErrors)
but this does not log any php errors.

What I want to achieve at the end is that the user does not see any
errors
(which is why I have set the debug level to 0) but all error messages
are logged in a logfile.

I use cake 1.2

Thanks for any tips

Claudia


--~--~-~--~~~---~--~~
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: log php error messages

2007-09-18 Thread Claudia

Thanks for your replies.

@AD: The error logs are not filled if debug is set to 0. Of course you
are correct that there should not be any errors in an online page but
it would be nice to be sure about it.

@Marcus: Unfortunately I do not have access to this log. Apart from
that I would like to log additional information for any error so
having a custom error handler would be nice.

Claudia

On Sep 18, 3:00 pm, Marcus T. Jaschen [EMAIL PROTECTED] wrote:
 Claudia wrote:
  Hi there

  How can I log any notice/warning/error thrown by php?

 PHP (not CakePHP) warnings and errors can be logged to syslog or to a
 file, search php.ini for the 'error_log' setting.

 M
arcus


--~--~-~--~~~---~--~~
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: default value for selectbox overrides posted data

2007-09-17 Thread Claudia

Thank you for your answers.

Using 'default' = value in the array does not work,
it looks like this is not used for selectboxes

I'll just set the default value in the controller.

Claudia


On Sep 17, 1:00 am, Grant Cox [EMAIL PROTECTED] wrote:
 Instead of forcing a selected item in the view like that, you should
 provide a default value in your controller.

 either:
 $this-data['Model']['fieldname'] = 'default';

 or:

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

 This second one will get the default values as specified by your
 database table.  Of course, only do either of these where you are not
 loading an existing row, and not re-showing the posted data.

 On Sep 17, 6:12 am, Claudia [EMAIL PROTECTED] wrote:

  Hi here

  I have a few selectboxes where the default value is not the first
  option.
  Thus I provide an option 'selected', e.g.
  $this-Form-input('Model.fieldname', array('options' = range(0, 23),
  'selected' = 7))
  The problem is that when I submit the form and get it back with $this-data 
  being set the selectboxes are still set to the default value,

  not to the value set in $this-data.

  As a quick workaround I have changed the code in FormHelper::select
  but I am wondering whether I am just missing the correct way to use
  the select helper.

  I use Cake 1.2

  Thanks for any tips

  Claudia


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



default value for selectbox overrides posted data

2007-09-16 Thread Claudia

Hi here

I have a few selectboxes where the default value is not the first
option.
Thus I provide an option 'selected', e.g.
$this-Form-input('Model.fieldname', array('options' = range(0, 23),
'selected' = 7))
The problem is that when I submit the form and get it back with $this-
data being set the selectboxes are still set to the default value,
not to the value set in $this-data.

As a quick workaround I have changed the code in FormHelper::select
but I am wondering whether I am just missing the correct way to use
the select helper.

I use Cake 1.2

Thanks for any tips

Claudia


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



query log and requestaction

2007-09-15 Thread Claudia

Hi there

One of my controllers has an action that is only called via
requestaction from within an element. The idea behind is to cache this
element as described in
http://bakery.cakephp.org/articles/view/optimizing-your-cakephp-elements-and-views-with-caching

Generally this approach works fine, the only problem that I have is
that the queries made in the requested action are not displayed in the
query log even if no caching is used. This makes it hard to
troubleshoot any problems with the queries.

Does anyone have an idea why the queries are not in the log and how I
could get them there?

I am using cake 1.2.

Thanks for any hints

Claudia


--~--~-~--~~~---~--~~
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: query log and requestaction

2007-09-15 Thread Claudia

Thanks for your quick reply.
Yes, I am sure that no caching takes place.
I don't use any cache parameter at the moment and
I have also checked the cache directory - no files in there.

But I just remembered that I fiddled around with the sqllog so it
does not mess the html of up my pages - maybe I messed
something up here. As the same setup is working for you
the problem is most likely caused by my fiddling
(although the other queries appear just fine).
I'll check it out and post again if the same happens with
default sql logging.


Claudia


--~--~-~--~~~---~--~~
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: unset unwanted fields

2007-09-14 Thread Claudia

Hi there

I have added a two-dimensional array to each model which
for each action states the fields that are allowed to be saved
in this action.
When I call $this-model-save() in an action, I supply the respective
array entry as second parameter to the save() function which limits
the fields that are used during the save.

I don't know whether there is a cake specific way to do this,
so if you find one, please post it here.


@RichardAtHome: If you just remove the form fields from the ctp file a
malicious user
could still post to the form action using his own form and thus his
own form fields. You
could of course add some checks to verify the integrity of the form
but this can get
complicated really quick.


Claudia


--~--~-~--~~~---~--~~
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/Components not being loaded

2007-08-27 Thread Claudia

Hi Sunny

You are using typographical apostrophes instead of normal single
quotes.

Just replace them by normal quotation marks and it should work.

Claudia


--~--~-~--~~~---~--~~
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: app absolute url

2007-08-23 Thread Claudia

Stupid me - I actually checked the api but by mistake I checked
version 1.1
which does not have the 'full' parameter yet.

Thanks a lot for your help.

Claudia

On Aug 23, 8:38 am, R. Rajesh Jeba Anbiah
[EMAIL PROTECTED] wrote:
 On Aug 22, 8:25 pm, Claudia [EMAIL PROTECTED] wrote: I am facing a similar 
 problem: I want to send a cake-generated email
  with some links to
  my app which need to be absolute.

  When I use $html-url(...) I only get an url relative to my server,
  the protocol and the servername is not included.

   snip

Pass the second param. Check the API declaration.

 --
   ?php echo 'Just another PHP saint'; ?
 Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



call validation on single field

2007-08-23 Thread Claudia

Hi there

Is there a way to ask Cake to validate only a single field (opposed to
validating all fields that are mentioned in the $validate array) ?

I use a model without a table to make use of the validation features
of cake when sending an email. Now I would like to validate an array
of email addresses but the validation rule works only on single email
addresses. Therefore I thought about writing a custom validation rule
that iterates through the array and validates each email address on
its own but I don't know how to call the Cake validation for emails
manually.
Also sometimes I want to validate only a few fields whereas another
time I would like to validate all fields. This could be easily
achieved if it is possible to tell Cake which fields to validate.

I am using Cake 1.2

Thanks

Claudia


--~--~-~--~~~---~--~~
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: app absolute url

2007-08-22 Thread Claudia

Hi there

I am facing a similar problem: I want to send a cake-generated email
with some links to
my app which need to be absolute.

When I use $html-url(...) I only get an url relative to my server,
the protocol and the servername is not included.

Of course I can simple add a
'http://' . $_SERVER['SERVER_NAME']
manually but as said in the previous post this seems to be not very
Cake-ish.

I know that I could always write my own helper that extends the
HTMLHelper::url functionality
but first I want to make sure that the functionality is not there
already.

Thanks

Claudia




--~--~-~--~~~---~--~~
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: app absolute url

2007-08-22 Thread Claudia

Thanks, I did not see this constant before. This saves me typing the
http://

But I still would need to prepend it to the HTMLHelper::url call
which is not very nice.
So it looks a custom helper is really the way to go.

Thanks

Claudia

On Aug 22, 6:29 pm, majna [EMAIL PROTECTED] wrote:
 maybe :
 #cake 1.1.x

 a href=?=FULL_BASE_URL?

 On Aug 22, 5:25 pm, Claudia [EMAIL PROTECTED] wrote:

  Hi there

  I am facing a similar problem: I want to send a cake-generated email
  with some links to
  my app which need to be absolute.

  When I use $html-url(...) I only get an url relative to my server,
  the protocol and the servername is not included.

  Of course I can simple add a
  'http://' . $_SERVER['SERVER_NAME']
  manually but as said in the previous post this seems to be not very
  Cake-ish.

  I know that I could always write my own helper that extends the
  HTMLHelper::url functionality
  but first I want to make sure that the functionality is not there
  already.

  Thanks

  Cl(audia


--~--~-~--~~~---~--~~
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: value attribute in html-file helper

2007-08-14 Thread Claudia

Hi there

as far as I know you cannot set the value attribute of a file
attribute as this would pose quite a security issue (after all you
could upload arbitrary files without letting the user know).

More info here:
http://www.cs.tut.fi/~jkorpela/forms/file.html#value

Claudia


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



hyphen in action part of url

2007-07-04 Thread Claudia

Hi there

I have set up a routing like this:
Router::connect('/pages/:action/*', array('controller' = 'dynPages',
'action' = 'index'));

This works fine if the action does not contain a hyphen. But I have an
url like e.g. /pages/read-me
CakePHP looks for a function read-me in my dynPages controller which
of course does not exist.
I would like to transform the action parameter by replacing the hyphen
with an underscore.
Thus an url like /pages/read-me would call the action read_me.

For now I solved this problem by adding a str_replace in the parse
function of the router class
but I hope that there is a way without hacking core cake files.

Any tips?

Thanks

Claudia


--~--~-~--~~~---~--~~
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 template variables in default.thtml

2007-06-13 Thread Claudia

Thanks a lot - that was exactly what I needed.

Claudia


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



custom template variables in default.thtml

2007-06-12 Thread Claudia

Hi there

I have just started with cakephp so most likely I just don't see the
obvious but where is the controller for the default.thtml?

As far as I understand the default.thtml provides the HTML template
which provides the basic html structure (head, meta-tags and body-tag)
and into this structure the code of all the views are inserted.

Now I would like to use some custom class to create this html
structure which means that I need a place where to include and
instantiate this class. This instance I would then provide as a custom
template variable to the default.thtml template. With other views I
would use the corresponding controller to do this but I don't know how
to do this with the default.thtml.

Thanks

Claudia


--~--~-~--~~~---~--~~
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 template variables in default.thtml

2007-06-12 Thread Claudia

Thanks for the answers.

It looks like I need to describe my problem a little bit better.

If I follow the blog tutorial, I sooner or later create a view
index.thtml for the posts.
The corresponding posts_controller contains a function index() in
which I use
$this-set('posts', $this-Post-findAll());
to set a template variable. This template variable is then available
in the
template index.thtml.

The view index.thtml only creates the html that comes within the body
tag of the final
html output, the rest of this final html file comes from the file
default.thtml which is the
standard layout.

Now I want to change the standard layout:
To override the standard default.thtml I created a copy in the folder
app/views/layouts.

And here is the problem:
I would like to use something like it is done for index.thtml - I want
to set a template
variable that is then available in the default.thtml. An example would
be setting the
meta tags depending on the selected language of the user.

Setting $this-layout in a controller certainly enables me to use
another template file as
layout, but I still do not know how to set template variables into
this layout.

Setting such a variable in a controller for a view might work, but
unless I misunderstand
the suggestion this would mean setting the variable in _every_
controller as I want to have
the template variable always.

Thanks a lot for your help

Claudia


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---