kohana

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

Kohana Model - adding additional properties

南楼画角 提交于 2019-12-24 08:28:14
问题 I am trying to add extra properties to my Kohana (v3.3) model. class Model_mymodel extends ORM { protected $_myvar = NULL; public function set_myvar() { $this->_myvar = new Newclass(); } public function get_myvar() { return $this->_myvar; } } And then I try and set it $inst = ORM::factory('mymodel', 1)->find(); $inst->set_myvar(); var_dump($inst->get_myvar()); This returns NULL. I dont see why this would be a problem. Is there something that I am missing? Thanks 回答1: extend the __get method

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

Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST'

試著忘記壹切 提交于 2019-12-23 07:47:21
问题 I am making a cURL request via Kohana 3.2 but I get the following error when it tries to access CURLOPT_POST constant: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST' From Kohana 3.2 system/classes/kohana/request/client/curl.php public function _set_curl_request_method(Request $request, array $options) { switch ($request->method()) { case Request::POST: $options[CURLOPT_POST] = TRUE; break; case Request::PUT: $options[CURLOPT_PUT] = TRUE; break; default: $options[CURLOPT

Kohana 3.3 expanding the Auth module

戏子无情 提交于 2019-12-23 01:04:58
问题 I'm building an application using the Auth module for which I need at least 3 account types : Employer, Employee and Client. Since these accounts have different properties, functions and relationships (ex: employers has_many employees) I guess I need to have them on 3 separate ORM models. The method I thought was to tweak the Auth module to replace the 'User' model with the appropriate sub-model (employer, employee, client), corresponding the the user type in the database. Can this be done,

How to apply the “matches” validation rule in Kohana 3.1?

南笙酒味 提交于 2019-12-22 12:27:22
问题 I need to know how to apply the "matches" validation rule in Kohana 3.1. I've tried the following rule in my model with no success: 'password_confirm' => array( array('matches', array(':validation', ':field', 'password')), ) But it always fails. I put a var_dump($array) in the first line of the Valid::matches() method. I paste it below: /** * Checks if a field matches the value of another field. * * @param array array of values * @param string field name * @param string field name to match *

Kohana v3.1.0 ORM _ignored_columns — now that it's gone, what should I do instead?

百般思念 提交于 2019-12-22 08:52:56
问题 It seems that in v3.1.0 of Kohana's ORM that the _ignored_columns property has been removed. What the is the recommended technique to dealing with fields that aren't in the databases? The case I have right now is password_confirm where password is a field, but we require the user to enter their password twice. 回答1: You can pass an extra validation object to save, create and update. So your example would look like: /** * Password validation for plain passwords. * * @param array $values *

approach for “site down for maintenance”

本秂侑毒 提交于 2019-12-22 06:59:32
问题 I have been using Joomla and I love its administrative facility to put the site down for maintenance. As I have seen, all requests to the site if it is in maintenance mode is routed to a single page. If I want to add my own "site down for maintenance" module for a non-Joomla site, how do I do this? I am using an MVC framework in PHP called Kohana in its version 2 which is similar with Codeigniter. I have a Router class where I can control where a certain address go. The only approach I can