kohana

How to implement SimpleTest in Kohana

Here's the problem, I was assigned task from my bos to learn how to use Kohana and implement simple test in that. We would like to use it as our framework for future projects. Being new to both KohanaPHP and SimpleTest, I can't figure it out how to do even the simplest test of my helpers. I can't even find a single step-by-step tutorial...

Should a two-to-many data relationship be treated as many-to-many?

I have 2 database tables: Teams and Games. For the purpose of this question, we are dealing with football (soccer) teams and games. Each Game has exactly 2 teams, generally a home team and an away team although occasionally both teams can be neutral. My question is whether I should represent this data relationship using 2 foreign keys...

Why use a templating engine with a framework?

I recently discovered the PHP framework Kohana (which is awesome) and was reading a thread about using it in conjunction with a templating engine such as Smarty or Twig. My question is why bother? Surely an MCV framework, by definition, is a templating engine. Even "raw" PHP is, arguably, a templating engine. What possible benefits are t...

Kohana Models - Can I use subfolder to organize?

I'm using Kohana and I have several models in the Models folder of my application. Can I organize those models into subfolders and call them in a way that Kohana can find them? ...

Call a Kohana helper from cron (or any URL)

I need to call a Kohana helper (or any php MVC framework) from a Cron job. How can I do this? The server is Linux, so, I can only think of two possible solutions: 1- Open an URL from the cron job, which hits a controller and does what it has to do. 2- Call a Kohana controller without passing through the web server, but with the PHP CLI. ...

Kohana Error... Attempt to assign property of non-object

So I'm trying to go through the Version 3 Guide of Kohana and keep getting an error on the hello world create view part. ErrorException [ Warning ]: Attempt to assign property of non-object Line 8: $this->template->message = 'hello world'; I placed the site.php in the application/views folder... is this the wrong place...? The code.....

What's the proper MVC way to do this....?

Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana). I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables: categories, pages, notes I create a separate controller and view for each one...? So people can go to /category/# /page/# /note/# ...

help on building a basic php search engine

i looked for tutorials everywhere but just can't seem to get a good one... a search page with pagination, column header sorting, and multiple filtering(filters are in checkboxes) the problem: had pagination working, had sorting working, but can't get them to work together. add to that getting the filters working with a paginated and...

Kohana: Understanding and reproducing Salt & Hashed passwords using the Auth Module

I'm using the Auth Module in Kohana v 2.3.4. In terms of authenticating users, there's a two step process. The entry point is the function login. It's first task is to retrieve the password stored in the database and retrieve the password and determine the salt value. The salt is supposedly determined by an array of values, each corres...

Real Estate - Property Website - Using PHP - Any Suggestions?

Hello, I had an enquiry from a potential customer who would like to build a Real Estate website. He was looking to provide access to Agencies who can list their properties and add images and details to it. I know that Joomla with Mosets Hot Property can handle this well. I do not want the complex CMS behind a property management websit...

Kohana Auth module can't login

For those familiar with the Auth module in Kohana, I can't login a user. I can create a user fine, but apparently the hashes aren't matching. I've used the provide MySql schema to create the db and I'm using the the modules models. Here's my create a user code: public function user_create() { $user = ORM::factory('user'); $us...

Is using a Mail Model in MVC incorrect?

I have built a model in some of my MVC websites to assist with sending emails, generally I do something like this $mail = new Mail_Model; $mail->to('[email protected]'); $mail->from('[email protected]'); $mail->subject('hello'); $mail->body('hello how are you'); $mail->send(); I know the model is meant to model data - so is what I'm do...

preventing csrf in php

Requiring authentication in GET and POST parameters, not only cookies; Checking the HTTP Referer header; saw this post on wikipedia and was wondering how I can apply them ok...I am using the Kohana PHP framework and I have the facility to determine the referrer header, but what exactly do I check in the referrer header? the framework...

js and css on-demand loading

i am confused by the concept of on-demand loading I saw this blog post and was wondering if I could do the same with php using the ff. approach: check current url serve css or js based on current url which may be done like this in Kohana if (uri::segment(1) == 'search') // check current url echo html::stylesheet('search.css'); // s...

Issue in Kohana 2.3.4 (2.4) with routing and 'Index' controller

I have: brand new clean copy of Kohana 2.3.4 (tried 2.4 RC1 also), a controller named 'index' on a Debian with Apache 2.2.9. When i type address like http://localhost/kohana/index/index i expect controller 'index', action 'index' to be executed. It works on Windows localhost, works on shared hosting. But does not on my Debian server. ...

Kohana 3: using maintainable routes

I'm using Kohana v3 for a web project, and today I found myself writing this: echo Html::anchor('user/view/'.$user->id, "See user's profile"); If I rename the action_view method in the User controller, the link will be broken. To avoid this, I created a function in the User model that returns the URL used for viewing the user's profil...

removing items from url strings in PHP

Hi guys! I would appreciate some help here: What I want to do: remove &itemsperpage=10 from: http://localhost/thi/search/filter.html?type=featured&amp;page=2&amp;itemsperpage=10 and create a link from it: http://localhost/thi/search/filter.html?type=featured&amp;page=2&amp;itemsperpage=15 here's what I have come up with so far: <...

approach for "site down for maintenance"

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 call...

Kohana - subfolders within views folder

I'm working on the admin section of a site using Kohana. I've created a "admin" subfolder within the views folder to store admin views. I'm also using a modified instance of the Template Controller for the admin section called Admin Template Controller, seen here: abstract class Admin_Template_Controller extends Template_Controller { ...

What is the safest algorithm in Kohana's auth module?

I'd prefer to use the crypt function and use blowfish encryption, but the current implementation of this module uses the hash function, which doesn't offer this encryption method. So, what is the safest algorithm in Kohana's auth module? Would SHA-512 be a good option or am I better off modifying the module to use crypt and blowfish? ...