Search Results

Search found 198 results on 8 pages for 'kohana'.

Page 2/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Kohana 3: Auth module

    - by Thomas
    Hi, i'm trying to learn the Kohana's Auth module but login method always return false. Controller: <?php defined('SYSPATH') OR die('No Direct Script Access'); class Controller_Auth extends Controller { public function action_index() { if($_POST) { $this->login(); } $this->template = View::factory('login'); echo $this->template; } private function login() { $user = ORM::factory('user'); $data = array('username' => 'wilson', 'password' => '123'); if(!$user->login($data)) { echo 'FAILED!'; } } private function logout() { } } ?> Model: <?php defined('SYSPATH') or die('No direct script access.'); class Model_User extends Model_Auth_User { } ?>

    Read the article

  • Kohana ORM Aliasing and "Trying to get property of non-object"

    - by Toto
    I have the following tables in the database: teams: id name matches: id team1_id team2_id I've defined the following ORM models in my Kohana application: class Match_Model extends ORM { protected $belongs_to = array('team1_id' => 'team', 'team2_id' => 'team'); } class Team_Model extends ORM { protected $has_many = array('matches'); } The following code in a controller: $match = ORM::factory('match',1); echo $match->team1_id->name; /* <-- */ Is throwing the following error on the linke marked with /* <--- */: Trying to get property of non-object The framework is yielding the value of the foreign key instead of a reference to a Match_Model instance as it should (giving the has_many and belongs_to properties stated). Am I missing something? Note: Just in case, I've added the irregular plural 'match' => 'matches' in application/config/inflector.php

    Read the article

  • Kohana 3 and CRON always accessing index.php (not following the URI argument)

    - by alex
    OK, I hope this is my last question about CRON jobs and Kohana 3. Note: others are not duplicates, just other problems. Here is my CRON job (setup in cPanel) php /home/user/public_html/index.php --uri=properties/update As per this answer. I have set it up so it emails me the output. It is running every 5 mins. Unfortunately, it always emails me the source of the home page of my site (index.php or /). I can access that URL fine in my browser, i.e. http://www.example.com/properties/update and it works and does it's job correctly. I can tell the Cron is never hitting the script because I have a file logger in place. Would this have anything to do with .htaccess? Has this happened to anyone before, and how did they fix it? Many thanks.

    Read the article

  • [PHP] Kohana-v3 ORM parent relationship

    - by VDVLeon
    Hi all, I just started with the version 3 of the Kohana Framework. I have worked a little with the $_has_many etc. Now I have the table pages. The primary key is pageID. The table has a column called parentPageID. Now I want to make a ORM model who, when accesed like this $page->parent->find() returns the page identified by parentPageID. I have the following already: // Settings protected $_table_name = 'pages'; protected $_primary_key = 'pageID'; protected $_has_one = array( 'parent' => array( 'model' => 'page', 'foreign_key' => 'parentPageID', ), ); But that does not work, it simply returns the first page from the table. Last query says this: SELECT `pages`.* FROM `pages` ORDER BY `pages`.`pageID` ASC LIMIT 1 Does somebody know how to solve this? I know this can: $parent = $page->parent->find($page->parentPageID); but it must be and can be cleaner (I think).

    Read the article

  • Need help with Swift mailer with Kohana wrapper

    - by alex
    My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('[email protected]' => 'Alex')) ->setTo(array('[email protected]' => 'Alex')) ->setBody('hello') ->attach(Swift_Attachment::fromPath(DOCROOT . 'assets/attachments/instructions.pdf')); $swift->send(); The email::connect() returns an instance of SwiftMailer. As per these docs, it would seem that it should work. However, I get an error Fatal error: Call to undefined method Swift_Mailer::setSubject() in /home/user/public_html/application/classes/controller/properties.php on line 45 I've seen that email::connect() does exactly what the example code in the docs does. That is include the correct file return an instance of the library What am I doing wrong? Thanks

    Read the article

  • How to install custom modules in Kohana 3 framework

    - by BPS
    I'm learning framework KohanaPhp 3 and I have a problem with adding a module called kolanos-Kohana-captcha. What I've done so far is: I copied the directory kolanos-kohana-captcha into modules directory Copied kolanos-kohana-captcha/config/captcha.php to file application/config/captcha.php Edited the file and added Bootstrap.php Kohana::modules(array (... 'captcha' = MODPATH."kolanos-kohana-captcha ', )); But it does not work: (Whenever I want to use class Captcha kohana shows the error "class not found." I'm doing something wrong? Is this a problem with the module? There are some other modules to handle the captcha in Kohana 3+?

    Read the article

  • Kohana ORM get one record in many-to-many relationship

    - by booze2go
    Hi Guys, I've got two tables (items / tags). Item has and belongs to many tags - tag has and belongs to many items. It's no problem for me to fetch all related tags like: $item = ORM::factory('item', 4); foreach($item->tags as $tag){....} But how can i fetch only one... and maybe a specific one? Thanks in advance!

    Read the article

  • Kohana 3 - Get URLs

    - by booze2go
    Hi Guys, could you help me with following questions. How do i get the: absolute/relative current url http://www.example.com/subdir/controller/action /subdir/controller/action absolute/relative application url http://www.example.com/subdir/ /subdir/ I could of course use native php to get it but i think i should rather use ko3 functions. Any idea how that works? Thanks in advance!

    Read the article

  • Kohana 3 get full site home url

    - by Marek
    Hello I have installed Kohana in kohana directory in my xampp public folder. When I try url::base(); I've got only /kohana/, but I want to http://localhost/kohana/ Any chance for get this by Kohana, or I must standard PHP? Regards

    Read the article

  • Can I include a view in Kohana 3 that is not within `application/views`?

    - by alex
    I am building a staff area for a website, which is completely different to the main brochure style site. I have 2 Kohana systems setup. I realise they can both share the same system and modules folder. Now, with the second one, I want to make the main template view a view in a different folder. I tried this in my base controller $this->template = DOCROOT . '../~new2/application/views/template.php'; But Kohana is looking for it in its own views folder as evident by the error I received. I even put a var_dump(file_exists($this->template)); // true to be sure it was finding the correct file. Is there a way to add a template file that is not within the views folder, without hacking the core Kohana code (and if I'm lucky not extending and overloading the view class).

    Read the article

  • How to handle this "session failed to write file" error in PHP?

    - by alex
    I am using the Kohana 3 framework, and am using the native session driver. For some reason, occasionally the sessions fail to write to their file. Warning: session_start() [function.session-start]: open(/tmp/sess_*****, O_RDWR) failed: Permission denied (13) in /home/site/public_html/system/classes/kohana/session/native.php on line 27 I am pretty sure Kohana has its own in built error handler, but it is not triggered with this error (i.e. it shows up like a normal PHP error, not the Kohana error). Anyone that has ever used Kohana will notice this seems to have bypassed Kohana's error handling (perhaps set with set_error_handler()). Is there anyway to stop this error from appearing without switching from the native session (i.e. file based) driver? Should I just give good practice the boot and append an @ error suppressor to session_start() in the core code of Kohana? Should I relax the error_reporting()? Thanks

    Read the article

  • How do I relate tables with different foreign key names in Kohana ORM?

    - by Matt H
    I'm building a Kohaha application to manage sip lines in asterisk. I'm wanting to use ORM but I'm wondering how do relate certain tables that are already well established. e.g. the table sip_lines looks like this. +--------------------+------------------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +--------------------+------------------+------+-----+-------------------+-----------------------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | sip_name | varchar(80) | NO | UNI | NULL | | | displayname | varchar(48) | NO | | NULL | | | line_num | varchar(10) | NO | MUL | NULL | | | model | varchar(12) | NO | MUL | NULL | | | mac | varchar(16) | NO | MUL | NULL | | | areacode | varchar(6) | NO | MUL | NULL | | | per_line_astpp_acc | tinyint(1) | NO | | 0 | | | play_warning | tinyint(1) | NO | | 0 | | | callout_disabled | tinyint(1) | NO | | 0 | | | notes | varchar(80) | NO | | NULL | | | last_update | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP | +--------------------+------------------+------+-----+-------------------+-----------------------------+ sip_buddies is this: +----------------+------------------------------+------+-----+-----------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------------------------+------+-----+-----------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(80) | NO | UNI | | | | host | varchar(31) | NO | | | | | | | lastms | int(11) | NO | | 0 *** snip *** +----------------+------------------------------+------+-----+-----------+----------------+ The two tables are actually related as sip_lines.sip_name = sip_buddies.name How do I relate them in Kohana ORM as this wouldn't be quite right would it? <?php defined('SYSPATH') or die('No direct script access.'); /* A model for all the account information */ class Sip_Line_Model extends ORM { protected $has_one = array("sip_buddies"); } ?> EDIT: Actually, it'd be fair to say that these tables are not properly related with foreign keys! doh. EDIT: Looks like Kohana ORM is not that flexible. ORM is probably not the way to go and works best for completely new projects where the data model can be altered. The reason being that the key names must follow a specific naming convention or else they won't relate in Kohana.

    Read the article

  • Kohana or CodeIgniter?

    - by Thinker
    I'm looking for a PHP framework. I did a research here and found CodeIgniter would be best for me. But then I discovered that there is Kohana based on CodeIgniter. And I'm annoyed, because since Kohana is based on CodeIgniter, it should work similar, but it is optimized for PHP 5, so it should be faster in a PHP 5 environment. I was going to choose Kohana and then I found benchmarks that points CodeIgniter as the faster one. I don't understand it. If Kohana is updated more frequently and optimized for PHP 5, shouldn't it be better then? I'm experienced PHP programmer, but Smarty is the only framework I know, and I don't want to waste next few month for learning a bad framework. Thanks for your reply, I will give Kohana a try.

    Read the article

  • How to perform an external request in Kohana 3?

    - by alex
    I've always used cURL for this sort of stuff, but this article got me thinking I could request another page easily using the Request object in Kohana 3. $url = 'http://www.example.com'; $update = Request::factory($url); $update->method = 'POST'; $update->post = array( 'key' => 'value' ); $update->execute(); echo $update->response; However I get the error Accessing static property Request::$method as non static From this I can assume it means that the method method is static, but that doesn't help me much. I also copied and pasted the example from that article and it threw the same error. Basically, I'm trying to POST to a new page on an external server, and do it the Kohana way. So, am I doing this correctly, or should I just use cURL (or file_get_contents() with context)?

    Read the article

  • How to peform an external request in Kohana 3?

    - by alex
    I've always used cURL for this sort of stuff, but this article got me thinking I could request another page easily using the Request object in Kohana 3. $url = 'http://www.example.com'; $update = Request::factory($url); $update->method = 'POST'; $update->post = array( 'key' => 'value' ); $update->execute(); echo $update->response; However I get the error Accessing static property Request::$method as non static From this I can assume it means that the method method is static, but that doesn't help me much. I also copied and pasted the example from that article and it threw the same error. Basically, I'm trying to POST to a new page on an external server, and do it the Kohana way. So, am I doing this correctly, or should I just use cURL (or file_get_contents() with context)?

    Read the article

  • How to arrange models, views, controllers in a new Kohana 3 project

    - by Pekka
    I'm looking at how to set up a mid-sized web application with Kohana 3. I have implemented MVC patterns in the past but never worked against a "formalized" MVC framework so I'm still getting my head around the terminology - toying around with basic examples, building views and templates, and so on. I'm progressing fairly well but I want to set up a real-world web project (one of my own that I've been planning for quite some time now) as a learning object. Example-based documentation is a bit sparse for Kohana 3 right now - they say so themselves on the site. While I'm not worried about learning the framework soon enough, I'm a bit at a loss on how to arrange a healthy code base from the start - i.e. how to split up controllers, how to name them, and how to separate the functionality into the appropriate models. My application could, in its core, be described as a business directory with a main businesses table. Businesses can be listed by category and by street name. Each business has a detail page. Business owners can log in and edit their business's entry. Businesses can post offers into an offers table. I know this is pretty vague, I'll be more than happy to go into more detail on request. Supposing I have all the basic functionality worked out and in place already - list all businesses, edit business, list businesses by street name, create offer, and so on, and I'm just looking for how to fit the functionality into a Kohana application structure that can be easily extended: Do you know real-life, publicly accessible examples of applications built on Kohana 3 where I could take a peek how they do it? Are there conventions or best practices on how to structure an extendable login area for end users in a Kohana project that is not only able to handle a business directory page, but further products on separate pages as well? Do you know application structuring HOWTOs or best practices for Kohana 3 not mentioned in the user guide and the inofficial Wiki? Have you built something similar and could give me some recommendations?

    Read the article

  • Themes outside application.

    - by Marek
    Hi all I read http://forum.kohanaframework.org/comments.php?DiscussionID=5744&page=1#Item_0 and I want to use similar solution, but with db. In my site controller after(): $theme = $page->get_theme_name(); //Orange Kohana::set_module_path('themes', Kohana::get_module_path('themes').'/'.$theme); $this->template = View::factory('layout') I checked with firebug: fire::log(Kohana::get_module_path('themes')); // D:\tools\xampp\htdocs\kohana\themes/Orange I am sure that path exists. I have directly in 'Orange' folder 'views' folder with layout.php file. But I am getting: The requested view layout could not be found Extended Kohana_Core is just: public static function get_module_path($module_key) { return self::$_modules[$module_key]; } public static function set_module_path($module_key, $path) { self::$_modules[$module_key] = $path; } Could anybody help me with solving that issue? Maybe it is a .htaccess problem: # Turn on URL rewriting RewriteEngine On # Put your installation directory here: # If your URL is www.example.com/kohana/, use /kohana/ # If your URL is www.example.com/, use / RewriteBase /kohana/ # Protect application and system files from being viewed RewriteCond $1 ^(application|system|modules) # Rewrite to index.php/access_denied/URL RewriteRule ^(.*)$ / [PT,L] RewriteRule ^(media) - [PT,L] RewriteRule ^(themes) - [PT,L] # Allow these directories and files to be displayed directly: # - index.php (DO NOT FORGET THIS!) # - robots.txt # - favicon.ico # - Any file inside of the images/, js/, or css/ directories RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|static) # No rewriting RewriteRule ^(.*)$ - [PT,L] # Rewrite all other URLs to index.php/URL RewriteRule ^(.*)$ index.php/$1 [PT,L] Could somebody help? What I am doing wrong? Regards [EDIT] My controller code: class Controller_Site extends Controller_Fly { public static $meta_names = array('keywords', 'descriptions', 'author'); public function action_main() { $this->m('page')->get_main_page(); } public function action_page($page_title) { $this->m('page')->get_by_link($page_title); } public function after() { $page = $this->m('page'); $metas = ''; foreach(self::$meta_names as $meta) { if (! empty($page->$meta)) { $metas .= html::meta($page->$meta, $meta).PHP_EOL; } } $theme = $page->get_theme_name(); Kohana::set_module_path('themes', Kohana::get_module_path('themes').'/'.$theme); $menus = $page->get_menus(); $this->template = View::factory('layout') ->set('theme', $theme) ->set('metas', $metas) ->set('menus', $menus['content']) ->set('sections', $page->get_sections()) ->set_global('page', $page); if ($page->header_on) { $settings = $this->m('setting'); $this->template->header = View::factory('/header') ->set('title', $settings->title) ->set('subtitle', $settings->subtitle) ->set('menus', $menus['header']); } if ($page->sidebar_on) { $this->template->sidebar = View::factory('sidebar', array('menus' => $menus['sidebar'])); } if ($page->footer_on) { $this->template->footer = View::factory('footer'); } parent::after(); } } and parent controller: abstract class Controller_Fly extends Controller_Template { protected function m($model_name, $id = NULL) { if (! isset($this->$model_name)) { $this->$model_name = ORM::factory($model_name, $id); } return $this->$model_name; } protected function mf($model_name, $id = NULL) { return ORM::factory($model_name, $id); } }

    Read the article

  • Arranging models, views, controllers in a Kohana 3 project

    - by Pekka
    I'm looking at how to set up a mid-sized web application with Kohana 3. I have implemented MVC patterns in the past but never worked against a "formalized" MVC framework so I'm still getting my head around the terminology - toying around with basic examples, building views and templates, and so on. I'm progressing fairly well but I want to set up a real-world web project (one of my own that I've been planning for quite some time now) as a learning object. I learn best by example, but example-based documentation is a bit sparse for Kohana 3 right now - they say so themselves on the site. While I'm not worried about getting into the framework soon enough, I'm a bit concerned about arranging a healthily structured code base from the start - i.e. how to split up controllers, how to name them, and how to separate the functionality into the appropriate models. My application could, in its core, be described as a business directory with a main businesses table. Businesses can be listed by category and by street name. Each business has a detail page. Business owners can log in and edit their business's entry. Businesses can post offers into an offers table. I know this is pretty vague, but I don't want to cram too much information into this question. I'll be more than happy to go into more detail if needed. Supposing I have all the basic functionality worked out and in place already - list all businesses, edit business, list businesses by street name, create offer, and so on, and I'm just looking for how to fit the functionality into a MVC pattern and into a Kohana application structure that can be easily extended: Do you know real-life, publicly accessible examples of "database-heavy" applications like directories, online communities... with a log-in area built on Kohana 3 where I could take a peek how they do it? Are there conventions or best practices on how to structure an extendable login area for end users in a Kohana project that is not only able to handle a business directory page, but further products on separate pages as well? Do you know application structuring HOWTOs or best practices for Kohana 3 not mentioned in the user guide and the inofficial Wiki? Have you built something similar and could give me some recommendations?

    Read the article

  • How to select a MAX value from column in Query Builder in Kohana framework?

    - by Victor Czechov
    I need to INSERT a data to table, but before a query I must to know the MAX value from column position, than to INSERT a data WHERE my SELECTED before position+1. Is it possible with query builder? following my first comment I did query: $p = DB::select(array(DB::expr('MAX(`position`)', 'p')))->from('supercategories')->execute(); echo $p; the error: ErrorException [ Notice ]: Undefined offset: 1 MODPATH\database\classes\kohana\database.php [ 505 ] 500 */ 501 public function quote_column($column) 502 { 503 if (is_array($column)) 504 { 505 list($column, $alias) = $column; 506 } 507 508 if ($column instanceof Database_Query) 509 { 510 // Create a sub-query

    Read the article

  • ErrorException [ Fatal Error ]: Class 'Controller' not found - Kohana 3.0.3 Error

    - by Asif
    Hi, I am (newbie) using Kohana V 3.0.3 and my directory structure is: pojectsys (kohana's system directory) parallel to htdocs directory C:\xampp\pojectsys and my application directory is in htdocs C:\xampp\htdocs\examples Inside C:\xampp\htdocs\examples\index.php, following variables have been set: $application = 'C:\xampp\htdocs\examples\application'; $system = 'C:\xampp\pojectsys'; Now when I am trying to execute http://lc.examples.com/ then Kohana returns error: ErrorException [ Fatal Error ]: Class 'Controller' not found for line 3 class Controller_Welcome extends Controller { Please help me to resolve this issue.

    Read the article

  • Kohana Database Library - How to Execute a Query with the Same Parameters More Than Once?

    - by Noah Goodrich
    With the following bit of code: $builder = ORM::factory('branch')->where('institution_id', $this->institution->id)->orderby('name'); I need to first execute: $count = $builder->count_all(); Then I need to execute: $rs = $builder->find_all($limit, $offset); However, it appears that when I execute the first query the stored query parameters are cleared so that a fresh query can be executed. Is there a way to avoid having the parameters cleared or at least copy them easily without having to reach directly into the Database driver object that stores the query parameters and copy them out? We are using Kohana 2.3.4 and upgrading is not an option.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >