Re: Connecting to a remote database via SSH
Thanks - I will give this a go. Jeremy Burns Class Outfit jeremybu...@classoutfit.com (t) +44 (0) 208 123 3822 (m) +44 (0) 7973 481949 Skype: jeremy_burns http://www.classoutfit.com On 26 Jan 2011, at 07:41, Zaky Katalan-Ezra wrote: edit /etc/ssh/sshd_config on your local machine Add: AllowTcpForwarding yes GatewayPorts yes restart sshd Edit my.cnf on remote machine. Uncomment the following line. bind-address = 127.0.0.1 restart mysql On you local machine run the following command ssh -i e-keypair -f remoteu...@remote.com -N -L :localhost:3306 If you are not using ssh key you will be prompt for remote user assword Edit database.php var $default = array( 'driver' = 'mysqli', 'persistent' = false, 'host' = '127.0.0.1', 'port'=, 'login' = 'user', 'password' = 'pass', 'database' = 'schema', 'prefix' = '', On Wed, Jan 26, 2011 at 8:24 AM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: I don't think I am explaining myself clearly. I am connecting to the database fine (using Sequel Pro). That is not my problem. I want to get my local instance of a CakePHP application to connect to a remote database via SSH, so need to have the right configuration in database.php. That's where I need the guidance. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 26 Jan 2011, at 06:20, Zaky Katalan-Ezra wrote: 1. You need port 22 and 3306 to be open on the remote server 2. Install mysql workbench 3. In the new connection form set the connection method to tcp over ssh. 4. If you are using terminal and not GUI use ssh tunnel. And you may find more info here: http://forums.mysql.com/read.php?30,249779,249779 On Wed, Jan 26, 2011 at 7:21 AM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: Thanks - I was hoping that someone could suggest a database.php setting that would make the connection. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 26 Jan 2011, at 05:01, bdwilton wrote: Not sure if this is exactly what you had in mind, but... If you have a local work server with a local router which you can open up a port on you can use a SSH tunnel on your local work server to forward that port to a remote VPN or remote server which has its ports locked down but accessible to your IP. This opens up the port through your router to be accessed externally but through SSH to the remote server. Just look up SSH Tunnel. Brett Wilton http://wiltonsoftware.com On 26/01/2011 8:32 a.m., Jeremy Burns wrote: Does anyone have any ideas for how to connect to a remote database via SSH? It's a development thing so that people working remotely can develop against the same database hosted on our virtual server. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Regards, Zaky Katalan-Ezra QA Administrator www.IGeneriX.com Sites.IGeneriX.com 054-7762312 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Regards, Zaky
Re: DEBUG=2: My error500 shows; DEBUG=0: I get not found. --psybear
Thanks for your reply, Steve. I have created app/app_controller.php with the following content: ?php class AppError extends ErrorHandler { function error500($params) { header('HTTP/1.1 500 Internal Server Error'); $this-_outputMessage('error500'); } } ? But it still doesn't work, although the AppError handler is taken into account: when placing a die(hello); into the error500() method, then having DEBUG set to 2 displays hello, but DEBUG set to 0 displays the old Not found error message... What am I missing? On Tue, Jan 25, 2011 at 5:50 PM, Steve step...@foundfamily.co.uk wrote: I think you need to provide a appError class. The default code turns off the error routing when you disable DEBUG ( set it to 0 ) so it looks for a URL which your server is correctly reporting the absence of. http://book.cakephp.org/view/154/Error-Handling On Tue, 2011-01-25 at 08:21 -0800, psybear83 wrote: Hey everybody When having DEBUG set to 2 (or 1), my sweet little error500 is shown correctly. SomeController extends AppController { function _error500() { $this-cakeError('error500'); exit; } } But when it's set to 0, then I'm just getting a plain Error: The requested address 'xxx' was not found on this server. Any idea what's going (wr)on(g)? Please give me a hint - as soon as this is working my website is ready for being released in beta- testing. :-) Thanks Josh -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How would one set up this model association?
Hi I have three tables all linked to one lookup table like so: +- + | AUXProductOption | + +--- + | id | productOptionName| + +--- + | 1 | Death, Total and Permanent Disability, Tempor| | 5 | total, 540 | | 6 | test fixed amount | + +--- + +- + | AUXProductOptionFields| + +--- + | id| name | + +--- + | 1 | Test Field| + +--- + +- + | AUXProductOptionFieldValue | + +--- + | id| value | + +--- + | 1 | 1001 | | 2 | This is rover calling back huston | + +--- + +--- + | AUXProductOption_has_AUXProductOptionFields | +--- + | AUXProductOption_id | AUXProductOptionFields_id | AUXProductOptionFieldValue_id | + +- +---+ | 1| 1| 1 | | 1| 1| 2 | | 5| 1| 2 | | 6| 1| 1 | +--- +-- +---+ my models look like so : [CODE] class AUXProductOption extends AppModel { var $name = 'AUXProductOption'; var $useTable = 'AUXProductOption'; var $displayField = 'productOptionName'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $hasAndBelongsToMany = array( 'AUXProductOptionField' = array( 'className' = 'AUXProductOptionField', 'joinTable' = 'AUXProductOption_has_AUXProductOptionFields', 'foreignKey' = 'AUXProductOptionFields_id', 'associationForeignKey' = 'AUXProductOption_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ), 'AUXProductOptionFieldValue' = array( 'className' = 'AUXProductOptionFieldValue', 'joinTable' = 'AUXProductOption_has_AUXProductOptionFields', 'foreignKey' = 'AUXProductOptionFieldValue_id', 'associationForeignKey' = 'AUXProductOption_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) ); } class AUXProductOptionField extends AppModel { var $name = 'AUXProductOptionField'; var $useTable = 'AUXProductOptionFields'; var $displayField = 'name'; var $hasAndBelongsToMany = array( 'AUXProductOptionFieldValue' = array(
Re: How would one set up this model association?
OK forget that here's a picture http://i29.photobucket.com/albums/c297/Chillwabbitt/junk/Screenshot.png -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Select Box - Table or Tinyint?
Hi euromark Adding it to the bottom works fine for me, I like the system and it does a good job. I'll use this with most of my future apps until CakePHP starts supporting ENUM -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Complex Search
Unfortunately using Containable did not work as I would have hoped. 1. I could not get containable to do an inner join on the data. This is because the actual relationships between the Book, Category and Author tables are many-to-many so it performs a search on the books then a search on the authors of those filtered books whereas I want the books that contain the text and any books whose author names contain the text. In my overridden paginate function, I break the many-to-many relationship, make it a one-to-many and tell it to do an inner join, giving me the data that I want. In the long run this 'sledgehammer' approach is probably more efficient as I am doing what I want in two calls rather than coercing Containable to behave as I want it to through some contrived array settings in my controller. 2. The paginateCount does not use fields it seems that it does a 'select count(*) as count' so my usage of DISTINCT in the selection ( because a book can be in more than one category so could be duplicated ) is lost making the paginateCount return a different value than the number of records returned by the select. On Tue, 2011-01-25 at 14:35 -0500, cricket wrote: On Tue, Jan 25, 2011 at 9:00 AM, Steve step...@foundfamily.co.uk wrote: I have solved this by overriding the paginate and paginateCount methods in my Book model. Instead of that, you could use Containable. And you don't need to have the else block in the index action. Declare $paginate as a class var, then add the 'conditions' array when required. public $paginate = array( 'limit' = 12, 'order' = array('Book.created' = 'desc'), 'contain' = array('Author') ); function index() { $this-Book-recursive = 1; if ($this-search) { $this-paginate['conditions'] = $this-Book-searchConditions($this-search)); } $this-set('books', $this-paginate('Book')); } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Time Helper - International Support
Hello People, I wonder if it is possible to set up the Time Helper for International Support. On my system the strftime recognize that the System is set to German Date ouput format. But when I use the $this-Time-nice(time()); function I see the english format. Does anyone know why? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
My Contract model test asks for User fixtures and I have no idea why --psybear
Hey everybody I have a model Beneficiary and a model Contract. class Beneficiary extends Model { var $name = 'Beneficiary'; var $hasMany = array( 'Contract' ); } class Contract extends Model { var $name = 'Contract'; var $displayField = 'number'; var $belongsTo = array( 'Beneficiary' ); } I want to test the Beneficiary with the following unit test: class BeneficiaryTestCase extends CakeTestCase { var $fixtures = array('app.beneficiary'); function startTest() { $this-Beneficiary = ClassRegistry::init('Beneficiary'); } function endTest() { unset($this-Beneficiary); ClassRegistry::flush(); } function testSanity() { $this-assertTrue(1 == 1); } } But when I run it, I'm getting the error message Error: Database table users for model User was not found., and I have no idea why. When I remove the hasMany:Contract relationship, then it doesn't complain. But Contract doesn't have anything to do with User! I tracked the problem further to ClassRegistry::init(). When I echo what is passed to init() as $class, then after some echos it echos User! But I couldn't track it down deeper, it's too complicated for me... Anyone has an idea where this User could slip into my code?? I could also just add the User fixture to the test case, but that wouldn't be clean... Thanks really a lot for help, I just don't seem able to do it on my own. Josh -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Complex Search
Hi Steve, Sounds like you need to use the 'joins' param in a find and skip containable, here's the manual page http://book.cakephp.org/view/872/Joining-tables hth Jon On 26 January 2011 10:37, Steve step...@foundfamily.co.uk wrote: Unfortunately using Containable did not work as I would have hoped. 1. I could not get containable to do an inner join on the data. This is because the actual relationships between the Book, Category and Author tables are many-to-many so it performs a search on the books then a search on the authors of those filtered books whereas I want the books that contain the text and any books whose author names contain the text. In my overridden paginate function, I break the many-to-many relationship, make it a one-to-many and tell it to do an inner join, giving me the data that I want. In the long run this 'sledgehammer' approach is probably more efficient as I am doing what I want in two calls rather than coercing Containable to behave as I want it to through some contrived array settings in my controller. 2. The paginateCount does not use fields it seems that it does a 'select count(*) as count' so my usage of DISTINCT in the selection ( because a book can be in more than one category so could be duplicated ) is lost making the paginateCount return a different value than the number of records returned by the select. On Tue, 2011-01-25 at 14:35 -0500, cricket wrote: On Tue, Jan 25, 2011 at 9:00 AM, Steve step...@foundfamily.co.uk wrote: I have solved this by overriding the paginate and paginateCount methods in my Book model. Instead of that, you could use Containable. And you don't need to have the else block in the index action. Declare $paginate as a class var, then add the 'conditions' array when required. public $paginate = array( 'limit' = 12, 'order' = array('Book.created' = 'desc'), 'contain' = array('Author') ); function index() { $this-Book-recursive = 1; if ($this-search) { $this-paginate['conditions'] = $this-Book-searchConditions($this-search)); } $this-set('books', $this-paginate('Book')); } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- jon bennett - www.jben.net - blog.jben.net -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Need advice for custom ACL
Hello. in my app i need to (some examples): - ignore some validation rules if the user has authorization X - hide or modify some form fields if user hasn't authorization Y - do the usual ACL things (if you're a Customer you can't modify users and so on) not all of those authorizations are referred to a specific controller's action so cake's built-in ACL isn't very useful. in your opinion, what's the best way to implement this? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
David Persson Media Plugin - regenerate image versions
Hi there, I have very successfully got the Media/Attachments plugin working on my new site, and I'm really impressed, but have run into a slight problem... The site is a rebuild of an existing site and has around 2000 images attached to news stories (the app folder weighs in at around 900mb!), now I have copied the images into the 'filter' 'img' directory and manually resized them as per the config settings for the plugin and do some mysql kung fu to import them into the database table. However, this is fine locally, but it's going to be a RIGHT nightmare to upload and none of the images have checksum etc. What I would like to be able to is some kind of batch add/resize for all the images if they are in the 'transfer' directory once it's on the server, maybe a is the requested image in the transfer directory and not the filter directory? If now, run the resizing process... So the resizing is done when the news story is first viewed... Does this seem doable? TIA, d. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Need advice for custom ACL
hi, in my app i need to (some examples): - ignore some validation rules if the user has authorization X - hide or modify some form fields if user hasn't authorization Y - do the usual ACL things (if you're a Customer you can't modify users and so on) not all of those authorizations are referred to a specific controller's action so cake's built-in ACL isn't very useful. in your opinion, what's the best way to implement this? Not tried this, but could you: 1. Have multiple views per auth type, stops you needing to hide/show form fields 2. Have multiple Models that connect to the same table, each with a different set of validation rules 3. Use the correct model above in your controller and views ... which would mean your ACL logic stays in the controller. Might work, Cheers, Jon -- jon bennett - www.jben.net - blog.jben.net -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Reverse routing - not using the intended rule
For some reason (which I don't necessarily understand, since there is horizontal space), the lines were wrapped. Here's another attempt at pasting the rules: Router::connect('/lolot', array('controller' = 'pages', 'action' = 'index', 'admin' = true)); Router::connect('/pages/menu_threaded', array('controller' = 'pages', 'action' = 'menu_threaded')); Router::connect('/products/display_by_category', array('controller' = 'products', 'action' = 'display_by_category')); Router::connect('/products/display_by_brand', array('controller' = 'products', 'action' = 'display_by_brand')); Router::connect('/produse', array('controller' = 'categories', 'action' = 'index')); Router::connect('/produse/*', array('controller' = 'categories', 'action' = 'view')); Router::connect('/produs/:brand--:product', array('controller' = 'products', 'action' = 'view'), array('pass' = array('brand', 'product'), 'brand' = '[a-zA-Z0-9\-\.]+', 'product' = '[a-zA-Z0-9\-\.] +')); Router::connect('/marci', array('controller' = 'brands', 'action' = 'index')); Router::connect('/marci/*', array('controller' = 'brands', 'action' = 'view')); //Router::connect('/(?!lolot|users|pages|products|produse|produse| marci)(.*)', // array('controller' = 'pages', 'action' = 'view')); //Router::connect('/*', // array('controller' = 'pages', 'action' = 'view')); Router::connect('/:page', array('controller' = 'pages', 'action' = 'view'), array('pass' = array('page'), 'page' = '[a-zA-Z0-9\-\.]+')); Router::connect('/', array('controller' = 'pages', 'action' = 'home')); If I insert the link the correct way: $this-Html-link('Page Title', array('controller' = 'pages', 'action' = 'view', 'page- slug')); I get site.com/pages/view/page-slug If I hardcode it: $this-Html-link('Page Title', '/page-slug/')); I get site.com/page-slug (the intended result). However, both addresses resolve to the correct controller / method / page-slug and the page is displayed. Thanks in advance for any help :) On Jan 25, 11:21 pm, cricket zijn.digi...@gmail.com wrote: On Tue, Jan 25, 2011 at 9:23 AM, r4zv4n razvanbra...@gmail.com wrote: Hello, I'm on CakePHP 1.3 stable and have a routing problem for which I haven't been able to figure a solution out (read through the docs, googled for it, searched the group). What I'm trying to achieve is have all pages referred to as site.com/ page-slug - except for some cases (such as product categories, products, etc.). The problem is that reverse routing uses the site.com/ pages/view/page-slug instead. The current rules I have are: Router::connect('/lolot', array('controller' = 'pages', 'action' = 'index', 'admin' = true)); Router::connect('/pages/menu_threaded', array('controller' = 'pages', 'action' = 'menu_threaded')); Router::connect('/products/display_by_category', array('controller' = 'products', 'action' = 'display_by_category')); Router::connect('/products/display_by_brand', array('controller' = 'products', 'action' = 'display_by_brand')); Router::connect('/produse', array('controller' = 'categories', 'action' = 'index')); Router::connect('/produse/*', array('controller' = 'categories', 'action' = 'view')); Router::connect('/produs/:brand--:product', array('controller' = 'products', 'action' = 'view'), array('pass' = array('brand', 'product'), 'brand' = '[a-zA-Z0-9\-\.]+', 'product' = '[a-zA-Z0-9\- \.]+')); Router::connect('/marci', array('controller' = 'brands', 'action' = 'index')); Router::connect('/marci/*', array('controller' = 'brands', 'action' = 'view')); //Router::connect('/(?!lolot|users|pages|products|produse|produse| marci)(.*)', array('controller' = 'pages', 'action' = 'view')); //Router::connect('/*', array('controller' = 'pages', 'action' = 'view')); Router::connect('/:page', array('controller' = 'pages', 'action' = 'view'), array('pass' = array('page'), 'page' = '[a-zA-Z0-9\-\.] +')); Router::connect('/', array('controller' = 'pages', 'action' = 'home')); (also notice my commented other attepmts that don't work) This works, in the way that I can access a page through site.com/page- slug as well as site.com/pages/view/page-slug - but when I insert a link using $html-link() and specify the controller action, the result is site.com/pages/view/page-slug instead of site.com/page-slug What am I doing wrong? What should I actually do? It might be a good start to make that a bit more legible. And there's not much else to say without seeing an example of how you're using $html-link(). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at
Re: Reverse routing - not using the intended rule
And here's a pastebin of the code, since it was wrapped again: http://pastebin.com/mnLdzxBt On Jan 26, 4:22 pm, r4zv4n razvanbra...@gmail.com wrote: For some reason (which I don't necessarily understand, since there is horizontal space), the lines were wrapped. Here's another attempt at pasting the rules: Router::connect('/lolot', array('controller' = 'pages', 'action' = 'index', 'admin' = true)); Router::connect('/pages/menu_threaded', array('controller' = 'pages', 'action' = 'menu_threaded')); Router::connect('/products/display_by_category', array('controller' = 'products', 'action' = 'display_by_category')); Router::connect('/products/display_by_brand', array('controller' = 'products', 'action' = 'display_by_brand')); Router::connect('/produse', array('controller' = 'categories', 'action' = 'index')); Router::connect('/produse/*', array('controller' = 'categories', 'action' = 'view')); Router::connect('/produs/:brand--:product', array('controller' = 'products', 'action' = 'view'), array('pass' = array('brand', 'product'), 'brand' = '[a-zA-Z0-9\-\.]+', 'product' = '[a-zA-Z0-9\-\.] +')); Router::connect('/marci', array('controller' = 'brands', 'action' = 'index')); Router::connect('/marci/*', array('controller' = 'brands', 'action' = 'view')); //Router::connect('/(?!lolot|users|pages|products|produse|produse| marci)(.*)', // array('controller' = 'pages', 'action' = 'view')); //Router::connect('/*', // array('controller' = 'pages', 'action' = 'view')); Router::connect('/:page', array('controller' = 'pages', 'action' = 'view'), array('pass' = array('page'), 'page' = '[a-zA-Z0-9\-\.]+')); Router::connect('/', array('controller' = 'pages', 'action' = 'home')); If I insert the link the correct way: $this-Html-link('Page Title', array('controller' = 'pages', 'action' = 'view', 'page- slug')); I get site.com/pages/view/page-slug If I hardcode it: $this-Html-link('Page Title', '/page-slug/')); I get site.com/page-slug (theintendedresult). However, both addresses resolve to the correct controller / method / page-slug and the page is displayed. Thanks in advance for any help :) On Jan 25, 11:21 pm, cricket zijn.digi...@gmail.com wrote: On Tue, Jan 25, 2011 at 9:23 AM, r4zv4n razvanbra...@gmail.com wrote: Hello, I'm on CakePHP 1.3 stable and have aroutingproblem for which I haven't been able to figure a solution out (read through the docs, googled for it, searched the group). What I'm trying to achieve is have all pages referred to as site.com/ page-slug - except for some cases (such as product categories, products, etc.). The problem is thatreverseroutinguses the site.com/ pages/view/page-slug instead. The current rules I have are: Router::connect('/lolot', array('controller' = 'pages', 'action' = 'index', 'admin' = true)); Router::connect('/pages/menu_threaded', array('controller' = 'pages', 'action' = 'menu_threaded')); Router::connect('/products/display_by_category', array('controller' = 'products', 'action' = 'display_by_category')); Router::connect('/products/display_by_brand', array('controller' = 'products', 'action' = 'display_by_brand')); Router::connect('/produse', array('controller' = 'categories', 'action' = 'index')); Router::connect('/produse/*', array('controller' = 'categories', 'action' = 'view')); Router::connect('/produs/:brand--:product', array('controller' = 'products', 'action' = 'view'), array('pass' = array('brand', 'product'), 'brand' = '[a-zA-Z0-9\-\.]+', 'product' = '[a-zA-Z0-9\- \.]+')); Router::connect('/marci', array('controller' = 'brands', 'action' = 'index')); Router::connect('/marci/*', array('controller' = 'brands', 'action' = 'view')); //Router::connect('/(?!lolot|users|pages|products|produse|produse| marci)(.*)', array('controller' = 'pages', 'action' = 'view')); //Router::connect('/*', array('controller' = 'pages', 'action' = 'view')); Router::connect('/:page', array('controller' = 'pages', 'action' = 'view'), array('pass' = array('page'), 'page' = '[a-zA-Z0-9\-\.] +')); Router::connect('/', array('controller' = 'pages', 'action' = 'home')); (also notice my commented other attepmts that don't work) This works, in the way that I can access a page through site.com/page- slug as well as site.com/pages/view/page-slug - but when I insert a linkusing$html-link() and specify the controller action, the result is site.com/pages/view/page-slug instead of site.com/page-slug What am I doing wrong? What should I actually do? It might be a good start to make that a bit more legible. And there's notmuch else to say without seeing an example of how you'reusing $html-link(). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new
How to get relative theme path?
How are you, everyone. I tried to get relative theme path and googled to find following code: ?php echo App::themePath('my_theme'); ? But this code returns physical full path of the theme, not relative one. How can I get the relative path of the theme? Kind regards. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to get relative theme path?
you can do this... i think that is that what you want {{{ $themePath = str_replace(VIEWS, '', App::themePath('my_theme')); print $themePath //it will print themed/my_theme/ }}} -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/1/26 raymond raymond...@gmail.com How are you, everyone. I tried to get relative theme path and googled to find following code: ?php echo App::themePath('my_theme'); ? But this code returns physical full path of the theme, not relative one. How can I get the relative path of the theme? Kind regards. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Comment boxes
On Jan 25, 2011, at 07:03, Nwb mkenya wrote: I am amazed by how comment boxes work.Am making a web site using php and would like visitors to live a comment.How do i store this comments into the database Mysql and retreive them so that i can know the number of comments left by the visitors.Any assistance? Sounds like a pretty basic question. What have you tried so far? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Need advice for custom ACL
HiJohn thx for your response acting that way will bloat my app i have hundreds of possible combinations :\ On 26 Gen, 15:05, Jon Bennett jmbenn...@gmail.com wrote: hi, in my app i need to (some examples): - ignore some validation rules if the user has authorization X - hide or modify some form fields if user hasn't authorization Y - do the usual ACL things (if you're a Customer you can't modify users and so on) not all of those authorizations are referred to a specific controller's action so cake's built-in ACL isn't very useful. in your opinion, what's the best way to implement this? Not tried this, but could you: 1. Have multiple views per auth type, stops you needing to hide/show form fields 2. Have multiple Models that connect to the same table, each with a different set of validation rules 3. Use the correct model above in your controller and views ... which would mean your ACL logic stays in the controller. Might work, Cheers, Jon -- jon bennett -www.jben.net- blog.jben.net -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Need advice for custom ACL
HiJohn thx for your response acting that way will bloat my app i have hundreds of possible combinations :\ Not sure what else to suggest, interested to hear if/how you solve it! -- jon bennett - www.jben.net - blog.jben.net -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Need advice for custom ACL
not all of those authorizations are referred to a specific controller's action so cake's built-in ACL isn't very useful. Then what they refer to? It looks like you need to create an engine to create your views on the fly. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to get relative theme path?
Thanks for your fast reply, Tilen. But it just print themed/my_theme/. If my app is located on http://localhost/myprj then I want to get a path like myprj/themed/my_theme/ Any suggestion? Regards, Raymond. $themePath = str_replace(VIEWS, '', App::themePath('my_theme')); print $themePath //it will print themed/my_theme/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Cakephp 1.3 and Firebird
Hi Can you tell me where I can find dbo_firebird.php for Cake 1.3. The driver is mentioned in config/database.php, but the file isn't in the distribution. I've seen a ticket or group post that mentions a contrib package, but I can't find the message nor this package. Thanks Christian -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Join Tables between db
On 1/26/2011 3:08 AM, Dave Maharaj wrote: I have a site with 2 databases (same server) 1.Being resources_db (data that never changes, Country, States, various selects and options to select from throughout the site) 2.default_db users, profiles, things that can be changed, edited by users. Now join tables happen to cross between resources_db and default_db where does the join tables go in these situations? How do you tell Cake where to look? Hi Dave, I use something similar in one of my apps. Here are some snippets from my code, slightly adapted to your example. app/config/database.php class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'host', 'login' = 'user', 'password' = 'pass', 'database' = 'default_db', 'prefix' = '', ); var $resource = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'host', 'login' = 'user', 'password' = 'pass', 'database' = 'resources_db', 'prefix' = '', ); } app/models/user.php class User extends AppModel { .. public $belongsTo = array( 'Country' = array( 'className' = 'Country', 'foreignKey' = 'country_id', ), ); } app/models/country.php class Country extends AppModel { public $useDbConfig = 'resource'; public $hasMany = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'country_id', ) ); } With this setup I can do something like: $this-User-find('random', array('contain' = array('Country'), 'limit' = 10)); HTH -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cakephp 1.3 and Firebird
On 1/26/2011 11:43 PM, rc wrote: Hi Can you tell me where I can find dbo_firebird.php for Cake 1.3. The driver is mentioned in config/database.php, but the file isn't in the distribution. https://github.com/cakephp/datasources/blob/master/models/datasources/dbo/dbo_firebird.php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
RE: Join Tables between db
Yeah I have all that setup and everything works except telling Cake where to look for the table. It never finds the table in my default config for that 1 model. If I move the tables to resources DB (where I do not want it) it works. Move it to default_db and tell the model to look in default $useDBconfig I get missing table. So just a little stumped. From: Alex Ciobanu [mailto:ics.cake...@gmail.com] Sent: Wednesday, January 26, 2011 10:41 PM To: cake-php@googlegroups.com Subject: Re: Join Tables between db On 1/26/2011 3:08 AM, Dave Maharaj wrote: I have a site with 2 databases (same server) Being resources_db (data that never changes, Country, States, various selects and options to select from throughout the site) default_db users, profiles, things that can be changed, edited by users. Now join tables happen to cross between resources_db and default_db where does the join tables go in these situations? How do you tell Cake where to look? Hi Dave, I use something similar in one of my apps. Here are some snippets from my code, slightly adapted to your example. app/config/database.php class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'host', 'login' = 'user', 'password' = 'pass', 'database' = 'default_db', 'prefix' = '', ); var $resource = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'host', 'login' = 'user', 'password' = 'pass', 'database' = 'resources_db', 'prefix' = '', ); } app/models/user.php class User extends AppModel { .. public $belongsTo = array( 'Country' = array( 'className' = 'Country', 'foreignKey' = 'country_id', ), ); } app/models/country.php class Country extends AppModel { public $useDbConfig = 'resource'; public $hasMany = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'country_id', ) ); } With this setup I can do something like: $this-User-find('random', array('contain' = array('Country'), 'limit' = 10)); HTH -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
need help in javascript dropdown,
hi, good morning, i m working on project where i want create two drop down, in first i will choose state so that the next drop down should how the cities with respect to the state selected in first. all that i want to create in javascript, for that i have collected all state_code and its cities in variable. the variable name is given in following way var (state_code)_list = (citilist) i ave collected the sate and cities in one variable, please some suggest me the steps to be fallowed so that i can work on it. i m fresher in javascript. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cake 2 : Any sort of automatic schema creation from models?
On Jan 26, 2011, at 00:48, maxarbos wrote: So would the model be automatically be built with the correct properties and types by telling it which table to read from? That's what cake bake is all about, isn't it? Have you tried it? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Connecting to a remote database via SSH
This worked perfectly - thanks Zaky. Jeremy Burns Class Outfit jeremybu...@classoutfit.com (t) +44 (0) 208 123 3822 (m) +44 (0) 7973 481949 Skype: jeremy_burns http://www.classoutfit.com On 26 Jan 2011, at 07:41, Zaky Katalan-Ezra wrote: edit /etc/ssh/sshd_config on your local machine Add: AllowTcpForwarding yes GatewayPorts yes restart sshd Edit my.cnf on remote machine. Uncomment the following line. bind-address = 127.0.0.1 restart mysql On you local machine run the following command ssh -i e-keypair -f remoteu...@remote.com -N -L :localhost:3306 If you are not using ssh key you will be prompt for remote user assword Edit database.php var $default = array( 'driver' = 'mysqli', 'persistent' = false, 'host' = '127.0.0.1', 'port'=, 'login' = 'user', 'password' = 'pass', 'database' = 'schema', 'prefix' = '', On Wed, Jan 26, 2011 at 8:24 AM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: I don't think I am explaining myself clearly. I am connecting to the database fine (using Sequel Pro). That is not my problem. I want to get my local instance of a CakePHP application to connect to a remote database via SSH, so need to have the right configuration in database.php. That's where I need the guidance. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 26 Jan 2011, at 06:20, Zaky Katalan-Ezra wrote: 1. You need port 22 and 3306 to be open on the remote server 2. Install mysql workbench 3. In the new connection form set the connection method to tcp over ssh. 4. If you are using terminal and not GUI use ssh tunnel. And you may find more info here: http://forums.mysql.com/read.php?30,249779,249779 On Wed, Jan 26, 2011 at 7:21 AM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: Thanks - I was hoping that someone could suggest a database.php setting that would make the connection. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 26 Jan 2011, at 05:01, bdwilton wrote: Not sure if this is exactly what you had in mind, but... If you have a local work server with a local router which you can open up a port on you can use a SSH tunnel on your local work server to forward that port to a remote VPN or remote server which has its ports locked down but accessible to your IP. This opens up the port through your router to be accessed externally but through SSH to the remote server. Just look up SSH Tunnel. Brett Wilton http://wiltonsoftware.com On 26/01/2011 8:32 a.m., Jeremy Burns wrote: Does anyone have any ideas for how to connect to a remote database via SSH? It's a development thing so that people working remotely can develop against the same database hosted on our virtual server. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Regards, Zaky Katalan-Ezra QA Administrator www.IGeneriX.com Sites.IGeneriX.com 054-7762312 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Regards, Zaky
Re: Need advice for custom ACL
They don't refer to anything particular. Look @ my example in first post On 26 Gen, 18:40, Zaky Katalan-Ezra procsh...@gmail.com wrote: not all of those authorizations are referred to a specific controller's action so cake's built-in ACL isn't very useful. Then what they refer to? It looks like you need to create an engine to create your views on the fly. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php