Re: Custom tags.php not working in 1.2
Still curious about this - using custom tags in 1.2 - is it possible, and what format is it looking for? It looks like tags.php with a $tags array merging with the $tags in HTML helper. Is this correct? Does it load by default and check for custom tags? On Feb 22, 4:19 pm, "nateklaiber" <[EMAIL PROTECTED]> wrote: > I am now having the same issue in 1.2 trying to create custom tags. > The previousloadConfigfile used to parse an ini file. Now, it looks > to be including a tags.php file. Is it now looking for a tags array or > still an ini format? > > Also, does it need to be manually loaded in custom helpers? > > On Feb 7, 12:07 pm, "Pepepaco" <[EMAIL PROTECTED]> wrote: > > > Using latest CakePHP 1.2.0.4451alpha, I have find that mycustomtags > > in /app/config/tags.php are not used anymore. > > > Looking at the Cake sources, thistags.php file is loaded in function > >loadConfig() from cake/libs/view/helper.php; but there is no code > > calling this function, except for the Text helper (cake/libs/view/ > > helpers/text.php). In Cake 1.1.x,loadConfig() is called from cake/ > > libs/view/view.php before loading helpers. > > > Anybody knows if there is a new way of definingcustomtagsin Cake > > 1.2? Or if this just a bug? Maybe I should create a new ticket? > > > Thanks everybody! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: R: Menu from database
Just a 'second thanks' as LSL said. I was looking for this same solution (seems others are too, in other threads) - and this seems to be the best solution/placement to get the desired effect. Seems simple now that I look at it. On Mar 19, 3:30 am, "GMail" <[EMAIL PROTECTED]> wrote: > I made a little test and I have put: > > pr($this->uses); > exit(); > > in cake/libs/controller/controller.php __construct() function, before it > exiting. > What I discovered was that if you set $uses to null or an empty array() in > your controller > it overrides the declaration in app_controller, dunno if it's a bug or a > features, but > I suggest to use this snippets, to dinamically load data from menu table, > that for me is preferred > method, or better you can write a component and a helper but this is another > story ;). > > class AppController extends Controller { >// var $uses=array('MenuItem'); // There is no more need for this > >function beforeFilter() { > parent::beforeFilter(); > loadModel("MenuItem"); > $menuItem = new MenuItem; > $this->set('menuElement', $MenuItem->findAll()); >} > > } > > I have not tested this, it's based on my little knowledge. > If there is somethingh wrong let me know. > cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using multiple databases with Cake
Nate, Thanks for the code sample. I am glad I was wrong in this instance, this proves to be very helpful. I apologize for not trying the earlier example - not sure why I bypassed it last time I read this thread. Peace, Nate On Mar 16, 12:46 pm, "nate" <[EMAIL PROTECTED]> wrote: > Actually, if you looked, you'd see that Ryan Rose already posted a > code sample, which, on review, seems to be perfectly valid and > accurate. > > On Mar 16, 12:43 pm, "nate" <[EMAIL PROTECTED]> wrote: > > > (these code samples demonstrate the *correct* way to do it, and are > > 1.1 and 1.2 compatible): > > > // database.php: > > > var $default = array( > > 'driver'=> 'mysql', > > 'persistent'=> false, > > 'connect' => 'mysql_connect', > > 'host' => 'localhost', > > 'login' => 'root', > > 'password' => 'pass', > > 'database' => 'my_db' > > ); > > > var $other = array( > > 'driver'=> 'mysql', > > 'persistent'=> false, > > 'connect' => 'mysql_connect', > > 'host' => 'localhost', > > 'login' => 'root', > > 'password' => 'pass', > > 'database' => 'my_other_db' > > ); > > > // models/first.php: > > > class First extends AppModel { > > var $hasMany = 'Second'; > > > } > > > // models/second.php: > > > class Second extends AppModel { > > var $useDbConfig = 'other'; > > var $belongsTo = 'First'; > > > } > > > Any questions? > > > On Mar 16, 12:26 pm, "rtconner" <[EMAIL PROTECTED]> wrote: > > > > I second nateklaiber. I would like to see some code examples also. > > > The only way I've managed to do what you describe is to use > > > getDataSource() and do it manually. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using multiple databases with Cake
Grant, I would be interested in finding out how you accomplish this (not to hijack the topic)? Any code examples? I don't doubt you are right - I just haven't found a solution that would let me manage the application between 2 databases. For instance, in a recent application (that already had data) they had a database 'users' that housed all user information, profile, emails, addresses, etc. Then there was another database just for news, events, reviews, etc. Inside of the second database were the relationships to the users in the first database. So I would need to manage a User (from the user database) who has many Reviews (from the content database). I don't need to switch between databases - I want to manage two simultaneously. I know you can set $useDbConfig, but I have tried using that and it doesn't seem to recognize the relationships between two databases. I hope I am incorrect - as I would love to find a solution for this. On Mar 15, 6:58 pm, "Grant Cox" <[EMAIL PROTECTED]> wrote: > Just to clarify, what nateklaiber says is incorrect - you can > definitely have multiple databases used in the same application, all > used in the same action. The only issue I have found with it is that > you need to provide a different MySQL username / password for the > second connection in your app/config/database.php. Apparently this is > a bug with MySQL, or the PHP connector. > > On Mar 16, 6:47 am, "nateklaiber" <[EMAIL PROTECTED]> wrote: > > > If you are looking to actually use both databases, I don't think this > > is possible with cake. The options others are giving you are to switch > > between development/production/etc databases. Are you looking to use 2 > > together throughout the application, or just switch between two? > > > I had an issue where I had 2 databases - and tables in each were > > linked to each other. This wouldn't work for Cake (at least to my > > knowledge). > > > Hope that helps... > > > On Mar 15, 1:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I was wondering if it would be possible to use two databases in cake. > > > Some models would access tables in one database and other models would > > > access tables in another database. > > > > Thanks > > > > Guy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using multiple databases with Cake
If you are looking to actually use both databases, I don't think this is possible with cake. The options others are giving you are to switch between development/production/etc databases. Are you looking to use 2 together throughout the application, or just switch between two? I had an issue where I had 2 databases - and tables in each were linked to each other. This wouldn't work for Cake (at least to my knowledge). Hope that helps... On Mar 15, 1:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I was wondering if it would be possible to use two databases in cake. > Some models would access tables in one database and other models would > access tables in another database. > > Thanks > > Guy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Assigning variables to default layout with PagesController
I should mention that it was actually $this->renderElement('shows', array('layoutShows' => $layoutShows) (this was a mistake in my previous post). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Assigning variables to default layout with PagesController
I have a project I am working on where I have several static pages that use the default layout. This is not an issue. However, I have the default layout broken into several elements. Some of these elements require getting data from a database. I checked other threads here, as well as cakephp.org, but maybe I was searching for the wrong things (I apologize if this is in another thread somewhere - point me in the right direction if so). I am not confident that my solution was the best way to achieve the task at hand. Here is how I got it to work: 1. I copied pages_controller.php and placed it into my controllers folder. 2. I created 2 functions to retrieve featured links and shows ('Link' and 'Show' models) in app_controller (as they need to be available on all pages). 3. I used beforeRender in my app_controller to set the variables I needed (and limited in SQL). 4. In my default.ctp, I rendered the element with $this- >renderElement('shows', array('layoutShows, $layoutShows). $layoutShows was the variable I set in my app_controller beforeRender (the other is $layoutLinks). 5. I had to edit one line in the pages_controller that I placed in the controllers directory, and this was the $uses. I had to add 'Link' and 'Show' into the array. pages_controller extends app_controller, but in the child class (pages_controller) it sets $uses = null, which would effectively wipe out what I set in the app_controller. Some have said use a component, but I don't feel this is the best option as a component should be used to alter data in the controller that was retrieved from a model - not work (or query) a model directly. Would this be the best route to achieve the task at hand when dealing with several static pages - and the rest which have controllers/ models? Thanks in advance for any help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Email Component and UTF8 Subject
Cake 1.2 has a new email component, I believe that is what he is referring to. On Mar 2, 10:44 am, "bernardo" <[EMAIL PROTECTED]> wrote: > What component? > The one that uses the phpmailer library handles encoding of the > headers fine. > Also note that by calling utf8_decode you are converting your subject > to iso8859-1, so not only would you lose the characters that cannot be > converted but you would still need to appropriately encode the > header! > > On Mar 2, 10:46 am, "Alex" <[EMAIL PROTECTED]> wrote: > > > Maybe I'm wrong but I think the Email Component doesn't handle UTF8 > > subjects correctly. I have to wrap a utf8_decode() around my subject > > to send it correctly. > > Maybe the setting $this->Email->charset = 'utf-8' only impacts the > > text to be send? > > > Greetings from Brasil, > > Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Custom tags.php not working in 1.2
I am now having the same issue in 1.2 trying to create custom tags. The previous loadConfig file used to parse an ini file. Now, it looks to be including a tags.php file. Is it now looking for a tags array or still an ini format? Also, does it need to be manually loaded in custom helpers? On Feb 7, 12:07 pm, "Pepepaco" <[EMAIL PROTECTED]> wrote: > Using latest CakePHP 1.2.0.4451alpha, I have find that mycustomtags > in /app/config/tags.php are not used anymore. > > Looking at the Cake sources, thistags.php file is loaded in function > loadConfig() from cake/libs/view/helper.php; but there is no code > calling this function, except for the Text helper (cake/libs/view/ > helpers/text.php). In Cake 1.1.x, loadConfig() is called from cake/ > libs/view/view.php before loading helpers. > > Anybody knows if there is a new way of definingcustomtagsin Cake > 1.2? Or if this just a bug? Maybe I should create a new ticket? > > Thanks everybody! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Question about $this->redirect()
In 1.1 you were required to call exit() after your redirect. This was not a problem, but looking at the API for 1.2 - you can specify the exit call within the function: function redirect($url, $status = null, $exit = false) I also like that you can specify a status code as well. However, I have a question about how it works with the status code. For instance, I have my controller calling: $this->redirect('http://www.domain.com','301',true); Now, I would assume that this would redirect to the domain with a 301 moved permanently (and call exit itself). However, when I telnet the URL that calls the redirect, my 301 status code is nowhere to be found. I get: HTTP/1.1 302 Found Date: Fri, 16 Feb 2007 20:53:34 GMT Server: Apache Set-Cookie: BPI=2f639fea6334d665798f12a336b1f9cd; path=/ P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Location: http://www.domain.com Content-Type: text/html; charset=utf-8 It shows 302 as the code - is there something I am missing to get this to work properly? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using acl.php to create the database with shared domains
Nevermind, I figured it out. I just edited the $app to point to '/ home/domains/www.domain.com' and it worked. On Feb 16, 3:03 pm, "nateklaiber" <[EMAIL PROTECTED]> wrote: > My setup is a little different from the default setup for cake (1.2 > nightly). > > I have the core cake library shared among several other domains. The > structure looks like: > > /home/core/cake > /home/domains/www.domain1.com/webroot > /home/domains/www.domain2.com/webroot > > The core holds files/aliases I need for stats/dbadmin/scripts - along > with the Cake core folder. > > Now, I would like to implement ACL, but running 'php acl.php initdb' > will throw errors because it can't find the proper files with the > changed directory structure. Should I backup the original and then > edit the script to fit my needs per domain, or should I just use the > SQL and create the tables/permissions myself? > > When running acl.php I get the following error: > > Warning: require(/home/domains/core//app/config/core.php): failed to > open stream...on line 94 > > Any thoughts or ideas? Anyone done this in any other projects? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Using acl.php to create the database with shared domains
My setup is a little different from the default setup for cake (1.2 nightly). I have the core cake library shared among several other domains. The structure looks like: /home/core/cake /home/domains/www.domain1.com/webroot /home/domains/www.domain2.com/webroot The core holds files/aliases I need for stats/dbadmin/scripts - along with the Cake core folder. Now, I would like to implement ACL, but running 'php acl.php initdb' will throw errors because it can't find the proper files with the changed directory structure. Should I backup the original and then edit the script to fit my needs per domain, or should I just use the SQL and create the tables/permissions myself? When running acl.php I get the following error: Warning: require(/home/domains/core//app/config/core.php): failed to open stream...on line 94 Any thoughts or ideas? Anyone done this in any other projects? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Navigation Component / Helper
Definitely us an Element. I recently did a project and had the same thing. Several shared navigation elements that I needed in all of my layouts. I created a default layout - and then used renderElement to render them in the layouts/views. I think this is exactly what you are looking for. Email me if you need any help or have other questions... On Feb 14, 9:22 am, "Peter" <[EMAIL PROTECTED]> wrote: > Hi there, > > I'm totally new to CakePHP and I am struggling to get my head around > how to do shared navigation across a site. Basically, every page will > use the same unordered list navigation on the left-hand side. > Regardless of the page controller, I need to have this navigation on > all pages. The function that will create the navigation will take in a > variable that denotes the current section (so it can be marked as > 'active'). > > Having looked through the CakePHP manual and taken a look at some of > the posts here, I can see that some people have created a navigation > component, and some a navigation helper. I decided to take a shot at > creating a Navigation Component, but accessing the database directly > from the component seems to be a bit of a problem, so I thought I > might be going about this the wrong way. > > Would anyone be able to point me in the right direction on how to do > this? > > Thanks for reading! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What editor do you use for CakePHP?
Textmate for the editor and Transmit for the FTP client (OS X). It's a great combination, and very flexible with code bundles. On Feb 12, 9:59 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > phpeclipse > > On Feb 12, 1:41 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > Top stuff. Thanks to you and nate > > > On Feb 12, 11:43 pm, "wedge" <[EMAIL PROTECTED]> wrote: > > > > I'm usingDreamweaver8 too. > > > > And there's a way to make .thtmlfiles editable like .php files. Found > > > the text here, forgot to note the author. > > > > - > > > > Just a couple of tips for developers who prefer to develop their page > > > layouts inDreamweaveror work with graphics people who useDreamweaver. > > > These are for DW 8. > > > > 1. Makethtmlfiles editable in the design view > > > > - Find the Extensions.txt file inDreamweaver's"Configuration" folder > > > and edit the line > > > > PHP,PHP3,PHP4,PHP5,TPL:PHP Files > > > > to read > > > > PHP,PHP3,PHP4,PHP5,TPL,THTML:PHP Files > > > > - Find the MMDocumentTypes.xml file in the "DocumentTypes" (this is in > > > the "Configuration" folder) and change the line > > > > > > internaltype="Dynamic" winfileextension="php,php3,php4,php5" > > > macfileextension="php,php3,php4,php5" file="Default.php" > > > writebyteordermark="false"> > > > > to read > > > > > > internaltype="Dynamic" winfileextension="php,php3,php4,php5,thtml" > > > macfileextension="php,php3,php4,php5,thtml" file="Default.php" > > > writebyteordermark="false"> > > > > 2. Use the "Design Time Style Sheet" to allow you to viewthtmlfiles > > > with the appropriate css style applied. > > > > - Open up thethtmlfile you wish to edit then from the main menu > > > select Text > CSS Styles > Design-time . Select the "+" above the > > > "Show only at design time" box and select the cake.default.css file > > > from the "webroot/css" folder. > > > > -- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: tags.ini.php
I believe its been moved to the helper class - but you can still specify custom tags with a tags.ini.php file. I just did this last week with cake 1.2. On Feb 10, 10:15 pm, "NeilKelty" <[EMAIL PROTECTED]> wrote: > I cannot find this file in the builds/nor my current installation - > I've plowed through the documentations looking for any mentions. Has > this file been eliminated or consolidated? > > Thanks in advance, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to validate a custom form?
I think it is clear. Validation rules are setup in the model. BUT - what if he was making a contact form that never wrote to the database (or even used a model) - but still needed to be validated before the email was sent? I think that is what he is saying - being able to have validation rules outside of using a model. Maybe making your validation checks manually and then marking them as invalid with invalidate(). However, validation seems to be tied into the model (even to the save function). However, not all validation needs to be saved to a database - there could be other needs (write to file, email, etc). I think that is what he is askingam I correct? On Feb 7, 5:00 am, "Steniskis" <[EMAIL PROTECTED]> wrote: > Hi Tazz, > Your question is not clear... > Steniskis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---