kohana-3

How To Extend Parameters on the URL in KohanaPHP?

删除回忆录丶 提交于 2019-12-25 04:02:03
问题 How do I pass extra parameters in the URL to KohanaPHP (version 3.1+) like so... http://example.com/blog/edit/4000/3200 ...where "blog" is the blog.php in the controllers folder, "edit" is a controller method, 4000 is parameter 1 which I can use for who wants to edit the record, and 3200 is parameter 2 which I can use for the record ID? I get the blog and edit parts. The problem is the 4000 and 3200. When I run that URL, I get an error: "404 - Unable to find a route match blog/edit/4000/3200"

Kohana 3.1 Controllers in Sub Folders within the Controller Folder

旧城冷巷雨未停 提交于 2019-12-25 03:55:52
问题 I need to create sub folders for my controllers for ease of managing and troubleshooting. I need to have controller/, controller/admin, controller/user/ kind of setup. I have tried creating the controller in controller/admin/createuser from http://mydomain/admin/createuser but that does not seem to work. Anyone with tips on this? Do I need custom routing? 回答1: You would need to set up a Route to catch /admin/ and look for an 'directory' called admin rather than a 'controller file' called

Kohana 3.3 ORM Validation - unique value not working when value is empty

≡放荡痞女 提交于 2019-12-25 02:14:33
问题 In a Model_Page class, extending the Kohana ORM class, I have this rules definition : public function rules() { return array( 'url' => array( array('Model_Page::unique_url', array($this)), ), ); } To simplify here, I will just return false from this function, so it should never validate when I try to save/update a page : public static function unique_url($page) { return false; } This works as expected, if the value for url is not NULL or not an empty string . But if I already have a page with

Controller in Kohana 3 does not appear to work, but has in the background

佐手、 提交于 2019-12-24 20:26:50
问题 My client is finding that when they hit delete nothing happens, but if they it it again they get the error that that 'id' doesn't exist anymore. I find that hard to believe because it's actually leaving the page and then being redirected back to the post. The link in the view: <h4>Current Logo Image <span class='del'> (<?= HTML::anchor("playlist/imgdelete/$playlist->id/$logo->type", 'delete'); ?>) </span></h4> The controller process: public function action_imgdelete($id, $type) { DB::delete(

How to Use Module Controllers in Kohana 3?

情到浓时终转凉″ 提交于 2019-12-24 17:28:45
问题 For the following application directory structure under / in Kohana 3: application classes controller controller1.php modules admin classes controller controller2.php And the urls be: /controller1 and /admin/controller2? I seem to be missing something though because I keep getting a 404 error with the /admin/controller. What am I doing incorrectly? The exact error is: HTTP_Exception_404 [ 404 ]: The requested URL admin/borrowers was not found on this server. And I don't have any custom routes

How can I test a CRON job with PHP?

老子叫甜甜 提交于 2019-12-24 17:16:06
问题 This is the first time I've ever used a CRON. I'm using it to parse external data that is automatically FTP'd to a subdirectory on our site. I have created a controller and model which handles the data. I can access the URL fine in my browser and it works (however I will be restricting this soon). My problem is, how can I test if it's working? I've added this to my controller for a quick and dirty log $file = 'test.txt'; $contents = ''; if (file_exists($file)) { $contents = file_get_contents(

Upgrade from Kohana 2 to latest 3.2 version

邮差的信 提交于 2019-12-24 07:17:39
问题 I have project written in 2009 and based on Kohana 2.3.4, this project is still active and time to time there is requirement to make fix/create whole new feature. Because Kohana 2 is no longer supported and whole application stack is quite deprecated I have investigated (few times :) possibilities how to upgrade from Kohana 2 to 3. I already know there has been quite a lot of changes and it isn't simple upgrade, it's more like rewrite of application. Does anybody have real experience with

Templates In Kohana 3.1

孤者浪人 提交于 2019-12-23 20:15:25
问题 I used them before several months. Then I switched to Fuel. Then I switched back to Kohana. Problem? I have forgot how to correctly use templates (with that I mean Controller_Template ). There was tutorials on Kohana's docs, but now links seem to be broken. Please remind me how to use them! 回答1: If you really want to use them, you have to extend Kohana_Template . Then you would set a public field '$template' to your view name, and then just do $this->template->foo = "foo" to set variables on

Tables not joining in Kohana 3.1 ORM

旧城冷巷雨未停 提交于 2019-12-23 13:00:54
问题 How do I get this to work? $stuff = ORM::factory('mytable') ->with('user') ->with('other_stuff') ->find_all(); I've got all of my relationships set up and everything seems to be working when I do other queries. However, in the query above it is not joining table users to mytable . I think it may be because there can be many users for one mytable. In the reference there is a method called join() which I think I might need to use here, but they don't give any information on it, and the stuff I

Installing Kohana on OpenShift?

怎甘沉沦 提交于 2019-12-23 03:24:07
问题 How do I install Kohana v3.3.1 on Openshift? Do I create the PHP 5.3 cartridge and put the kohana files inside the php directory? Or do I create a Zend Server 5.6? I would like to use MySQL as well. Kohana v3.3.1 requires PHP 5.3.3 or higher to work. I just created a PHP 5.3 Cartridge and git clone it to my harddrive and here is the file structure: C:\mysite>ls -a . .. .git .openshift README.md deplist.txt libs misc php C:\mysite> Inside the php directory C:\mysite\php>ls -a . .. health_check