In Kohana 3, I can bind a param in a query like so
$query = 'SELECT name FROM users WHERE id = :id';
This is neat, but sometimes I want other things to be configurable, like the table name. When I use a named param for table name, it fails. I have just been building the string in these circumstances.
My question is, how can I escape ...
I can't figure this one out; it's probably really obvious to everyone's eyes except mine.
Here is my update method for Kohana 3.
public function update($type, $id, $updates) {
$info = $this->getInfo($type);
$dbTable = $info['table'];
$updatesKeysToValues = array();
var_dump($updates);
foreach(...
I'm trying to make the Auth module to 'remember' the user session with a checkbox on the login page. What happens is that no cookie is created, only session as usually. I've noticed the user_tokens table, but don't see any use of user_token model's methods at all. I do pass (bool) TRUE as a third parameter to login() method, but there's ...
I'm using Kohana 2.3.4 and can't get the auth module to work.
I'm just adding a user like this:
$user = ORM::factory('user');
$user->username = 'admin';
$this->auth = Auth::instance();
$user->email = '[email protected]';
$user->password = 'secret';
$user->add(ORM::factory('role', 'login'));
$user->save();
The problem is that w...
I've been working with PHP for about a year, but I do it as a hobby. I dont have anybody I can go to as a teacher or a mentor to give me advice on what I may be doing completely wrong, or what I could do better. I've done quite a few different things within that year, so I wouldnt consider myself a complete noob.
Anyways, I have just st...
In the auth module, we have users and roles with a many to many relationship.
My question probably has a simple answer, but I couldn't find it by myself... How would I go about selecting only users having a certain role using ORM?
What I'd like to do is something like this:
ORM::factory('user')->with('roles')->where('role','member')->f...
I'm using Kohana 3.
I'm writing an update query, and it is working for everything except this one section.
If I do a var_dump() on the results of $db->execute() I get either a 1 or 0 to say it failed or not. It is failing in this example (returning 0).
How can I figure out what error is happening? It justs seems to be silenty failing ...
I am working on my senior project, and the topic that we agreed on was a CMS that similarly to Drupal would make things easier by providing robust administration capabilities
Some of them include:
Content type and data field creation (CCK)
Views Creation
complex user management (tasks and roles)
the ability to add third party modules lat...
I'm a CodeIgniter user and I'm taking a look at Kohana. First thing I noticed is that in the documentation every snippet starts with:
<?php defined('SYSPATH') or die('No direct script access.');
assuming I'll be using .htaccess for address rewrite, is this really necessary? Is it an alternative to .htaccess for the purpouse of avoidin...
I've looked at how shadowhand (the main guy behind Kohana currently) set up his bootstrap.php file to handle exceptions on GitHub.
I thought, "that's cool", so I incorporated something similar.
However, instead of serving up a view, I'd like to send the request to a different route (or at least point it to a controller/action pair).
S...
Reading Kohana's documentation, I found out that the main difference in 3.0 version is that it follows the HMVC pattern instead of MVC as version 2.x does. The page about this in Kohana's docs and the one on wikipedia didn't really give me a clear idea.
So question: what is the HMVC pattern and how does it differ from MVC?
...
I have been through a fair bit of the code in modules/database/classes/ but still have not found how to return the last insert Id.
How do I get this?
...
When I access my site on MAMP like so, it works great
localhost/site/about-us/
When I upload it to my remote server, and access it like this
http://www.server.com/site/about-us/
all requests go back to the 'default' set up in bootstrap.php.
Here is my route setting.
Route::set('default', '(<page>)')
->defaults(array(
...
This is my callback for my usort()
public function sortProperties($a, $b) {
$sortA = inflector::camelize(str_replace('-', '_', $this->sortBy));
$sortB = inflector::camelize(str_replace('-', '_', $this->sortBy));
$a = Arr::get($a, $sortA);
$b = Arr::get($b, $sortB);
if (is_numeric($a) AND is_nu...
I have a form containing some dynamic elements. These are basically text input boxes that will contain phone numbers with a button to the right to delete the element.
Another button adds a new element and the final one to save it to the database.
What I'm wanting to do is to "mark" numbers that have changed, been removed or new numbers....
the PHP framework I am using (Kohana) recently implemented the HMVC architecture. I have read that it's a layered mvc where requests are made on top of each other. It is a bit like ajax, just purely server-side. I have applied it a bit on some experiments but I can't apply it to any of my projects (because I can't find a need for it). Ha...
I need to quote a string a string in PHP using Kohana 3's Database library. In 2.3, all I had to do is $this->db->escape().
How can I do this in 3? I seem to remember seeing something like quote() when I was viewing the source, but for the life of me can I find it again.
...
I am planning for a web application. I am using the PHP framework Kohana with Smarty. My web application will also have mobile device interface. Now, there will be lot of common and lot of separate code for the two interfaces.
How should I organize the the code so that:
There is no duplication of code.
Unnecessary code does not get lo...
I need to add some errors to the Validation helper in Kohana 3.
Here is what I start with:
// validate form
$post = Validate::factory($_POST)
// Trim all fields
->filter(TRUE, 'trim')
// Rules for name
->rule('first-name', 'not_empty')
->rule('last-nam...
Before I used a framework, I'd often define things like so (so my code makes more sense to read)
define('MINUTE', 60);
define('HOUR', MINUTE * 60); // etc
Is anything like this built into Kohana 3, or should I specify this myself (perhaps in bootstrap.php)?
...