kohana

ERROR READING SESSION DATA in Kohana 3.2

此生再无相见时 提交于 2019-12-12 00:42:03
问题 I am having a problem with the session with the web development framework Kohana 3.2 that apparently is a bug that, at most, can be workarounded. It reports SESSION_EXCEPTION [ 1 ]: ERROR READING SESSION DATA. My Kohana application isn't in the root folder and I wonder if that has something to do with it. I have tryed several possible solutions but none of them have worked. Here are some of them: 1) using one library (Facebook SDK), session was initialized on it's own, and session handling

kohana v3: using different templates for different subdomains

∥☆過路亽.° 提交于 2019-12-11 13:04:00
问题 I have a kohana v3 app. 2 subdomains pointing to this app. what I have to setup that kohana uses a different template if the app called with subdomain2.example.com? at the moment all calls (from subdomain1 and subdomain2) use the standard template: 'templates/default' thank you! daniel 回答1: First, get the subdomain name from $_SERVER['SERVER_NAME'] : list($subdomain) = explode('.', $_SERVER['SERVER_NAME'], 2); Then choose what template to use based on the subdomain: // Replace this with a

Kohana 3 - redirect to 404 page

[亡魂溺海] 提交于 2019-12-11 11:59:36
问题 After searching internet I haven't found answer to my question. For example, in base complectation if you go to http://yoursite/welcome/ you'll see hello world but if you type http://yoursite/welc om / you'll see Fatal error: Uncaught HTTP_Exception_404 [ 404 ]: The requested URL welcom/index was not found on this server. ~ SYSPATH/classes/kohana/request/client/internal.php [ 94 ] thrown in From here, how can I redirect user to 404 page if he type wrong address? Kohana 3.1.3.1 回答1: Here is

Kohana 3 route not matching

≯℡__Kan透↙ 提交于 2019-12-11 07:56:00
问题 Hi I am having problem while matching Kohana 3 custom route, it seems like every thing is correct but URL doesnot match with route. Following are settings in my bootstrap.php file: Kohana::init(array( 'base_url' => '/basepath/', 'index_file' => 'index.php' )); /** * Attach the file write to logging. Multiple writers are supported. */ Kohana::$log->attach(new Log_File(APPPATH.'logs')); /** * Attach a file reader to config. Multiple readers are supported. */ Kohana::$config->attach(new Config

Modeling a many-to-many with multiple object types in Kohana w/ ORM

杀马特。学长 韩版系。学妹 提交于 2019-12-11 06:37:45
问题 I'm working on building an app with Kohana 3.0.7, using the ORM module. I want to build an object, such as tag, where many different kinds of objects can be tagged, and these options can have multiple tags. So let's say for example I have 3 models: Tag, Post and Page. how would I structure the tables and the models to make this work best? 回答1: You'd use Kohana's has-many-through relationship. An example would be: class Model_Page { protected $_has_many = array( 'tags' => array( 'model' =>

Kohana redirect

半世苍凉 提交于 2019-12-11 05:05:17
问题 After a form-submit in Kohana, I want the user to go back to the homepage. Is it correct to use a redirect for this? public function action_edit($id) { if (!empty($post)) { if ($post->validate()) { $this->request->redirect(Route::get('admin')->uri(array('action' => 'list'))); } } } Thanks in advance! 回答1: Sometimes $this->request->uri($params) (instead of Route::get()->uri() ) maybe useful. For example, when you want to use current controller (redirect to another action) or the same route. It

Kohana 3: Routing with subdirectories error, controller does not exist

老子叫甜甜 提交于 2019-12-11 04:35:49
问题 So I'm trying to build a route with sub directories and following the Kerkness wiki guide but keep getting errors. If someone could point out what I'm doing wrong I would greatly appreciate it. http://kerkness.ca/wiki/doku.php?id=routing:building_routes_with_subdirectories The code: Route::set('default', '(<directory>(/<controller>(/<action>(/<id>))))', array('directory' => '.+?')) ->defaults(array( 'directory' => 'admin', 'controller' => 'main', 'action' => 'index', )); The url: /admin

Storing HTML into a javascript variable

大憨熊 提交于 2019-12-11 04:03:49
问题 I'm having some trouble with some javascript. I'm using jQuery to dynamiclly add rows to a table. Additionally the javascript is being generated from some PHP and Kohana code. Here is the script. <script type="text/javascript"> function delExtensionNumber(element){ $(element).prev().attr('value', 'X'); $(element).parent().parent().hide(); } function addExtensionNumber(){ lines = <?php echo form::dropdown($ext_id."[did]", $lines, ''); ?>; extensions = <?php echo form::dropdown($ext_id."

Creating a route? Within a controller action_index? Kohana

倾然丶 夕夏残阳落幕 提交于 2019-12-11 01:53:22
问题 I am working with kohana, because development goes so pretty fast. Now I want to achieve something which I can't really think of a workaround for. What I want to achieve, there is a controller. It's called Controller_Restaurants But those restaurants, are grouped by provinces and after province is clicked they are grouped by a city, and then a list of the restaurants is shown up. All cities and provinces are already added to there specific database with fields. I want to create a route in my

jQuery AJAX call, how to handle

对着背影说爱祢 提交于 2019-12-11 00:02:01
问题 I'm wondering what is the best method to handle AJAX calls with jQuery? Right now I'm doing something like following: $("#test").live('click', function(){ // Process form $.ajax({ type: "post", url: "test.php", success: function(html){ if(html.success == 0) { alert('Error'); } else { var obj = $.parseJSON(html.rows); $("#success").html(obj[0].name); } }, dataType:'json' }); return false; }); In test.php file, I'm checking if request is an AJAX request. If it's an AJAX request I'm running a