I'd wager its not your code, but CakePHP's security settings. In app/
config/core.php change
Configure::write('Security.level', 'high');
To
Configure::write('Security.level', 'low');
and see if that clears up the problem.
On Jan 27, 2:14 am, MichTex wrote:
> I have been working for a number of months on an application using
> CakePHP, and have for the most part found it to be a very congenial
> development environment. However, for the last few weeks I've been
> struggling with what looks to be some peculiar CakePHP behavior.
> Basically, I am trying to implement keyboard shortcuts (hotkeys) using
> simple Javascript event handling to capture keycodes, and then, via
> the browser's location.href property, route the user to the
> appropriate page. This approach works great most of the time. However,
> there are a couple of users for whom this approach causes the browser
> to route them to the login page rather than the desired page. I have
> rummaged through hundreds of postings here in the CakePHP Google
> group, and done dozens of Google searches through CakePHP
> documentation and numerous relevant blogs, but so far have turned up
> no clues to what the problem is.
>
> Let me expand on the details a little bit:
>
> -The application I am working on mostly provides a few basic screens
> which present blocks of text followed either by simple forms, or by
> sets of link-type or button-type navigation choices. This part of the
> system works very well.
>
> -Recently, the product director wanted me to add hotkeys to speed up
> navigation. For example, in cases where the navigation consists of a
> short list of choices, he wants the user to be able to type a single
> digit associated with each choice. Thus, if there were 5 navigation
> choices, numbered 1 to 5, the user could either use the mouse to click
> on any of the 5 links for those choices, or type the individual digits
> 1 to 5 on the keyboard to select the corresponding link. In another
> case, there is an informational screen with a big Next button at the
> bottom. The product director wants the user to be able to go to the
> next page either by clicking on the Next button with the mouse, or by
> typing either the letter 'n' or a carriage return.
>
> -In order to implement the hotkey idea, I wrote some CakePHP code to
> generate simple Javascript to capture keycodes from keypress events,
> and then execute for particular characters a Javascript line of the
> form
>
> location.href = 'http://mysite.com/controller/action/arg';
>
> which would cause the browser to switch to the specified page. [I used
> the Event class from the Prototype Javascript library together with
> CakePHP's Javascript Helper. I've attached an example of the kind of
> Javascript that gets generated to the end of this posting.]
>
> -When I wrote the hotkey-handling code several weeks ago, it appeared
> to work fine. In fact, it continues to work perfectly for me. Here's
> where it gets weird, though. About 90% of the time, when the product
> director himself tries a hotkey, he ends up on a login screen, as if
> he had been logged out. However, if he hits the back button, and then
> uses the mouse to make a choice on the screen he had been on, that
> works fine. So, he had not in fact been logged out.
>
> -The product director has so far tried this with 3 different browsers
> (IE, Firefox and Chrome) on 5 different machines in 2 different
> locations, and gotten the same bad behavior in roughly the same 90/10
> bad/good behavior split. There are two other people involved with this
> project, as well. For one of them, like me, the hotkeys have never
> failed, while for the other user hotkey navigation has almost always
> worked, but has in fact failed a few times.
>
> So, can anyone provide some insight into this situation? Is there any
> reason why routing to a CakePHP page using Javascript's location.href
> should always work for some users, most of the time for other users,
> and rarely for yet others? Is there an alternative way to route to a
> CakePHP page from Javascript? Or is there some other way to implement
> a hotkey capability?
>
> Thanks in advance for any help or advice you can give.
>
> BillCavnar
> -
> Example of the generated Javascript code for handling hotkeys:
>
>
>
> // Event.observe(window, 'load', function() {
> Event.observe(document, 'keypress', function(e){
> var code;
> if (!e) {
> var e = window.event;
> }
> if (e.keyCode) {
> code = e.keyCode;
> } else if (e.which) {
> code = e.which;
> }
> var character = String.fromCharCode(code);
> switch(character) {
> case '1':
> location.href = 'http://http://mysite.com/worksheet/
> show_answer/1';
> break;
> case '2':
> location.href = 'Re: Calling $html->css() from inside an element
Sorry AD7six, just tried it in an element and the code IS injected
into the header:
view.ctp
element("test") ?>
elements\test.ctp
css("test", array(), null, false) ?>
I'm using the latest stable build of Cake
On Jan 26, 11:33 am, Gonzalo Servat wrote:
> On Mon, Jan 26, 2009 at 9:24 AM, RichardAtHome wrote:
>
>
>
> > Syntax should be:
>
> > echo $html->css( 'right_column', array( 'media' => 'screen' ), null,
> > false );
>
> Not if you're using the last parameter as "false". It just adds it to an
> array which later gets printed in the $scripts_for_layout section so there's
> no need to print it out.
>
> That wasn't the problem though. After speaking with AD7six, basically what
> happens is that the head scripts section is already processed by the time it
> gets to the elements in the layout so I can't use that array unless I want
> to re-work the order in which things are processed in CakePHP (which would
> surely break lots of other stuff). What I had to do was create a head helper
> (AD7six's suggestion) which I would call to add CSS (from the element) and
> later get the CSS (from the layout in the head section).
>
> If anyone wants to see an example of how to include a custom CSS file from
> an element, let me know and I'll do a quick blog on it.
>
> - Gonzalo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
Might be worth re-starting the (web) server. It fixed a 500 error I
was getting a while back. Been fine every since (even after uploading
source updates).
On Jan 26, 1:38 pm, inVINCable wrote:
> Hey,
>
> Ok, I found both of the .htacess files and added "RewriteBase /myapp"
> so my .htacess file looks like:
>
>
> RewriteEngine on
> RewriteBase /myapp
> RewriteRule ^$ webroot/ [L]
> RewriteRule (.*) webroot/$1 [L]
>
>
> I also deleted the cache (just the files) and now I am getting a 500
> Internal Server Error. I have tried this both on my local machine and
> a live server and the same thing happens. Anyone know what I might be
> doing wrong?
>
> On Jan 25, 9:49 pm, Paolo Stancato wrote:
>
> > Find .htaccess files (there are two) and add "RewriteBase /myapp"
> > into mod_rewrite section.
>
> > Regards
>
> > 2009/1/26 inVINCable :
>
> > > Hey all,
>
> > > Very simply question but cannot seem to find the answer. I have the
> > > directory structure and everything in tact in the normal way. However,
> > > on my server I put the entire structure in the /myapp folder in the
> > > document root.
>
> > > Now, everything is all mest up and there is no CSS and files are
> > > missing and such. Surely cake has a simple variable to reflect these
> > > changes? Any advice? I have already looked at the book and the bakery
> > > and have tried things but they have not worked, such as messing with
> > > the variables in the index.php file.
>
> > > I am using version 1.2
>
> > > Thank you for any advice/pointers.
>
> > > Regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
Syntax should be:
echo $html->css( 'right_column', array( 'media' => 'screen' ), null,
false );
On Jan 24, 6:45 pm, Gonzalo Servat wrote:
> Hi All,
>
> I never had the need to do this, but I've come across a situation where it
> comes in handy. I'd like to add a stylesheet for inclusion in
> from an element. This is because the element I'm including is called
> "right_column.ctp" and the CSS to-be-included modifies a few of the styles
> on the main page to accomodate for it. There are probably better ways of
> doing this, and I'd love to hear your suggestions and ways of doing this,
> but for the time being I'd like to find out why I can't include a stylesheet
> from an element. My code looks like this:
>
> $html->css( 'right_column', null, array( 'media' => 'screen' ), false );
>
> I started looking into cake/libs/view/view.php and it looks like the layout
> is rendered before the elements which explains why it doesn't work
> ($this->__scripts is empty at the time that the layout is being rendered).
> Anyone?
>
> Thanks!
> Gonzalo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
$this->Event->find('all',array(
'conditions' =>array(
'event_category_id'=>$catId,
'DATE(Event.event_date) > getdate()'
),
'order'=>array('Event.event_date ASC',
'Event.event_time ASC'
)
) ) ;
On Jan 26, 9:38 am, Martin Westin wrote:
> There are lots of goodies you can use (for MySQL at least).
>
> Datediff is my preferred comparison since it does not fail on leap-
> years and things like that.
> DATEDIFF(date1,date2) > 0
> -> true or false
>
> To construct modified versions of today I sometimes use Addate adn
> Subdate
> ADDDATE(CURDATE(), INTERVAL 4 HOUR)
> -> 2009-01-26 04:00:00
>
> /Martin
>
> On Jan 26, 12:53 am, Parris wrote:
>
> > Hi Everyone,
> > I am just trying to perform a simple query using cakephp. In the
> > conditions array I am trying to filter by dates. The results should be
> > all 'events' that will be today or greater (in other words, any date
> > in the future).
>
> > $this->Event->find('all',array( 'conditions' =>array
> > ('event_category_id'=>$catId,'DATE(Event.event_date)'=>'getdate
> > ()'),'order'=>array('Event.event_date ASC','Event.event_time
> > ASC') ) ) ;
>
> > That is what i have so far. The first condition is just to filter by
> > category. The part I need help with is 'DATE
> > (Event.event_date)'=>'getdate()'). There are no errors. So i guess its
> > kind of working. Also how can i adjust 'today' by 4 hours ?
>
> > Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
"I couldn't see the point in a separate tags table"
What about 2 articles that share the same tags? You run the risk of
tagging either with "one" or "1" (for example) or "CakePHP",
"cakephp", "Cakephp", "cakePHP"...
There's an awful lot of processing happening in your foreach loop.
What happens when you get 10,000 records? or 100,000? A relational
database eats this kind of aggregation for breakfast :-)
On Jan 19, 4:20 pm, leo wrote:
> I couldn't see the point in a separate tags table, so I have a tags
> column on the table that requires it.
>
> To retrieve the tags and tag count, I do this:
>
> function getTagsWithCounts($conditions = array())
> {
> // Return assoc_array(tags) for all records in
> database. Keyed on tagword,
> // value = tagcount
>
> $tagCounts = array();
> $tagRows = $this->findAll($conditions, 'tags');
>
> foreach ($tagRows as $row):
> $tags = explode(',',$row['Event']['tags']);
> foreach ($tags as $tag):
> $tag = trim($tag);
> if (array_key_exists($tag, $tagCounts)):
> $tagCounts[$tag]++;
> else:
> $tagCounts[$tag] = 1;
> endif;
> endforeach;
> endforeach;
> return $tagCounts;
> }
>
> It's simple and it is working on two commercial sites, soon to be four.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
@Webweave. That's the article I was struggling with. I'll drink a few
more cups of coffee and have another look.
I'll use your select field tip in the meantime.
On Jan 18, 3:46 pm, Webweave wrote:
> Easiest way I've found is just to include a select field in the query
> like:
>
> $data = $this->find("all", array(
> "fields"=>array(
> "Tag.id",
> "Tag.name",
> "(select COUNT(Article.id) from
> articles Article where Article.tag_id = Tag.id and Article.published =
> 1) AS tag_count"
> )));
>
> Here's an example of using the
> finderQuery:http://groups.google.com/group/cake-php/msg/c10840be78a34df0
>
> On Jan 17, 12:55 am, RichardAtHome wrote:
>
> > Given the following Model relations:
>
> > article <-- HABTM (articles_tags) --> tag
>
> > How do I fetch back a list of Tags with the count of associated
> > Articles?
>
> > I've tried (in the Tag Model):
>
> > $data = $this->find("all", array(
> > "fields"=>array(
> > "Tag.id",
> > "Tag.name",
> > "COUNT(Article.id) AS tag_count"
> > ),
> > "conditions"=>array(
> > "Article.published" => 1
> > ),
> > "group" => "Tag.id"
> > ));
>
> > But that doesn't generate the HABTM join in the SQL:
>
> > SQL Error: 1054: Unknown column 'Article.id' in 'field list'
> > SELECT `Tag`.`id`, `Tag`.`name`, COUNT(`Article`.`id`) AS tag_count
> > FROM `tags` AS `Tag` WHERE `Article`.`published` = 1 GROUP BY
> > `Tag`.`id`
>
> > Thanks in advance :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
Here's how I break it down:
1) Anything thats on *every* page goes in the layout
2) Anything thats repeated on more than one page but not on all, goes
in an element (and imported into the view with echo $this->element
("foo"))
3) Anything that's unique to a page goes in the view.
So, as an example. Take a blog article page with a header, footer,
article and a sidebar with a tag cloud that displayed on the index &
view pages:
1) Header & footer goes in the layout
2) Tag cloud goes in an element and is imported in the index and view
views.
3) The article itself goes in the view.
Hope this helps :-)
On Jan 18, 3:06 pm, Bankai wrote:
> So, I have all the html laid out.
>
> I want to make it so that I don't have to copy and paste all the html
> every time I create a new page or change the layout in each and every
> page every time I make a change in the html code.
>
> I used to do that in the past with just plain PHP, but I want to make
> it using cakephp.
>
> I am having a hard time doing it with cakephp.
>
> Could somebody guide me in right direction? maybe some tutorial
> anywhere? I tried some Dynamic Content tutorials but it doesn't work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
It's for this very reason I keep championing the case to have ALL
source code on a web page to be presented in a plain text !
And don't get me started on 'smart quotes'! ;-)
On Jan 16, 8:49 pm, clarkphp wrote:
> Figured it out, with the help of a sharper pair of eyes than mine. It
> turns out that the original code did in fact come from a web page -
> the CakePHP manual (I copied, pasted, and edited the table name and
> other code). When I pasted into my text editor, I didn't notice that
> the quote marks were not the regular single quotes. All is good now.
>
> Thanks,
> Clark-
>
> On Jan 16, 7:45 am, clarkphp wrote:
>
> > Hello Martin,
> > Thanks for your reply. My files are all UTF-8. And, no - never touch
> > MS Word - pasted in from browser. Running Linux on dev and production
> > boxes.
> > I also looked at Firefox View Source. The leading mysterious quote
> > mark is the upward curving opening quote, and the trailing one is the
> > downward curving closing quote mark - I'm looking for the character
> > numbers. My source file is using the regular single quote found on
> > the keyboard (not the backtick).
>
> > See how these characters are inserted inside my vanilla-flavored
> > single-quoted string containing the model name, which the inflector is
> > converting to a table name? All references to the model name in my
> > source files are using the regular single quote character. It appears
> > that the undesired characters are being inserted before and after the
> > contents of that string by Cake. I've traced with a debugger to find
> > where the transformation is happening, but am only close to it;
> > haven't nailed it yet.
>
> > One thing I've found is that with PHP error_reporting set high enough,
> > Cake generates a fair number of E_NOTICES regarding undefined
> > constants - the ticket system shows these being fixed on a case-by-
> > case basis. I think those errors are not necessarily related to this
> > problem.
>
> > Thanks again. Does this generate any ideas from you or other readers?
> > - Clark
>
> > On Jan 16, 2:30 am, Martin Westin wrote:
>
> > > Hi Clark,
> > > Looks to me like the thing you are missing is the small problem your
> > > source-file has with its quotes.
>
> > > Use of undefined constant â Organizationâ
> > > This suggests that your modelname is not in fact enclosed by single
> > > quotes but some other glyph that looks like it but really has another
> > > ASCII code. You may have pasted the line of code from a browser or
> > > (god forbid) Word and got the strange character in your file that way.
> > > If the quotes are not "real" quotes then PHP will interpret this as
> > > you trying to use a constant.
>
> > > While you are at it make sure the charset of the php file is not
> > > something strange.
>
> > > /Martin
>
> > > On Jan 16, 12:35 am, clarkphp wrote:
>
> > > > Check out the extra quotes in the model name in the WHERE clause
> > > > below:
>
> > > > SELECT `Organization`.`name`, `Organization`.`description` FROM
> > > > `organizations` AS `Organization` WHERE `‘Organization’`.`status` =
> > > > 'inactive' ORDER BY `Organization`.`name` asc
>
> > > > I've used SimpleTest before, but am now beginning to use it in the
> > > > context of CakePHP's testing framework. All test cases that involving
> > > > a model are failing because the model names are getting enclosed with
> > > > single quotes, which produces table names in database queries that of
> > > > course don't exist. For example:
>
> > > > App::import('Model', 'Organization');
>
> > > > class OrganizationTestCase extends CakeTestCase
> > > > {
> > > > public $useTable = 'organizations';
> > > > public $fixtures = array('app.organization');
>
> > > > public function testInactive()
> > > > {
> > > > $this->Organization = ClassRegistry::init('Organization');
>
> > > > $result = $this->Organization->inactive(array('name',
> > > > 'description'));
> > > > $expected = array(
> > > > array('Organization' => array('name' => 'Test Company
> > > > Name', 'description' => 'Mortgages'))
> > > > );
> > > > $this->assertEqual($result, $expected);
> > > > }
>
> > > > }
>
> > > > results in a failed assertion and two E_NOTICES.
>
> > > > The failed assertion:
> > > > Equal expectation fails as [Boolean: false] does not match [Array: 1
> > > > items] at [/usr/local/apache2/vhosts/dev-obfuscated.com/app/tests/
> > > > cases/models/organization.test.php line 19]
>
> > > > The Errors:
> > > > Unexpected PHP error [Use of undefined constant â Organizationâ -
> > > > assumed 'â Organizationâ '] severity [E_NOTICE] in [/usr/local/
> > > > apache2/vhosts/dev-obfuscated.com/cake/libs/class_registry.php line
> > > > 134]
>
> > > > Unexpected PHP error [SQL
> > > > Error: 1054: Unknown column 'Ã¢â ¬Ë Organizationâ⠬⠢.status'
> > > > in 'where clause'] severity [E_USER_WARNING] in [/usr/local/
> > > > apache2/vhosts/dev-obfuscated.com/
Are you including the Model.id field in your edit form view?
create("Model"); ?>
input("Model.id"); ?> <-- important line
end("Submit"); ?>
On Jan 16, 4:37 pm, mona wrote:
> Here is my edit function code i don't know where i mistaken if i edit
> my record it added automatically one new record and i didn't get
> validation messages also below is my edit function code
> function edit($id = null){
> $this->set('sections', $this->Entry->Section->find
> ('list',array
> ('fields'=>'Section.section','Section.id','recursive' => 1,'page' =>
> 1,)));
> if (empty($this->data)){
> if (!$id){
> $this->Session->setFlash('Invalid id for Entry');
> $this->redirect('/entries/index');
> }
> $this->data = $this->Entry->read(null, $id);
> }
> else{
> $query=mysql_query("select max(counter) from entries");
> $row=mysql_fetch_array($query);
> $co=$row[0]+1;
> $q=mysql_query("update entries set counter=$co where id=$id");
> if ($this->Entry->save($this->data)){
> $this->Session->setFlash('The Entry has been saved');
> $this->redirect('/entries/index');
> }
> else{
> $this->Session->setFlash('Please correct errors below.');
> }
> }
> }
>
> can anybody tell me where i m mistaken this function doesn't edit my
> record instead of that it will added one new record in my table
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
@Miles: Do you have a link to some example code that illustrates
finderQuery. The stuff I've seen online was a bit impenetrable :-(
@Amit: Yes, I *could* write the SQL by hand, but I was hoping there
was a more 'cakey' way :-)
On Jan 17, 10:34 am, Amit Badkas wrote:
> For our photoblog, athttp://cheesecake-photoblog.org/demo/tags/, we use
> something like following query
>
> SELECT tags.*, COUNT(photos_tags.tag_id) AS totalPhotos FROM tags LEFT JOIN
> photos_tags ON tags.id = photos_tags.tag_id GROUP BY tags.id ORDER BY
> tags.tag ASC
>
> to generate tag cloud
>
> Hope this helps
>
> 2009/1/17 RichardAtHome
>
>
>
>
>
> > Given the following Model relations:
>
> > article <-- HABTM (articles_tags) --> tag
>
> > How do I fetch back a list of Tags with the count of associated
> > Articles?
>
> > I've tried (in the Tag Model):
>
> > $data = $this->find("all", array(
> > "fields"=>array(
> > "Tag.id",
> > "Tag.name",
> > "COUNT(Article.id) AS tag_count"
> > ),
> > "conditions"=>array(
> > "Article.published" => 1
> > ),
> > "group" => "Tag.id"
> > ));
>
> > But that doesn't generate the HABTM join in the SQL:
>
> > SQL Error: 1054: Unknown column 'Article.id' in 'field list'
> > SELECT `Tag`.`id`, `Tag`.`name`, COUNT(`Article`.`id`) AS tag_count
> > FROM `tags` AS `Tag` WHERE `Article`.`published` = 1 GROUP BY
> > `Tag`.`id`
>
> > Thanks in advance :-)
>
> --
> Amit
>
> http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
I've never needed a build path for PHP :-)
Here's how I do CakePHP dev with PDT:
1) Unzip cake to c:\htdocs\projects\my_project
2) Open up eclipse
3) Select workspace: c:\htdocs\projects\
4) Create a new project called "my_project"
5) Get coding.
On Jan 8, 12:32 pm, NirC wrote:
> Hi All,
>
> I'm working on an Eclipse article, and feature for PDT, that will
> direct and help users to start developing PHP code using CakePHP
> framework.
>
> I would like to supply an archive file that will include the skeleton
> for a CakePHP project, including Build path (for PHP and JavaScript)
> and Include path settings.
>
> If any of you is using PDT 2.0, and can assist, that will be great, as
> I have to admit I'm a Java developer (PDT) and not PHP ... :)
>
> Thanks in advance,
> NirC
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
or store the id in the session?
On Sep 26, 12:17 pm, Daniel Süpke <[EMAIL PROTECTED]> wrote:
> Thank you very much, I'll have a look at that!
>
> Best Regards,
> Daniel Süpke
>
> [EMAIL PROTECTED] wrote:
>
> > I haven't done exactly that but I think you could set all urls and
> > links using the array notation. The array could then also be pre-
> > populated with the parameter you want to keep in each request. (Pre-
> > populated in some central place like AppController::beforeFilter
> > before any links are generated)
>
> > On Sep 25, 1:23 pm, Daniel Süpke <[EMAIL PROTECTED]> wrote:
> >> Hi,
>
> >> we are using CakePHP 1.2 and I was wondering how it could be achieved
> >> to pass a parameter along every URL. We have a parameter set to an ID
> >> and it needs to be included in every URL in the application.
>
> >> Now, the first solution was to create a LinkHelper which added the
> >> location via $_GET, but this is not working when forms are validated
> >> by Cake, since then the url is not going via the LinkHelper.
>
> >> So, is there any easy way to pass around a parameter in the URL in the
> >> entire application?
>
> >> Best Regards,
> >> Daniel Süpke
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
or... redirect to another page (a thank you page perhaps presuming
this is a contact form) after you have sent the mail.
On Sep 26, 8:42 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Looking at some of the web-mail apps I use many seem to handle this
> using a combination of very clear visual indicators, disabling of
> submit-buttons and sending with ajax.
> Ajax also help prevent back-button accidents which is nice.
>
> On Sep 26, 7:45 am, rocket <[EMAIL PROTECTED]> wrote:
>
> > mktime.. good idea.
> > thanks
>
> > On Sep 26, 1:23 am, Marcelius <[EMAIL PROTECTED]> wrote:
>
> > > You can't make sessions count down. Instead of setting "30sec" in your
> > > session,store "mktime()" for the current time. Next time a user hits
> > > the send button you check the current time with the time you allready
> > > had stored in your session. Note that if a user deletes the browsers
> > > cookie, session get lost so they can pass that check.
>
> > > On 26 sep, 06:26, rocket <[EMAIL PROTECTED]> wrote:
>
> > > > hey guys
> > > > i implemented a simple mail system in my site and was wondering what i
> > > > ought to do for flood control. I dont' want people to keep hitting
> > > > refresh after they hit send thus spamming...
>
> > > > I was thinking of doing something like
> > > > $this->Session->write('Timeout', 30);
>
> > > > To simulate a 30 second countdown then just checking this timout
> > > > before another post is allowed... but I dont know how to make sessions
> > > > count down.
>
> > > > any ideas are appriciated!
>
> > > > rocket
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Just come across this when I renamed my web root folder.
I think this is to do with me using APC and isn't a CakePHP issue (now
that you have deleted the cache).
Restart Apache. This will clear the APC cache.
On Sep 26, 2:17 pm, Eemerge <[EMAIL PROTECTED]> wrote:
> just cleared them, same thing. still not working. I read somewhere i
> should define the CAKE_INCLUDE_PATH (or something like this)
> manually... to what should it point? what path?
>
> On Sep 26, 2:02 pm, grigri <[EMAIL PROTECTED]> wrote:
>
> > Have you tried emptying the cache files? If the directory names have
> > changed since cake's cache was built then this is what would happen.
>
> > On Sep 26, 11:27 am, Eemerge <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I would like some help with the following error:
>
> > > Warning: require(cake/bootstrap.php) [function.require]: failed to
> > > open stream: No such file or directory in /home/mainfram/public_html/
> > > shoplog/app/webroot/index.php on line 79
>
> > > Fatal error: require() [function.require]: Failed opening required
> > > 'cake/bootstrap.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/
> > > home/mainfram/php') in /home/mainfram/public_html/shoplog/app/webroot/
> > > index.php on line 79
>
> > > The strange thing about is that, 2 weeks ago it was working ,
> > > everything was ok, there were some problems on the hosting server, and
> > > now it stopped working.
>
> > > If anyone cane help, i'd really appreciate it.
>
> > > Thanks
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
If this is a once only import (populate initial db), I'd stick to
using mysql's data import command line tool and move onto something
more fun.
If it's something that needs to be run repeatedly e.g. a user uploads
a file that needs to be imported then write a custom method in the
Model that uses mysql's LOAD DATA INFILE sql:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
e.g.
function importCsv($csv_filename) {
sql$ = "LOAD DATA INFILE '{$csv}' INTO TABLE {$this->alias}";
$this->query($sql);
}
...code typed straight into google groups, may need tweaking ;-)
It might be advisable to wrap the query() call with a setTimeout if
its going to take a while...
You would call it from your controller with:
$this->Model->importCsv($filename);
On Sep 24, 7:25 am, Mike <[EMAIL PROTECTED]> wrote:
> Thanks for the tip! In the previous, non-Cake version of the app, I
> did that exactly, so it shouldn't be too too tough to get it up and
> running again. I was kinda avoiding SQL b/c it seemed like "the Cake
> way" should be to push it through the Cake layer & let CakePHP make it
> automagically happen. Hearing that raw SQL is actually the right way
> is actually really helpful :)
>
> If you don't mind my asking a couple more questions - how does one
> know where the boundary should be? I mean, aside from exceeding
> max_execution time and/or running out of memory - how would I know
> where to draw the boundary between 'small enough for Cake' vs. 'needs
> raw SQL' when designing my app? (And what does a normal app do if a
> user happens to show up with an unexpectedly huge data set?)
>
> Also, what sort of data sets is Cake intended to support? I'm writing
> the app to support my teaching, so having 30 people in a class, with
> 10-20 homeworks/exercise sets to hand in (each of which might have 2-3
> versions stored), so it's conceivable that Cake might auto-magically
> pull 600-1,200 records (even if fairly few / none of them are used in
> any given view). One of the things I really liked about Cake was that
> I could set recursive = 2 (or 3), and have it magically pull
> everything I needed out of the DB (in my raw PHP app, I figured it was
> time to look at a framework when I started to move towards an OOP-y
> iterator approach for dealing with all my lists of data :) )
>
> Thanks again for the quick reply - I appreciate the 'ok' from someone
> who knows more about this than I do! :)
> --Mike
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
> $this->Auth->deny('admin', 'accnt', 'faq'); // does not work
This doesn't work because the 'action' for all views in the pages
controller is 'display' not 'admin', 'accnt'
$this->Auth->deny("display") would work, but it would deny ALL views
handled by the pages controller.
Your workaround is a good compromise. Or you could make your own
dedicated MyPagesController to group all these pages together.
On Sep 24, 11:12 am, "Gabriel Kolbe" <[EMAIL PROTECTED]> wrote:
> S'ok, I created 'fake' functions in the user controller, then added
> the views to the users views, then take the Authentication process
> from the app_controller to the users_controller..
>
> On Wed, Sep 24, 2008 at 10:54 AM, gabriel <[EMAIL PROTECTED]> wrote:
>
> > This is my current code:
> > class AppController extends Controller {
>
> > var $components = array('Auth');
>
> > function beforeFilter() {
> > $this->Auth->authorize = 'controller';
> > $this->Auth->allow('*');
> > $this->Auth->deny('admin', 'accnt', 'faq'); // does not work
> > }
>
> > function isAuthorized() {
> > if ($this->Auth->user('role') == 'admin') {
> > $this->Auth->allow('admin');
> > }
>
> > }
> > }
>
> > What I want to do is something like the following:
> > function beforeFilter() {
>
> > $this->Auth->authorize = 'controller';
> > $this->Auth->allow('pages/faq', 'pages/aboutus', 'users/
> > register');
> > $this->Auth->deny('pages/accnt', 'pages/admin', 'categories/
> > edit');
> > }
>
> > function isAuthorized() {
> > if ($this->Auth->user('role') == 'admin') {
> > $this->Auth->allow('pages/admin', 'categories/edit');
> > }
> > $this->Auth->allow('pages/accnt');
> > }
> > }
>
> > NOTE: the pages does not have a model or controller..I HAVE read the
> > cookbooks severaltimes, served the Cakegroup, posted several message,
> > got different replies, but just can' t seem to find a answer to
> > this... I would be grateful if someone can actually show me ..
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Also worth noting: A controller can have multiple Models.
Which model would $this->find() use?
On Sep 23, 12:28 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]>
wrote:
> Well, calling find() in a controller is not a violation, but not "the
> best practice" if overused.
>
> Of course, calling find() from a controller is the fastest way to get
> your data, but usually, the find() call has other stuff around it,
> stuff that might be common to each call. The idea is to make "fat
> models, thin controllers", meaning that you put as much as you can in
> your models.
>
> Maybe an example is better. Let's say you have a certain criteria for
> getting an article from the Article model. You can call this from a
> controller each time you want to get an article:
>
> $article = $this->Article->find
> (
> 'first',
> array
> (
> 'conditions' => array('Article.slug' => $slug),
> 'contain' => array('ArticleCategory', 'Rating')
> )
> );
>
> or you can make it cleaner and easier by declaring a function in your
> model, for example "getArticle":
>
> function getArticle($slug)
> {
> $_slug = Sanitize::escape($slug);
>
> return $this->find
> (
> 'first',
> array
> (
> 'conditions' => array('Article.slug' =>
> $_slug),
> 'contain' => array('ArticleCategory',
> 'Rating')
> )
> );
>
> }
>
> this makes your controller much thinner and easier to follow:
>
> $article = $this->Article->getSingle($slug);
>
> All you have to remember is that all apps work with some sort of data,
> and in Cake, models work with data, not controllers.
>
> I hope that helps a bit. ;)
>
> On Sep 23, 11:33 am, forrestgump <[EMAIL PROTECTED]> wrote:
>
> > Hey guys,
> > Considering the fact that CakePhp follows the MVC architecture, id
> > like to know...y we dont make function calls such as $this->find("where
> > id=xyz") from function blocks typed out in Models rather
>
> > than controllersim sure there is a logical reason to it...but
> > someone asked me this question and i could not give her a good enuf
> > answerdoes making function calls to queries like find(), save()
> > work better in models or controllers?.and is it good practice to
> > pass conditions in your function call while using it in a controller?
> > eg find("where id=1") ;
>
> > Does using $this->find() in controller violate the MVC architecture in
> > any manner?
>
> > Can someone please clarify these question for us?
>
> > Thanks in advance,
> > forrestgump
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Have you checked out Easysoft's SQLEngine? It allows heterogeneous
joins across databases and even across different RDBMs?
As an alternative, you could always use $this->model->query(); and
enter the SQL by hand. You'll loose a lot of cakey goodness though :-(
On Sep 22, 3:19 pm, Bookrock <[EMAIL PROTECTED]> wrote:
> I am facing same problem
>
> On Sep 21, 5:56 pm, Rick <[EMAIL PROTECTED]> wrote:
>
> > I tried that technique but it did not work. It appears that you can't
> > havemultiple"useDBConfig"s in a single query. This seems reasonable
> > since you also can't do a raw select usingmultipleconnections which
> > is what the useDBConfigs give you (I think).
>
> > Richard
>
> > On Sep 20, 5:56 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > > What you need to do is set $useDBConfig for each model.
>
> > > var $useDBConfig = 'A';
>
> > > then in your DATABASE_CONFIG you would use
>
> > > var $A = array(
> > > 'driver' => 'mysql',
> > > 'persistent' => false,
> > > 'host' => 'localhost',
> > > 'login' => 'username',
> > > 'password' => 'password',
> > > 'database' => 'A',
> > > 'prefix' => '',
> > > );
>
> > > Adam
>
> > > On Sep 21, 4:24 am, Rick <[EMAIL PROTECTED]> wrote:
>
> > > > I've got an existing MySql instance that contains 4 databases (lets
> > > > call them A, B, C & D). Each has tables as you would expect. For
> > > > this post lets say tables are named like table1, table2 etc.. in each
> > > >database. My single user/password has access to all databases in the
> > > > instance.
>
> > > > My problem is I need to query across several databases. This is the
> > > > way I would do this with a raw query:
>
> > > > select * from A.table1 as t1, B.table2 as t2
> > > > where t1.id = t2.id
>
> > > > I haven't been able to do this through any combination of model
> > > > attributes. Naturally I thought that
>
> > > > var $useTable = "A.table1"
>
> > > > in The table1 model and
>
> > > > var $useTable ="B.table2"
>
> > > > in the table2 model would work - alas no it does not.
>
> > > > I've also tried using the prefix attribute and that doesn't do it
> > > > either.
>
> > > > Is there some way to do this in Cake or do I need to forget the models
> > > > and just do raw sql queries in the controllers? It seems to me this
> > > > is just an arbitrary restriction in the model code.
>
> > > > Richard
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Aye, I thought of that but it feels a bit 'messy' :-(
On Sep 22, 3:23 pm, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
> Hi Richard,
>
>
>
> > I'm trying to create a bookmarkable search results page. I have the
> > following form so I am using 'get' search form:
>
> > create("Event", array("action"=>"search",
> > "type"=>"get")) ?>
> > input("Event.start_date") ?>
> > end("search") ?>
>
> > When the form is posted, the URL looks like this:
>
> >http://www.example.com/events/search?event_name=&location_name=&start...
>
> > Which makes it impossible to work out the date that was submitted
> > because the last query parameter overwrites the previous ones!
>
> > $this->params['url']:
>
> > [url] => events/search
> > [start_date] => pm
>
> > If I use 'post' as the form type, Cake separates the date fields
> > correctly, but the search result page isn't bookmarkable (the url
> > becomeshttp://www.example.com/events/search).
>
> > Is there a workaround for this? Or am I doing it completely wrong? :-S
>
> You could post your form to an action which then uses the form data to
> create the url of the result page and redirects to it.
>
> Hope that helps!
>
> --
> Daniel Hofstetterhttp://cakebaker.42dh.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
I suspect you are trying to SMTP to gmail or something similar.
CakePHP doesn't support the encyption required to connect to these
types of SMTP server.
The Bakery has some useful articles for using 3rd party mail
components that support encrypted SMTP
On Sep 22, 10:35 am, Predominant <[EMAIL PROTECTED]> wrote:
> Hey base64,
>
> This message "220-We do not authorize .." is being produced by one of
> the mail servers charged with delivering your mail message.
> Try using a mail server you have authority to use.
>
> Cheers,
> Predom.
>
> On Sep 22, 3:32 am, base64 <[EMAIL PROTECTED]> wrote:
>
> > Dear all,
>
> > I'm using CakePHP Email component, when i sent email and i set smtp_errors;
>
> > $this->set('smtp-errors', $this->Email->smtpError);
>
> > the variable *smtp-errors* return : *220-We do not authorize the use of this
> > system to transport unsolicited, *and my email did'not sent.*
>
> > *how to solved this problem?, and what can I do to send email using CakePHP
> > email component?. I had follow this instruction step by step :
> > *http://book.cakephp.org/view/176/Email*
>
> > Thanks
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Note:
Something
Something2
..will create an invalid form: You MUST have a label linked to every
input element.
Here's a snippet from my own cake.generic.css:
/*
* forms
*/
#content form {
padding: 16px;
background-color: #DDD;
-moz-border-radius: 16px;
}
#content fieldset {
border: 0;
}
#content legend {
color: #06C;
font-size: 3em;
line-height: 1.2em; color : #06C;
font-weight: bold;
}
#content form div.input {
clear: both;
margin: 8px 0;
background-color: #EEE;
padding: 2px;
-moz-border-radius: 4px;
border: 1px solid #EEE;
}
#content form div.input.required {
font-weight: bold;
}
#content form div.input.error {
border-color: #900;
background-color: #FCC;
color: #900;
}
#content form div.input label {
float: left;
width: 14em;
margin-right: .5em;
}
#content form div.text input,
#content form div.password input,
#content form div.select select,
#content form div.datetime select,
#content form div.textarea textarea {
border: 1px solid #CCC;
padding: 2px;
font-size: 1.2em;
font-family: verdana, sans-serif;
}
#content form div.textarea textarea {
width: 40em;
height: 20em;
}
#content form option {
padding-right: .5em;
}
#content form div.input.error div.error-message {
margin-left: 14.5em;
padding: 2px 2px 2px 22px;
background: url(../img/icons/error.png) no-repeat 2px center;
}
#content form div.input input.form-error {
border-color: #C00;
}
#content form div.submit input {
margin-left: 7.25em;
border: 4px solid #FFF;
padding: 2px 4px;
background: #06C none no-repeat 4px center;
color: #FFF;
font-weight: bold;
font-size: 2em;
cursor: pointer;
-moz-border-radius: 8px;
}
#content form div.submit input:hover {
background-color: #9C9;
color: #333;
text-decoration: none;
}
I'm preparing an article for the Bakery about styling Cake layouts and
views as we speak...
On Sep 22, 2:57 pm, toby78 <[EMAIL PROTECTED]> wrote:
> Thanks, this works.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Note: this groups post:
http://groups.google.com/group/cake-php/browse_thread/thread/c05c03e397549dde/57f2e4d6b3f7fb0e?lnk=gst&q=form+get+date#57f2e4d6b3f7fb0e
Sounds like the same problem, but has no replies...
On Sep 22, 2:41 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
> I'm trying to create a bookmarkable search results page. I have the
> following form so I am using 'get' search form:
>
> create("Event", array("action"=>"search",
> "type"=>"get")) ?>
> input("Event.start_date") ?>
> end("search") ?>
>
> When the form is posted, the URL looks like this:
>
> http://www.example.com/events/search?event_name=&location_name=&start...
>
> Which makes it impossible to work out the date that was submitted
> because the last query parameter overwrites the previous ones!
>
> $this->params['url']:
>
> [url] => events/search
> [start_date] => pm
>
> If I use 'post' as the form type, Cake separates the date fields
> correctly, but the search result page isn't bookmarkable (the url
> becomeshttp://www.example.com/events/search).
>
> Is there a workaround for this? Or am I doing it completely wrong? :-S
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
In exactly the same way :-)
You join table (products_sizes) would hold the stock field
id (PK)
product_id (FK)
size_id (FK)
stock (INT)
On Sep 17, 9:27 pm, VitillO <[EMAIL PROTECTED]> wrote:
> Hi, i have the following structure for a tshirt online store:
>
> Product HABTM Size
> Size HABTM Product
>
> Association table:
> products_sizes
>
> The problem is, i need a stocks system.
>
> For example, say i have 50 pieces of S (size) for a particular tshirt,
> before using cake i had a column 'stock' in the association table, so
> i could retrieve the particular stock of that size, for that product,
> but now with cake i dont know how i should make the association.
>
> Any help?
>
> Thanks!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
You can set up your models to use any "non-cake" table structures and
naming styles.
See http://book.cakephp.org/view/71/Model-Attributes for more details.
On Sep 18, 9:31 am, Laurent Bois <[EMAIL PROTECTED]> wrote:
> Hi
>
> We currently have a data model with table names that don't follow
> CakePHP conventions.
> As we do with Rails, one technique to use (when application is read-
> only, and that's our case) is to create views in database over this
> legacy tables.
> First i did this.
> Then i wanted to unit test my new renamed data model.
> - i've recreated my models using renamed keys in my views.
> - i've recreated my test cases.
>
> After first test launched, what i see for the first model, is that the
> Testing framework create my test tables with the keys of the table,
> mapped by my view.
> And fixtures couldn't be loaded, and test is not run.
>
> here my legacy table :
> SL01 :
> N_NUME_CLIE varchar(6)
> L_CONN_NOM varchar(40)
> L_CONN_PASS varchar(40)
>
> Here my view Users
> Create view Users as select n_nume_clie id, l_conn_nom, l_conn_pass
> from sl01;
>
> Here the trace in my test case (creation of the table for testing):
> CREATE TABLE `test_utilisateur_tests` ( `N_NUME_CLIE` varchar(6) NOT
> NULL, `L_CONN_NOM` varchar(40) NOT NULL, `L_CONN_PASS` varchar(40) NOT
> NULL );
>
> It seems to be a problem with the SimpleTest framework
>
> Does CakePHP support Models mapping database Views?
> Thanks
>
> Laurent
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
'conditions' => array('Book.title LIKE' => 'A%'),
The condition has been moved to the left hand side as a security
measure.
On Sep 17, 8:14 am, "jittos" <[EMAIL PROTECTED]> wrote:
> i am a new comer in cakephp.. i am going through some tutorials in
> cakephp.. i found one problem i want to write find method for the
> following query
>
> SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name`
> FROM `books` AS `Book`
> WHERE `Book`.`title` LIKE 'A%'
> ORDER BY `Book`.`isbn` DESC
> LIMIT 2;
>
> i wrote
>
> find(
> 'all',
> array(
> 'conditions' => array('Book.title' => 'LIKE A%'),
> 'fields' => array(
> 'Book.isbn',
> 'Book.title',
> 'Book.author_name'
> ),
> 'order' => 'Book.isbn DESC',
> 'limit'=>2
> )
> );
>
> but it create a query like this..
>
> SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name`
> FROM `books` AS `Book`
> WHERE `Book`.`title` = 'LIKE A%
> ORDER BY `Book`.`isbn` DESC
> LIMIT 2;
>
> i.e, LIKE keyword is not working properly... did i do anything
> wrong?...
> plz help me if anybody have any idea about it...
> thanks,
> jittos
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Which accessibilty checkpoint requires you to have a title attribute
on every hyperlink?
The nearest I can find is checkpoint 13.1:
http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-meaningful-links
13.1 Clearly identify the target of each link. [Priority 2]
Link text should be meaningful enough to make sense when read out of
context -- either on its own or as part of a sequence of links. Link
text should also be terse.
For example, in HTML, write "Information about version 4.3" instead of
"click here". In addition to clear link text, content developers may
further clarify the target of a link with an informative link title
(e.g., in HTML, the "title" attribute).
'may' does not mean 'must' ;-)
On Sep 12, 3:10 am, AussieFreelancer <[EMAIL PROTECTED]>
wrote:
> I can see your point about repeating it twice, I don't understand how
> different accessibility applications work, but I know that it is part
> of the WAI and Section 508 accessibility standards that all href
> elements should have the title attribute, and all images should have
> an alt tag, even if it is empty. This is what has made me think of
> this, as I am a website developer, and to pass these accessibility
> tests, I need to include the "title" in every link - which is not too
> much of a problem, just that I figure having it as a default would
> reduce the amount of code I need to write :D
>
> Also, most links will have the same title text as the link text
> anyway, wouldn't they? Certainly with navigation, Home is Home, About
> Us is About us... As I say, I don't understand how the applications
> work exactly, I just want to be able to do what I can to ensure that
> my websites are accessible to as many people as possible.
>
> Thanks
>
> Patrick
>
> On Sep 12, 9:52 am, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > You can override cakephp's defualt functionality in your AppHelper if
> > you want to do this.
>
> > I don't think it should be the standard, as there are situations where
> > you might not want this. Additionally, why do you need to repeat the
> > link text in the link title? Won't this effectively cause the
> > screenreader to speak the link text twice?
>
> > Cheers,
> > Adam
>
> > On Sep 12, 11:38 am, AussieFreelancer
>
> > <[EMAIL PROTECTED]> wrote:
> > > I have just done a quick google search, and can't seem to see anything
> > > about this, but I have been thinking for some time now, that for
> > > accessibility reasons, wouldn't it make sense for the links to have a
> > > default title, and even images have an empty alt tag by default? The
> > > link title could default to the link text, unless a title was
> > > specified in the options.
>
> > > Any thoughts on this, or reasons as to why cakephp doesn't currently
> > > work like this?
>
> > > Thanks
>
> > > Patrick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Post your query code :-)
On Sep 10, 3:17 pm, krzysztofor <[EMAIL PROTECTED]> wrote:
> Hello everybody. I'm begginer with CakePHP. The MySQL query is
> genereting in a wrong way:
>
> Query:
> SELECT `Option`.`id`, `Option`.`menu_id`, `Option`.`parent_id`,
> `Option`.`page_id`, `Option`.`order`, `Option`.`extension_name`,
> `Option`.`extension_args`, `Option`.`menu` FROM `fk3_options` AS
> `Option` WHERE `Option`.`pageid` = 41 LIMIT 1
>
> The problem is in the 'WHERE clause'. The record 'pageid' doesn't
> exist, instead of it should be 'page_id'.
>
> Warning (512): SQL Error: 1054: Unknown column 'Option.pageid' in
> 'where clause' [ROOT/system/cake/libs/model/datasources/
> dbo_source.php, line 440]
>
> There is no problem on localhost, but it is on the external server :(.
> Please help me if you can.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
> First off read this: http://en.wikipedia.org/wiki/Example.com
Example.com is a test domain that you cannot use ;-)
On Sep 10, 4:09 am, "Jerry Ross" <[EMAIL PROTECTED]> wrote:
> Ooopps! It was a false positive. What I actually accidentally got up and
> running washttp://myexample.com
>
> http://www.example.com
>
> and
>
> http://www.example.com/cake_1.1.19.6305/
>
> are still not working. However, on the positive side,
>
> http://localhost/cake_1.1.19.6305/
>
> is working and I have a CAKE RAPID DEVELOPMENT screen telling me It found my
> database config file and that cake is able to connect to my database.
>
> But can someone tell me what I am supposed to see
> whenhttp://www.example.comstarts to work?
>
> All I get is this:
>
> "You have reached this web page by typing "example.com", "example.net", or
> "example.org" into your web browser.
> These domain names are reserved for use in documentation and are not
> available for registration. See RFC 2606, Section 3."
>
> I am supposing that was NOT what I was suposed to get.
>
> Any suggestions?
>
> Pittore
>
> - Original Message -
> From: "Jerry Ross" <[EMAIL PROTECTED]>
> To:
> Sent: Tuesday, September 09, 2008 7:57 PM
> Subject: Re: Need help on Install
>
> > Thanks for all your help...I now have example.com up and running and it
> > looks good. Now onto programming.
>
> > Pittore
> > - Original Message -
> > From: "Donkeybob" <[EMAIL PROTECTED]>
> > To: "CakePHP"
> > Sent: Tuesday, September 09, 2008 6:48 AM
> > Subject: Re: Need help on Install
>
> > one word . . . .xampp.
>
> > for xp, it is the beez kneez . . .
>
> > set up is easy and everything is done for you. apache, mysql,
> > php . . . .then edit the httpd.conf to add a virtual host.
>
> > i run many development sites from this configuration
>
> > On Sep 8, 8:09 pm, Pittore <[EMAIL PROTECTED]> wrote:
> >> I have apache2 up and running on my Windows XP Pro laptop
>
> >> I have established the following directory structure:
>
> >> Apache2
> >> htdocs
> >> cake
>
> >> When I typehttp://www.example.com/cakeorhttp://www.example.com/
> >> I get "Page not found"
>
> >> some kind soul sent me these suggestions:
>
> >> 1. Create a simple static VirtualHost under Apache based on the
> >> simplehost
> >> example configuration file
> >> C:\www\Apache22\conf\extra\vhosts\_static\simplehost.com.conf
> >> a. Resave file as mydomain.com.conf, in the same folder, to duplicate
> >> it.
> >> b. Update all occurrences of 'simplehost.com' to 'mydomain.com'
> >> within.
> >> c. Create folder C:\www\Apache22\conf\extra\vhosts\_static\mydomain.com
> >> \
> >> d. Create folder C:\www\vhosts\_static\mydomain.com\ to be used as
> >> the
> >> container for this VirtualHost.
> >> e. Create log folder C:\Apache22\logs\mydomain.com\
>
> >> 2. Unpack cakephp as folder C:\www\vhosts\_static\mydomain.com\cake\
>
> >> 3. Modify this VirtualHost's configuration [mydomain.com.conf] and
> >> change
> >> DocumentRoot from...
> >> DocumentRoot "C:/www/vhosts/_static/mydomain.com"
> >> To...
> >> DocumentRoot "C:/www/vhosts/_static/mydomain.com/cake/app/webroot"
>
> >> 4. Restart Apache.
>
> >> However, I am stuck on step 1a and b...I don't know where to find the
> >> file:
>
> >> 'simplehost.com'
>
> >> any suggestions? Help...I have been trying to configure cake now for
> >> 4 days am getting frustrated.
>
> >> -- Pittore
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
I'll answer b)
/app/views/layouts/default.ctp:
header markup goes here
menu markup goes here
markup for footer
> if(session) print "hello $user"
> else show login link.
That's correct :-) Why do you not think this should go in the layout?
You could paste the code into an element (note, i'm using your
pseudocode here, check out the manual on the Auth component for some
real code):
/app/views/element/session_links.ctp:
if(session) print "hello $user"
else show login link.
and in your layout:
render("session_links"); ?>
On Sep 10, 10:19 am, jkritikos <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I would like to ask 2 questions, both regarding the layout and views.
>
> a) After installing cake 1.2 and accessing my localhost domain, I get
> to see the cake info page and everything works fine. If i access a url
> that is lacking the underlying controller or view, I get to see cake's
> error message about the corresponding view file missing etc. When I
> create my own template under /app/views/layout/default.ctp, it all
> works fine but whenever I hit invalid urls (as above) nothing happens
> (i.e. i still get to see my default template but without the error
> messages). I read somewhere that by overriding the default.ctp layout
> file, you are effectively changing every page that cake would render,
> so perhaps I'm missing some variables in my layout? (e.g
> $content_for_layout, $title_for_layout etc?)
>
> b) I have been given all the templates for an application by a web
> designer. Let's say that the default layout consists of a header, a
> menu, the 'main body' and a footer. What is the correct approach for
> breaking this down in cake ? I assume that my default layout should
> contain the common elements that are always present (i.e header, menu,
> footer), and all other views will be rendered within the 'main body'
> section of the layout. However if this is the case, it would mean that
> the actual layout, in the header section should also contain code
> like:
>
> if(session) print "hello $user"
> else show login link.
>
> This somehow feels wrong. Should i have code like that in my layout ?
> What is the best practice for using a default template and some views?
>
> thanks a lot,
> jason
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
> First value for auto_increment id in mysql == 1
Unless you tell it differently. You can have an autoincrementing field
that starts at 21 and increments in 6's if you like :-)
On Sep 9, 12:20 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> It is intended functionality. First value for auto_increment id in
> mysql == 1
>
> Not sure about all other dbs, but on others I have worked with it is
> the same.
>
> On Sep 9, 9:06 pm, John Jackson <[EMAIL PROTECTED]> wrote:
>
> > Thanks for the reply, but I now know that is the correct way to
> > perform an update as I have just figured out what the problem was.
> > Apparently, I can not use an id of 0. Changing the user's id to
> > another value greater than 0 fixed the problem.
>
> > Is this a bug or intended functionality?
>
> > On Sep 9, 11:58 am, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > Hi John,
> > > When calling save the id should be part of the data. Setting it on the
> > > Model before saving does not work as you expect it to.
> > > Are you sure the id is in the data array?
>
> > > /Martin
>
> > > On Sep 9, 12:34 pm, John Jackson <[EMAIL PROTECTED]> wrote:
>
> > > > Pretty sure the code I'm using should be causing the save() function
> > > > to do a MySQL update instead of insert:
>
> > > > $this->User->id = 0; // static here for this example
> > > > $this->User->save($this->data);
>
> > > > But this is resulting in an insert, according to the output from debug
> > > > level 2. What I'm trying to do is update a user's details for their
> > > > account, including name, email and password.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
What David said.
You have to add your conditions to the paginate call.
Check out the google groups FAQ: http://groups.google.com/group/cake-php/web/faq
Scroll down to: How to add paginate support for custom queries?
On Sep 9, 9:13 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> See:http://groups.google.com/group/cake-php/msg/7d17a42d764ccce4?hl=en
>
> Your problem is not in your conditions, it's right here:
>
> > $this->set('textmasters', $this->paginate());
>
> Yes, this in fact does give you *everything*.
>
> On 9 Sep 2008, at 17:04, Liebermann, Anja Carolin wrote:
>
>
>
> > Hello,
>
> > I still have some problems with the parameters for "find"
>
> > I have two different sets of parameters but I have the impression the
> > result doesn't react on them, but simply gives me a list with nearly
> > all
> > of my datasets:
>
> > Version 1:
> > $params = array(
> > 'conditions' => array('Textmaster.katalogobjekt_id' => 1,
> > 'Textmaster.sprache_id' => 1,
> > 'Textmaster.textinhalt LIKE' =>
> > '%'.trim($this->data['Textmaster']['textinhalt']).'%',
> > 'Textmaster.suchkriterium LIKE' =>
> > '%'.trim($this->data['Textmaster']['suchkriterium']).'%'),
> > 'fields' =>
> > array
> > ('Textmaster.id','Textmaster.suchkriterium','Textmaster.textinhalt'
> > ),
> > 'order' => 'Textmaster.suchkriterium ASC',
> > 'recursive' => -1
> > );
>
> > Version 2:
> > $params = array(
> > 'conditions' => array('Textmaster.katalogobjekt_id' => 1,
> > 'Textmaster.sprache_id' => 1),
> > 'fields' =>
> > array
> > ('Textmaster.id','Textmaster.suchkriterium','Textmaster.textinhalt'
> > ),
> > 'order' => 'suchkriterium ASC',
> > 'recursive' => -1
> > );
>
> > $textmasters = $this->Textmaster->find('all',$params);
> > $this->set('textmasters', $this->paginate());
>
> > Question 1: What does 'fields' do? I thought it would load only those
> > fields, but my dataset seems to load completely because in the view
> > every column is populated
>
> > Question 2: the 'order' criteria is being ignored. Do I have the wrong
> > syntax? The result is still sorted by 'id'.
>
> > Question 3: the "like" condition is also ignored, although it arraives
> > in the parameter array:
> > E.g.:
> > Array
> > (
> > [conditions] => Array
> > (
> > [Textmaster.katalogobjekt_id] => 1
> > [Textmaster.sprache_id] => 1
> > [Textmaster.textinhalt LIKE] => %Modern%
> > [Textmaster.suchkriterium LIKE] => %ACE109%
> > )
>
> > [fields] => Array
> > (
> > [0] => Textmaster.id
> > [1] => Textmaster.suchkriterium
> > [2] => Textmaster.textinhalt
> > )
>
> > [order] => Textmaster.suchkriterium ASC
> > [recursive] => -1
> > )
>
> > Any hints on what is going wrong are appreciated.
>
> > Anja C. Liebermann
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
> if every employee have to spend months learning this new platform then , must
> as well code directly in PHP !
If you don't want to learn a (new) framework, don't.
A couple of months learning CakePHP will pay itself back in no time
due to increased productivity ;-)
On Sep 8, 6:29 am, James Chua <[EMAIL PROTECTED]> wrote:
> if every employee have to spend months learning this new platform then , must
> as well code directly in PHP !
>
> Date: Mon, 8 Sep 2008 02:02:41 +0530
> From: [EMAIL PROTECTED]
> To: cake-php@googlegroups.com
> Subject: Re: dropdown with country,state,city
>
> I know that , iwant drop down with pach country,state,city.
>
> On Mon, Sep 8, 2008 at 1:58 AM, Bernhard J. M. Gr黱 <[EMAIL PROTECTED]> wrote:
>
> Yes it is possible.
> Look into the manual (FormHelper -> input (select box)). There are many
> examples you can look at.
>
> 2008/9/7 Ranju <[EMAIL PROTECTED]>
>
> I want implement dropdown with country ,state,city.It is possible on
>
> cakephp .pls help me.
>
> _
> Manage multiple email accounts with Windows Live Mail
> effortlessly.http://www.get.live.com/wl/all
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
bump?
On Aug 24, 1:52 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
> Also (may be related), in the element, why doesn't the following work?
>
> echo $html->css(array(
> "element.site_search"
> ), null, array(), false);
> ?>
>
> (the CSS file isn't being linked in the head)
>
> It works if the last param is true, but the code is embeded in the
> page and not the head.
>
> On Aug 24, 11:27 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > I have a simple element:
>
> > site_search.ctp:
> > create("Search") ?>
> > inputs() ?>
> > end("Search") ?>
>
> > Model Search is a tableless model which I manually create the schema
> > for:
>
> > search.php:
> > class Search extends AppModel {
>
> > var $useTable = false;
>
> > var $_schema = array(
> > "search_for"=>array(
> > "type"=>"string",
> > "length"=>128
> > )
> > );
>
> > }
>
> > Problem: The inputs() call in the element is coming back blank. It
> > works fine if I point the form at a model (ie. it generates the
> > inputs) with a real database table behind it, but not for one with a
> > $_schema.
>
> > I tried adding:
>
> > App:Imort("model", "Search");
>
> > to the element, but that didn't help.
>
> > How do I get an element to 'see' a model in this way?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Just my two cents: CakePHP is fast enough for me :-)
That's not to say you shouldn't optimize for speed at some point in
the future. I just mean, it shouldn't be a priority.
Keep doing what your doing Cake dev's. Cake hasn't become one of the
most popular PHP frameworks because of its speed ;-)
On Aug 28, 4:11 pm, kiang <[EMAIL PROTECTED]> wrote:
> Maybe there could be one page like 'Read first before benchmarking' in
> home page since there exists many mis-understandings around the
> world. :)
>
> ---
> kiang
>
> On Aug 28, 10:41 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > One thing we know for sure is that we can always work to improve the
> > speed. However, we will not do it in earnest until the time is right.
> > We have been here before, seen similar things, and come up with the
> > answers.
>
> > While the hello world is pretty silly, a couple of things strike me
> > right off the bat. For one, var $helpers = array() will still load 3
> > files, while setting it to null will stop all loading. So, in a lot of
> > ways Cake shows up slower because it does more from the start. The
> > other major place is the session handling. We have no idea what his
> > settings were in this regard.
>
> > In any case, now that we are deeper into the RC cycle you will see in
> > the timeline many efforts to improve and optimize the responsiveness
> > of the framework. If you would like the historical perspective have a
> > look at what happened in 1.1 between the 1.1.13 and 1.1.17 releases.
> > We have a history of squeezing speed out of this language and
> > framework and we prepared to do it again.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
A CakePHP Model is just a PHP class. You can still use all of PHP's
class abilities.
for example:
class MyModel extends AppModel {
var $myCustomPropery = "w00t!";
}
in controller:
echo $this->MyModel->myCustomProperty;
On Aug 28, 2:19 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> I don't get what you mean with "custom properties". Maybe it's just me
> but, can you elaborate a bit more please?
>
> On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> > How do you specify custom properties in a CakePHP model?
> > I'm trying to do this, but there is no sample code any where that
> > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
After more digging, I've managed to get rid of the open base dir error
(comment out open_basedir setting in php.ini)
Now I have another issue...
Under Apache, the following code:
produces the following output:
/app/webroot/user_muses/foo.jpg
Under IIS, it breaks because the output is:
/index.php/app/webroot/user_muses/foo.jpg
And the images are broken.
Note: This only happens when I use Router::url(). If I use the built
in $html->image() to display images the urls are correct.
Obviously, I can't use $html->image() in this case as the images are
stored in a different location.
I get a similar problem when I try an embed a flash application too.
How do I remove index.php from the urls on IIS?
On Aug 26, 5:23 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
> After a bit of struggling, I've managed to get a CakePHP app running
> on IIS.
>
> I've running it without mod_rewrite so I followed the instructions in
> core.php and removed .htaccess files and uncommented the line:
>
> Configure::write('App.baseUrl', env('SCRIPT_NAME'));
>
> I've installed my cake app into:
>
> c:\Inetpub\php_test\
>
> I'm getting an error in a couple of places in my code, along the lines
> of:
>
> Warning (2): file_exists() [function.file-exists]: open_basedir
> restriction in effect. File(/index.php/app/webroot/user_backgrounds/
> 1.xml) is not within the allowed path(s): (c:\Inetpub) [APP\views
> \elements\painter.ctp, line 133]
>
> Reading a bit further I've made the changes to /app/webroot/index.php
>
> /**
> * The full path to the directory which holds "app", WITHOUT a
> trailing DS.
> *
> */
> if (!defined('ROOT')) {
> define('ROOT', "\\Inetpub\\php_test");
> }
> /**
> * The actual directory name for the "app".
> *
> */
> if (!defined('APP_DIR')) {
> define('APP_DIR', "\\Inetpub\\php_test\\app\\");
> }
> /**
> * The absolute path to the "cake" directory, WITHOUT a trailing DS.
> *
> */
> if (!defined('CAKE_CORE_INCLUDE_PATH')) {
> define('CAKE_CORE_INCLUDE_PATH', "\\Inetpub\\php_test");
> }
>
> What am I missing/doing wrong?
>
> Thanks in advance :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
Quote:
One thing I came across was the fact that the columns for created &
updated should be of the type datetime and Null should be set to
'null' and not 'not null'
Oops, forgot to mention that :-(
On Aug 27, 4:21 pm, teknoid <[EMAIL PROTECTED]> wrote:
> Makes sense that it works like that...
>
> how/where are you modifying the data if you are just doing a read()?
>
> On Aug 27, 5:02 am, "Marc Schuetze" <[EMAIL PROTECTED]> wrote:
>
> > According to the docs 'modified' and 'updated' are both ok.
> > I tried this with 'modified' as well and it was the same result
>
> > When I do $this->create(array(.)) and that array doesn't contain
> > an update field then everything is fine and cake sets the update field
> > properly.
> > However, when I do
> > $this->read(null,$id) the model's data array will contain the update
> > field and it seems like I'll then have to manually unset it if I want
> > to update the time in the field.
> > If I don't do that cake will not fill the update field with a new
> > value but will use the value that is is the model's data array
>
> > On Wed, Aug 27, 2008 at 10:58 AM, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > > The automagic fields should be called created and modified (not
> > > updated). You don't need to do anything else.
>
> > > On Aug 27, 8:29 am, MarcS <[EMAIL PROTECTED]> wrote:
> > >> Hi,
>
> > >> I just noticed that my 'updated' field won't update when I update
> > >> data.
> > >> I tried around for a while and then noticed that it won't update when
> > >> the 'update' field is included in the Model's data array.
> > >> But when I load data using Model::read(null,$id) the date fields are
> > >> obviously always included in the Model's data. Do I then need to
> > >> always manually unset them before saving?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Have you added the code to your view to display the error?
http://book.cakephp.org/view/564/displaying-auth-error-messages
On Aug 27, 10:22 am, luigi7up <[EMAIL PROTECTED]> wrote:
> My
> $this->Auth->loginError ='Invalid username or password';
> won't show on login.ctp view
>
> This is what I have in app_controller:
> var $components = array('Acl','Auth');
>
> function beforeFilter(){
> //Mijenja hash funkciju auth komponente iz defaultne
> u md5
> Security::setHash('md5');
> $this->Auth->fields = array('username' => 'username',
> 'password' =>
> 'password');
> $this->Auth->loginAction = array('controller' =>
> 'users', 'action'
> => 'login');
> //$this->Auth->loginRedirect = array('controller' =>
> 'users',
> 'action' => 'index');
> $this->Auth->loginError ='Invalid username or
> password';
> $this->Auth->logoutRedirect = '/';
> $this->Auth->authorize = 'controller';
>
> }
>
> /*When authorize is set to 'controller',
> you'll need to add a method called isAuthorized() to your
> controller.
> This method allows you to do some more
> authentication checks and then return either true or false.*/
>
> function isAuthorized() {
> return true;
> }
> In users_controller my login() is empty because Auth component
> automagic
>
> and when I debug my session with debug($_SESSION); I see that error is
> sent, but it si always set - even when I call users/login action for
> the first time (I mean without submiting wrong data)?!?!:
> Array
> (
> [Config] => Array
> (
> [userAgent] => 0f8a6ac2e2c891dce1f3f114fdaad715
> [time] => 1219830026
> [rand] => 32701
> [timeout] => 10
> )
>
> [Message] => Array
> (
> [auth] => Array
> (
> [message] => Invalid username or password
> [layout] => default
> [params] => Array
> (
> )
>
> )
>
> )
>
> How can I get this login error working?
>
> thanks
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
I had exactly this issue before but setting the security setting from
High to Medium fixed it for me.
Check your httpd error logs for any warnings about missing files/
images etc.
On Aug 27, 11:23 am, AussieFreelancer
<[EMAIL PROTECTED]> wrote:
> ok, so no whitespace, but still not sure what is causing it.. still
> the same issue, doesn't seem to like the sessions very much and kicks
> me out randomly... has no-one had this before?
>
> On Aug 7, 9:46 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>
> > Also check for whitespace:http://bin.cakephp.org/view/1837474952
>
> > On Thu, Aug 7, 2008 at 4:35 AM, AussieFreelancer
>
> > <[EMAIL PROTECTED]> wrote:
>
> > > Hmm, I changed it from High to Medium with no effect, and also to Low
> > > without having any effect either... I will double check the links for
> > > non-existent files, this could be something to do with it, as if i
> > > press refresh a couple of times quickly it logs me out, not sure this
> > > is what is happening every time, but I know that refreshing twice fast
> > > certainly does it...
>
> > > So no known issues with sessions and Zeus or anything like that?
>
> > > Thanks
>
> > > Patrick
>
> > > On Aug 6, 6:46 pm, acoustic_overdrive <[EMAIL PROTECTED]>
> > > wrote:
> > >> This is probably not server-specific, but on one application I was
> > >> building it took me ages to realise why sometimes I was getting logged
> > >> out and other times not. I eventually realised that I had a CSS link
> > >> that was pointing at a non-existent file, and this caused the page to
> > >> continue trying to load it in the background. If I cancelled the page
> > >> loading prematurely by clicking on a link and visiting another page, I
> > >> would stay logged in. But if I allowed the page to complete its
> > >> loading, it would log me out. When I corrected the broken link it
> > >> behaved fine again.
>
> > >> That was not using the latest release so perhaps newer versions are
> > >> OK.
>
> > >> On Aug 6, 3:21 am, AussieFreelancer <[EMAIL PROTECTED]>
> > >> wrote:
>
> > >> > Hello, I have a client who's website is hosted on a server powered by
> > >> > zeus instead of apache. I have already run into issues with the
> > >> > rewrite which are now resolved, but there seems to also be an issue
> > >> > with the Auth components...
>
> > >> > I have an administration panel as a plugin, which works on other
> > >> > sites, but for some reason, on this particular site, it randomly kicks
> > >> > the user out. Sometimes I can't even get to one page without it
> > >> > kicking me out, other times i can update 5 things and then it will
> > >> > kick me out... does anyone know why this is? I have security set to
> > >> > low, I thought that maybe it was to do with that but doesn't seem to
> > >> > have made a difference...
>
> > >> > Would love to hear any suggestions on how to resolve this as the admin
> > >> > panel isnt really usable until it is fixed..
>
> > >> > Thanks
>
> > >> > Patrick
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
@wisecounselor
> never mind, sorry to bother you, knew this was a waste of time
Um, AD7six answered your question later on in his post. That is why he
asked you if you'd continued reading...
On Aug 25, 7:49 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> never mind, sorry to bother you, knew this was a waste of time.
>
> On Aug 25, 1:18 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Aug 25, 8:13 pm, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > sorry, I think I follow, maybe more specific objects will help, I have
>
> > > Patient -> Diet Plans -> Diet Calendar Day
>
> > > So Patient hasMany diet plans with each Diet Plan having many Diet
> > > Calendar Days
>
> > > I need to draw a screen of all patients and loop through 2 weeks of
> > > the calendar, filling in details of each day for each patient, but I
> > > need to be able to filter this at times by Patient last name,
> > > sometimes by a field in Diet Calendar Days and other times in a field
> > > in the Diet Plan. So they way I have it, I can't do Patient-
>
> > > >find('all',array('condition' => 'DietPlan.active' => 1));
>
> > > or
>
> > > Patient->find('all',array('condition' => 'DietPlanDay.exception' =>
> > > 1));
>
> > Did you stop reading at "why the abstract names?" ?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
You may not think it now but your form IS related to a model ;-)
See Jonathan snooks example of a contact form:
http://snook.ca/archives/cakephp/contact_form_cakephp/
Jonathan creates a tableless model and defines the schema by hand.
That way you get all the benefit of cake's helpers (validation etc.)
On Aug 26, 5:29 pm, Enrique Delgado <[EMAIL PROTECTED]> wrote:
> Thanks Samuel and validkeys.
>
> Samuel, very true, I do like extending the functionality of CakePHP,
> that is probably one of the best ways to go when we need something
> more custom.
>
> This time, I had totally overlooked the regular Form helper methods
> like text(), password(), etc. Thanks validkeys for pointing this out.
> I was getting too caught up and spoiled by the input() automagic
> method, my bad.
>
> Using the regular methods works just fine.
>
> Thanks!
>
> On Aug 26, 11:15 am, validkeys <[EMAIL PROTECTED]>
> wrote:
>
> > Hey Enrique,
>
> > You could still use the regular forms:
>
> > create('Search',array('url' => '/search','type' =>
> > 'get')) ?>
>
> > text('query',array('type' => 'textarea')) ?>
>
> > end('Search!') ?>
>
> > On Aug 26, 11:45 am, Enrique Delgado <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hi All,
>
> > > The core Form helper works great as long as you have a model behind
> > > it, but what about forms that are not related to a model?
>
> > > Is there any helpers that I can use in the view? Or do I just code
> > > plain HTML?
>
> > > Thanks!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
This is how Cake does it in the scaffold home page:
getDataSource('default');
?>
isConnected()):
echo '';
__('Cake is able to connect to the database.');
echo '';
else:
echo '';
__('Cake is NOT able to connect to the
database.');
echo '';
endif;
?>
On Aug 26, 8:33 pm, aranworld <[EMAIL PROTECTED]> wrote:
> I wonder if we have the same web host ... Hostway perhaps?
>
> I am just in the middle of figuring this out as well and I came across
> the following code that I believe still works, however, I must warn
> you that I have not tested this out fully, but maybe this will at
> least put you in the right direction?
>
> $db =& ConnectionManager::getDataSource('default');
> if(empty($db->connection)){
> // you don't have a connection
>
> }
>
> On Aug 26, 10:55 am, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
>
> > I use the php functions for connecting to the database and then
> > redirect if it fails to a static page, usually from bootstrap.php if I
> > find that it becomes a problem on a host.
>
> > Sam D
> > --
> > (the old fart) the advice is free, the lack of crankiness will cost you
>
> > - its a fine line between a real question and an idiot
>
> >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-m...
>
> > On Tue, Aug 26, 2008 at 10:51 AM, bbf <[EMAIL PROTECTED]> wrote:
>
> > > My flaky webhost's MySQL process goes down randomly every few weeks.
>
> > > Cake doesn't throw an error, but instead gives a "Missing Table" error
> > > and displays a weird page (the layout nested 4 times).
>
> > > How and where would I test the db connection myself?
>
> > > (I want to show my own pretty "Temporarily down for maintenance" msg
> > > -- I know how to throw and show the error, I just don't know where to
> > > put the code that tests the connection)
>
> > > Thanks!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
What tram said... change the field to an Int. Mysql tinyint datatype
has traditionally been used to store boolean data as MySQL doesn't
have a boolean datatype.
Alternatively, use a 1 byte char field.
Or change your options to be
null = Pending (the database default)
0 = Disapprove
1 = Approve
Or use an enum. Note: enums are mysql specific and are not directly
supported by cake. This doesn't mean you can't use them though (cake
treats them as a standard varchar field). There are some behaviours
out there that can help with enums.
As to the white screen of death, check out the httpd error logs and
the cake error logs (app/tmp/logs/error.log)
On Aug 26, 11:45 pm, [EMAIL PROTECTED] wrote:
> oh cmon you dont expect good anwers when you're bashing the fw like that ?
>
> cake interprets int(1) as bool , its a design choice. you are welcome
> to update the book.cakephp.org to reflect that.
>
> "white screen of death" - sorry im not getting it with your code, you
> sure the radio call is causing it ?
>
> On 8/27/08, Mark (Germany) <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > oh my gosh
> > cake again.. typical
>
> > by using TINYINT(1) it is assumed that you have a checkbox toggle with
> > 0 and 1 as values i guess.
> > anyway, after changing it to TINYINT(2), this automagic correction is
> > no longer active
> > and my value now is -1 in the Database
> > Where in the documentation did i miss that?
>
> > Are there more of these automatic corrections where a normal cake user
> > would not assume it?
>
> > PS: about the white screen of death - anyway - are there any solutions
> > to it?
> > other than having to use a dummy "default"?
>
> > thx mark
>
> > On 26 Aug., 23:37, "Mark (Germany)" <[EMAIL PROTECTED]>
> > wrote:
> >> Well - CakePHP and Rapid Development can be two things that dont get
> >> along with each other sometimes.. :)
> >> i try for hours now...
>
> >> first of all if you do not set a default value cake crashes completely
> >> - white screen of death all of the sudden:
> >> $form->input('status',array('type'=>'radio','options'=>array(1=>Disapprove',
>
> >> 1=>'Approve'),'legend'=>false));
>
> >> so i was forced (i really hate that - if i am forced to workaround
> >> something) to add a dummy "pending" one:
> >> $form->input('status',array('type'=>'radio','options'=>array(0=>'Pending',-1=>Disapprove',
>
> >> 1=>'Approve'),'legend'=>false));
>
> >> ok, so far so good, but
>
> >> in the second code sample (i tried with both integer -1 0 1 and '-1'
> >> '0' '-1'), the -1 always gets changed to 1 when saved to the database
> >> - i debugged it and found out, that it is (inside of $this->data)
> >> still -1 after validation and - i did not believe it - after having
> >> saved the fields. so cake transformes it wrongly or something when
> >> saving it.
>
> >> the DB table setting is:
> >> `status` tinyint(1) NOT NULL default '0' COMMENT '-1 dissap. 1
> >> approved',
> >> so neg. values should be no problem...
>
> >> and the query clearly shows that it is cake's "fault":
> >> UPDATE `role_applications` SET `id` = 2, `status` = 1, `check_text` =
> >> 'somehting', `adminonly_text` = 'whatever', `checked_by` = 1,
> >> `check_date` = '2008-08-26 23:34:29' WHERE `role_applications`.`id` =
> >> 2
>
> >> anyone an idea what is going on?
> >> how can i use negative values for radio buttons then?
>
> >> if this goes on, i wont have any project done by the end of next
> >> year..
> >> mark
>
> --
> Marcin Domanskihttp://kabturek.info
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
After a bit of struggling, I've managed to get a CakePHP app running
on IIS.
I've running it without mod_rewrite so I followed the instructions in
core.php and removed .htaccess files and uncommented the line:
Configure::write('App.baseUrl', env('SCRIPT_NAME'));
I've installed my cake app into:
c:\Inetpub\php_test\
I'm getting an error in a couple of places in my code, along the lines
of:
Warning (2): file_exists() [function.file-exists]: open_basedir
restriction in effect. File(/index.php/app/webroot/user_backgrounds/
1.xml) is not within the allowed path(s): (c:\Inetpub) [APP\views
\elements\painter.ctp, line 133]
Reading a bit further I've made the changes to /app/webroot/index.php
/**
* The full path to the directory which holds "app", WITHOUT a
trailing DS.
*
*/
if (!defined('ROOT')) {
define('ROOT', "\\Inetpub\\php_test");
}
/**
* The actual directory name for the "app".
*
*/
if (!defined('APP_DIR')) {
define('APP_DIR', "\\Inetpub\\php_test\\app\\");
}
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
*/
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', "\\Inetpub\\php_test");
}
What am I missing/doing wrong?
Thanks in advance :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
Sounds like the Auth component is redirecting you away from a
protected page, to another protected page - hence the loop.
In your Users controller do you have a login action?
On Aug 26, 9:19 am, luigi7up <[EMAIL PROTECTED]> wrote:
> I'll try this. I read about this but I thought they were talking about
> other databases and not MySql.
> thx...
>
> On Aug 26, 8:57 am, aranworld <[EMAIL PROTECTED]> wrote:
>
> > I have had situations in which I was unable to use a column named
> > "password" and had to instead use something like "passwd". I believe
> > it is a reserved keyword issue with MySQL? Not sure if it was just
> > related to an older version, but you might at least try changing the
> > column name.
>
> > -Aran
>
> > On Aug 25, 12:32 pm, luigi7up <[EMAIL PROTECTED]> wrote:
>
> > > Ola, everyone...
>
> > > //Using RC2 version of CakePHP
>
> > > I'm building simple application that allows users to write articles.
> > > So there are their corresponding models and controllers.
>
> > > Few days ago I made custom Login/register part of application that
> > > writes username to session etc. but now I decided to use Auth
> > > component for this purpose.
> > > As soon as I define:
> > > var $components = array('Auth');
> > > in my users_controller or app_controller, application stops working.
> > > Firefox gives following error: "Firefox has detected that the server
> > > is redirecting the request for this address in a way that will never
> > > complete." So, some infinite loop occured definitely and I'm quite
> > > sure that I didn't cause it :)
>
> > > I found few posts about this problem but none of them resolves my
> > > problem.
>
> > > The weirdest thing,to me, is that error occurs as soon as I include
> > > Auth component; I don't even use one method of that class ?!?
> > > Also another confusing part with this problem is that my other
> > > controllers also stop working with same output eventhough component
> > > Auth is included only in users_controller. User model is in
> > > association with articles model but I think that articles_controller
> > > shoud with or without component Auth included in users_controller. Am
> > > I wrong?
>
> > > My database is USERS and has fields username and password and also
> > > there is a model for users table.
>
> > > Thanks in advance
>
> > > Luka
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Also (may be related), in the element, why doesn't the following work?
css(array(
"element.site_search"
), null, array(), false);
?>
(the CSS file isn't being linked in the head)
It works if the last param is true, but the code is embeded in the
page and not the head.
On Aug 24, 11:27 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> I have a simple element:
>
> site_search.ctp:
> create("Search") ?>
> inputs() ?>
> end("Search") ?>
>
> Model Search is a tableless model which I manually create the schema
> for:
>
> search.php:
> class Search extends AppModel {
>
> var $useTable = false;
>
> var $_schema = array(
> "search_for"=>array(
> "type"=>"string",
> "length"=>128
> )
> );
>
> }
>
> Problem: The inputs() call in the element is coming back blank. It
> works fine if I point the form at a model (ie. it generates the
> inputs) with a real database table behind it, but not for one with a
> $_schema.
>
> I tried adding:
>
> App:Imort("model", "Search");
>
> to the element, but that didn't help.
>
> How do I get an element to 'see' a model in this way?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Nothing to add apart from props to Rafael for an excellent answer.
On Aug 23, 2:05 am, Rafael Bandeira aka rafaelbandeira3
<[EMAIL PROTECTED]> wrote:
> Oh, I almost slept, you should try to more clear and less verborragic,
> so many explanation just messed up things more and more...
> And you should do 2 things when you can't speak a language : 1) look
> for groups with the same language of yours and 2) say your
> nacionality, so members from the same country can get sensible with
> you and try to help you more
>
> "stop the bullshit and answer me..."
>
> OK, answers :
>
> > 1) Do I have to manually set up Foreign keys for tables?
>
> it depends, did you sitcked to conventions?
> Your CarAd Model has the following scheme and linking convention:
>
> id - primaryKey
> car_type_id - className => CarType, uses table ->
> car_types
>
> car_brand_id - className => CarBrand, uses table ->
> car_brands
>
> car_fuel_id - className => CarFuel, uses table
> -> car_fuels
> car_transmission_id - className => CarTransmission, uses
> table -> car_transmissions
> year
> ad_county_id - className => AdCountry, uses table
> -> ad_countries
> ad_borough_id - className => AdBorough, uses table ->
> ad_boroughs (?)
>
> info
> price
> car_ad_type_id - className => CarAdType, uses tabl ->
> car_ad_types
>
> added <- tip : is this field meant to hold the
> datetime of row creation? if yes, rename it to "created" and cakePHP
> will handle it for you
>
> Said that all this foreign keys says : this CarAd belongs to this
> CarType, and to this CarBrand, and to that CarFuel... so you should
> have in your model class:
>
> class CarAd extends AppModel {
> var $belongsTo = array (
> 'CarType', 'CarBrand', 'CarFuel', 'CarType',
> 'CarTransmission', 'AdCountry', 'AdBorough',
> )
>
> }
>
> now CakePHP will map all your model's foreign keys and you will be
> able to access this relateds models as a property of your CarAd
> model :
> // inside your model
> $this->CarType->find([...]);
> inside your controller
> $this->CarAd->CarType->find([...]);
>
> answered? moving on...
>
> > 2) Do I have to build model for each table I need to get id's
> > from..even if the table itself will stay static ? (model for
> > car_transmissions, car_fuels_id... tables)
>
> No, actually CakePHP map table names for you too.
> >>http://www.littlehart.net/atthekeyboard/2008/08/05/dynamic-models-in-...
>
> > By static I mean that I don't need to add or delete data from it
> > because probably there will not be any new transmission types
> > coming. I only need to read info from it.
>
> > I know 100% that I have to build model for tables which will have
> > dynamic content...like table car_brand. (new car brand comes.. for ex.
> > "BMW-Jaguar"..and I need to add it to table from site...not manually)
>
> you should avoid this kind of thinking...
>
> > So my main table at this time is car_ads and I have controller for
> > it... and it also gives me it's table contents with simple index():
> > function index() {
> > $this->set('carads',$this->CarAd->find('all'));
> > }
>
> > But I want to see text in the list..not that number which I have on
> > car_transmission_id field. (Instead of number 1 I would like to see
> > text: "Automatic")
> > Currently line looks like this: Brand: 5 Year: 2000 Transmission: 1
> > Gas: 2
> > But it should look like this: Brand: Chevrolet Astro Year: 2000
> > Transmission: Automatic Gas: Benzine
>
> No actually it shouldn't, what is happening is the normal and expected
> behavior.
>
> I'll explain what is already in the manual about cakePHP's data
> scheme, I'll wont reproduce arrays here because it would be very ugly
> and painfull for me so take this as example
> :http://book.cakephp.org/view/448/findall
> -> the grey box at the bottom of the content...
>
> that's how your data will return but with the your model names...
> back to your CarAdsController::index() :
>
> > function index() {
> > $this->set('carads',$this->CarAd->find('all'));
> > }
>
> in your view you will have a var named 'carads', and you'll be able to
> access data as the array in the link shows :
> // first entry's CarTransmission.transmission wil be accessed like
> this
> echo $carads[0]['CarTransmission']['transmission'];
>
> // the nth entry/row CarBrand.name will be accessed like this
> echo $carads[$num]['CarBrand']['name'];
>
> for a dynamic list or table generation, you would do something like
> this:
> foreach($carads as $entryNum => $entryData)
> {
> echo 'Transmission: ' . $entryData['CarTransmission']
> ['transmission'];
> echo 'Brand : ' . $entryData['CarBrand']['name'];
> echo 'Country : ' . $entryData['CarCountry']['name'] . '';
>
> }
> > I'll try to explain it once more..maybe
I'd do it this way round:
parent::beforeFilter();
$this->Auth->allow(array('display'));
So the controllers can override settings in AppController
On Aug 24, 8:44 am, tekomp <[EMAIL PROTECTED]> wrote:
> Thanks Sam. Got it to work after realizing that "display" is a built-
> in action to the built-in pages controller.
>
> On Aug 23, 8:22 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
>
> > try
> > $this->Auth->allow(array('display'));
> > parent::beforeFilter();
>
> > 2008/8/23 tekomp <[EMAIL PROTECTED]>
>
> > > I'm using the Auth Component in my app_controller.php in the
> > > beforeFilter function, which is great for making people login, but I'm
> > > having a hard time allowing certain pages. I want all pages in my
> > > "Pages" controller to not require authorization, so I added $this-
> > > >Auth->allow('*') in my beforeFilter in pages_controller.php.
> > > Problem with that is that it overrides the beforeFilter in
> > > app_controller.php and I cannot access $this->Auth. I tried adding
> > > parent::beforeFilter in pages_controller.php, but it then does not
> > > recognize my $this->Auth->allow('*').
>
> > > I've tried a number of things and read all the tutorials I could find,
> > > but still can't find a way to allow an entire controller while
> > > maintaining this->Auth. It doesn't seem right that I'd have to add
> > > the Auth code to each individual controller.
>
> > > Any ideas?
>
> > > Thanks.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
You need to combine them both into 1 hasMany array:
var $hasMany = array(
'Childclass1' => array(
'className' => 'Childclass1'
),
'Childclass2' => array(
'className' => 'Childclass2'
)
);
On Aug 22, 12:43 am, robert123 <[EMAIL PROTECTED]> wrote:
> i have parent model, it has two hasmany child model,
>
> in the model class, I tried to model this relation by writing two time
> in the parent model class
>
> var $hasMany = array('Childclass1' =>
>array('className' =>
> 'Childclass1');
>
> var $hasMany = array('Childclass2' =>
>array('className' =>
> 'Childclass2');
>
> but it giving me the below error
> Cannot redeclare Childclass2::$hasMany
>
> anyone can let me know, how to solve this, thank you
>
> http://www.generics.ws/jpn/レビトラ(塩酸バルデナフィルHCL_)に20_MGについて-p-115.htmlhttp://www.generics.ws/jpn/プロペシア(フィナステライド)-p-4.htmlhttp://www.generics.ws/jpn/バイアグラ(クエン酸シルデナフィル)-p-2.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
$contacts = $this->Contact->find('first',
array(
'conditions' =>
array('Contact.jobType' => 'main)
)
);
Note the 'first' parameter.
On Aug 22, 12:40 am, eagle <[EMAIL PROTECTED]> wrote:
> Hi,
> First of I'm new to Cake and tryign it out for the first time - I've
> searched here and on Google to solve what I suspect will be an
> idiotically simple question
>
> Two tables:
> VENUES hasmany CONTACTS
> all linked in the models correctly
>
> On my default view of the venues table I want to filter the contacts
> to display only one of the potentially many based on a field value of
> 'main'.
>
> venues_controller::index() is
> $this->Venue->recursive = 1;
> $this->set('venues',$this->paginate('Venue'));
> $venues = $this->Venue->find('all');
>
> and contacts_controller::index() is
> $this->Contact->recursive = 1;
> $contacts = $this->Contact->find('all',
> array(
> 'conditions' => array('Contact.jobType' =>
> 'main)
> )
> );
> $this->set('contacts', $contacts);
>
> I can retrieve all contacts for a venue on the index view for venues,
> but I only want the 'main' one.
>
> Should I set up a custom query in the venues_controller to do this? Or
> am I missing somehting more obvious?
>
> Thanks for any guidance.
>
> Eagle
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Dunno about 'best', but this works:
In your view (search.ctp)
create("Model", array("action"=>"search",
"type"=>"get") ?>
input("search_for") ?>
end("Search") ?>
... output your result here
In your controller:
function search() {
if (isset($this->params['url']['search_for'])) {
$scope = array("@[EMAIL PROTECTED] LIKE
'".$this->params['url']
['search_for']."%'");
}
else {
$scope = array();
}
$results = $this->Paginate("@Model", $scope);
$this->set("results", $results);
}
Replace @Model and @field with the name of the model and field you
want to search on.
On Aug 21, 1:10 pm, bitkidoku <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I am implementing a search form. But I want to make search results
> linkable like: "http://somehost/products/search/keyword"; (keyword is
> the word that is being searched).
>
> What is the best practise to achieve this? And what if the user could
> search defining many parameters like title, content, ingredients etc.?
>
> I googled this but I couldn't find any meaningful results.
>
> Thank you very much for your answers.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
I think the 1000 was for illustration only.
I'd run a few quick benchmarks to see what the real difference between
1 insert with 1000 values() and 1000 queries would be. I'm betting it
wont be much...
On Aug 20, 11:04 pm, teknoid <[EMAIL PROTECTED]> wrote:
> AFAIK, the syntax you are proposing is MySQL (or at least DB vendor)
> specific.
> So, it won't be supported by cake.
>
> And do you really insert 1001 rows?
>
> On Aug 20, 5:51 pm, seth <[EMAIL PROTECTED]> wrote:
>
> > > > Right, but how many inserts does this perform?
>
> > > - As many inserts as required
>
> > Yes, but my whole point is that if you are inserting 1000 questions,
> > this could be done in 2 interests or 1001... Is cake currently smart
> > enough to do it in 2?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
What Fahmi said.
with
echo $this->renderElement('post_element', $post);
You are creating a variable in the element called $post_element (with
the value of $post)
The only reason its working for you at the moment is that you have
already created a variable in the view called $post:
foreach($posts as $post)
As all the variables share the same namespace, I would recommend:
echo $this->renderElement('post_element', $post);
and in the element, use $post_element to avoid confusion/overwriting
the $post in the view.
On Aug 21, 8:59 am, Fahmi Adib <[EMAIL PROTECTED]> wrote:
> i think you should use an array,
>
> array('post' => $post)
>
> On Aug 21, 2008, at 2:56 PM, rocket wrote:
>
>
>
> > hey guys im passing this:
>
> > foreach($posts as $post)
> > echo $this->renderElement('post_element', $post);
> > }
>
> > but in my post_element i try to use
>
> > $post['title']
>
> > and it throws me this problem Notice: Undefined variable:
>
> > Am i missing something? i'm real confused and have spent like 1 hour
> > trying to debug this...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---
Did you reboot apache after you made changes to httpd.conf?
And, btw, Cake with Apache & PHP on Vista is entirely possible - I'm
doing it right now :-)
On Aug 19, 7:49 am, giulio <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm new of cake php.
>
> I'm trying to install cakephp in windows vista, i downloaded and
> installed xampp and all seems to be fine.
>
> I've followed the instructions for cake php and it goes well.
>
> I've only some problems:
>
> 1- I can't see the graphic of the default cake php page, i read that
> it depends of configuratione of httpd.conf so i set the options
> FollowSyLinks to AllowOverride All and the correct path, but i've not
> solved the problem
>
> 2- I tried with a simple cake php application made by other (a
> todolist application ) but when i write the
> controllerhttp://localhost/todo/items
> i can see only the result Object not found... maybe are there problems
> with htaccess? I able mod rewrite.
>
> If someone has a file httpd.conf please send me this file to me, so i
> can solve all the configurations problems.
>
> Thanks Giulio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
You can save yourself a *lot* of heartache with this issue by leaving
off the closing ?> in your php files :-)
--- snip ---
is optional
On Jul 17, 2:20 pm, haj <[EMAIL PROTECTED]> wrote:
> I'm using this editor on windows:
>
> http://www.emeditor.com/
>
> There is a checkbox in config menu if to add BOM or not for UTF-8.
> Some editor may not have this feature.
>
> On Jul 16, 1:07 pm, Stinkbug <[EMAIL PROTECTED]> wrote:
>
> > Excuse my stupidity on this topic, but I don't really understand
> > encoding at all. So how exactly do I save a a file without the BOM?
>
> > Does it require special software, or what? I'm on windows.
>
> > On Jul 14, 11:39 pm, haj <[EMAIL PROTECTED]> wrote:
>
> > > So, I basically saved all UTF-8 files without BOM and now things works
> > > beautifully.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Folder?
On Jul 17, 2:53 pm, "Jonathan Snook" <[EMAIL PROTECTED]> wrote:
> This wasn't easy to track down but apparently there are 5 reserved
> class names in PHP:
>
> __PHP_Incomplete_Class, stdClass, exception, php_user_filter and.
> Directory!!
>
> http://ca3.php.net/manual/en/reserved.classes.php
>
> So, use another name.
>
> On Thu, Jul 17, 2008 at 7:11 AM, web <[EMAIL PROTECTED]> wrote:
>
> > It is not the code that i was written, just write for this copy
> > anyone please try to create a table named 'directories' and try to
> > access it by accessing the controller and model according to the cake
> > rules and conventions ... am sure you can not access .
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Assuming you are using Apache 2.2:
In apache.conf
uncomment this line:
LoadModule rewrite_module modules/mod_rewrite.so
This will enable mod_rewrite
You then need to allow cakephp .htaccess file to take over control of
your webroot:
In your section for your webroot folder (mine is c:
\htdocs):
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI
MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options
All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please
see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed
in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
Hope this helps :-)
On Jul 17, 8:53 am, Russell <[EMAIL PROTECTED]> wrote:
> Hello,
> I m very new & struggling with cake 1.2. Now I've 2 problems.
>
> 1) I m using wamp server in local host. After install cake1.2 in
> localhost, I m not getting cake default page (I mean with some color &
> css etc), but I can get my page after routing from route.php file.
> Perhaps mod_rewrite is not enable in my httpd.conf file, In there on
> ly lines exist:
>
> LoadModule rewrite_module modules/mod_rewrite.so
> #AddModule mod_rewrite.c
> But, how can I enable mod_rewrite?
>
> 2) I m working with my own index page, where I started a simple blog.
> I create a link nameed "add" & create add.thtml page. but, I m
> getting the "page can not found error 404" after clicking the link!!!
>
> But it's working with cake 1.19...
> So, wheres the problem with cake1.2???
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Try putting some data in your groups table. Cake will change the
textbox to a drop down select list.
On Jul 15, 10:35 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> Recognize relationships based on InnoDB relationships is planned to CakePHP
> 2.0.https://trac.cakephp.org/wiki/Proposals/2.0ToDoList
>
> []'s
>
>
>
> On Tue, Jul 15, 2008 at 4:07 PM, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > Does anybody know what could be wrong.. if I would bake my model /
> > controllers / views for users
> > it will just put a input text box for usergroup_id and in the model it
> > just says:
>
> > > class Users extends AppModel {
> > var $name = 'Users';
> > }
> > ?>
>
> > Here is the table setup..
>
> > ---
> > CREATE TABLE `usergroups` (
> > `id` int(11) NOT NULL auto_increment,
> > `name` varchar(120) NOT NULL,
> > `created` datetime NOT NULL,
> > `modified` datetime NOT NULL,
> > PRIMARY KEY (`id`)
> > ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
>
> > CREATE TABLE `users` (
> > `id` int(11) NOT NULL auto_increment,
> > `username` varchar(120) NOT NULL,
> > `password` varchar(120) NOT NULL,
> > `usergroup_id` int(11) NOT NULL,
> > `created` datetime NOT NULL,
> > `modified` datetime NOT NULL,
> > PRIMARY KEY (`id`),
> > KEY `fk_usergroup_id` (`usergroup_id`)
> > ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> > ---
>
> > Does anybody know why it would not recognize the other table?
>
> --
> Renan Gonçalves - Software Engineer
> Cell Phone: +55 11 8633 6018
> MSN: [EMAIL PROTECTED]
> São Paulo - SP/Brazil
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Also, you can manually add the html tags and not rely on the helper.
That said, the helper is *very* flexible and can accommodate a lot of
customisations :-)
On Jul 15, 12:33 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]>
wrote:
> HtmlHelper::tags could be a posibility.
>
> On Tue, Jul 15, 2008 at 12:20 AM, Jonathan Snook
>
> <[EMAIL PROTECTED]> wrote:
>
> > Probably your best bet is to create your own helper that uses the base
> > elements like $form->text and $form->error. Wrap your own HTML around
> > those. Take a look at how $form->input does it and model yours around
> > it.
>
> > -Jonathan
>
> > On 7/14/08, Tallbrick <[EMAIL PROTECTED]> wrote:
> >> I have been hitting Google hard for any tutorials on customizing the
> >> output of Cake's form helpers. Namely adjusting the output of radio
> >> and checkbox arrays using the 'automagic' form helpers.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---