kohana-3

How can I use phpFlickr in Kohana

Hi everyone ! I'm beginning a website using Kohana Framework, and I couldn't find how to include external libraries "the proper way". I want to use the phpFlickr library to allow my website to interact with flickr, and I was wondering if there was a better way to include the files than : require_once("path/to/phpFlickr.php"); // Fire u...

How can I select the database record with the most vote_points and ensure that it is displayed first? PHP / Kohana 3

Hello everyone and as usual, thank you to anyone taking the time to read this. I am attempting to display all of the answers relevant to a question that has been asked. I am using Kohana 3. So far, I am able to determine which record has the highest amount of vote_points via: $best_id = DB::query(Database::SELECT, 'SELECT id FROM ans...

Kohana3 ORM: loading Key/Value Attributes

I have two MySQL-Tables (oversimplified): articles - id - description article_attributes - article_id - attribute_name - attribute_value So, every article can have an unlimited amount of attributes. For the articles i have a Kohana_ORM Model <?php class Model_Article extends ORM {} ?> When loading the Model I would like to have ac...

CKEditor to Kohana3

How to connect a text editor (WYSIWYG) CKeditor to Kohana3. Can the details, every little thing. ...

Kohana ORM "primary value"

I've been reading through the documentation for Kohana ORM and in their example model class it has a block of code like: protected $_table_name = 'strange_tablename'; // default: accounts protected $_primary_key = 'strange_pkey'; // default: id protected $_primary_val = 'strange_name'; // default: name (column used as primary...

Kohana 3 auth module, getting users with 'staff' or 'manager' role

I'm learning the framework, and now building an application using it. I need to get all users that have 'user' or 'staff' role, but I couldn't find about it on the documentation. Help anyone? (I think it's more an ORM problem the the auth module) ...

What's the best way to pass additional POST variables into a validation rule in Kohana 3?

I'm trying to validate some POST data. One of the validations I need to do is a registration code, which is based off another POST variable - an IMEI number. In my POST data I have 2 fields, register_imei and register_code. My code currently looks like this: $post = Validate::factory($_POST); $post->rule('register_imei', 'not_empty') ...

how to use ko3 to remove an image inserted by fckeditor?

how to use ko3 to remove an image files from server uploaded/inserted by fckeditor? ...

Kohana3 validation on fields with []

Hi! I have a form that contains checkboxes. <input type="checkbox" name="question[5][13]" value="1" /> Now, I want to use the Kohana validation class, but it seems like it does not validate fields that are array... had anyone ever worked something around? I have something like this, but it will not work: $rules->rule('question[5][13...

Kohana 3 module structure question

Hello, everybody! I have a new question about Kohana 3, or rather about a module structure. I develop a small module called Textblock. It's about an ordinary page or a small insertion to the site layout (e.g. a greeting or a slogan, company name). It contains both controllers and models. Models inherit Sprig_MPTT. And one feature I'd lik...

KO3: Pretend properties on a Kohana_ORM Model

Say I have a very simple model that looks like this: class Model_Person extends ORM { /* CREATE TABLE `persons` ( `id` INT PRIMARY KEY AUTO_INCREMENT, `firstname` VARCHAR(45) NOT NULL, `lastname` VARCHAR(45) NOT NULL, `date_of_birth` DATE NOT NULL, ); */ } Is there a way I can I add sort of a pretend property with...

Where to store the return url in a login form/controller

I am wondering how to best deal with a return url in a login form. I think a good way is probably how it is done here. That is to urlencode the current url and send it as a get parameter to the login controller. This can then be urldecoded in the login controller. But what then? I looked at the StackOverflow login page, and I couldn't f...

Kohana 3 Controller Constructs

Trying to use __construct inside a controller to assign some variable but it keeps throwing errors. Hoping that someone can lead me in the right direction. class Controller_Mobile extends Controller { public function __construct() { parent::__construct(); $iphoneDetect = strpos($_SERVER['HTTP_USER_AGENT']...

Sorting by (order_by) foreign table value with Kohana ORM.

Is there any way to sort in orm by using a value from a forgin table? Can you do something like orm::factory("table")->order_by("table.foregin_table.column" , "ASC") or do you have to use some regular mysql and join the tables together old school? ...

Kohana 3 ORM Auth Module: how do i get a users role from the user object?

Hey all, I'm having some trouble wrapping my head around the user roles situation. i do understand the way they get created on inserting a new user, but i was wondering if there is a good way to get a users role into the user object, so that i can check for it in the controller. thanks :) t ...

Kohana Framework: add default option

<?php // My controller. $marcas = ORM::Factory('marca')-> find_all()-> as_array('nome', 'nome'); array_unshift($marcas, '-- Selecione --'); ?> <?php // My view. echo Form::select('marca', $marcas, '-- Selecione --') ?> Is there a faster way to add a default option in a select? Thank you. ...

Kohana websites repositories

I'm trying to work on Kohana and looking for some code. All I found on github is kohanajobs and wings source codes. I'll be thankful for other repositories or sources with minimal changes in structure and core. ...

How to generate a user role grid

I have the following tables: users (id, username, ... ) roles (id, name) roles_users (user_id, role_id) I am wondering how I can create a nice sort of user-role-grid from that which an admin can use to administer roles to users in a clear way. What I would like is basically a table full of checkboxes sort of like this: ...

KO3, PostgresSQL, Transactions, and PDOException

I've run into an issue that I'm hoping to get a little help on. I'm using the following: Kohana 3.0.7 PostgreSQL 8.4 Transactions in PostgreSQL using $db->query(NULL, 'BEGIN', FALSE) $db->query(NULL, 'ROLLBACK', FALSE); $db->query(NULL, 'COMMIT', FALSE); The issue is that when I send a query to the database that results in a...

Auth, Login / Logout

How do I create a login and logout feature using kohana? ...