I don't get this:
http://localhost/index.php/articles/edit/1/my-first-article
This URL is mentioned as an example in the Kohana framework documentation. I poked around in the files of my installation, and there is no .htaccess besides my own one that has nothing to do with that.
So, how can it be that an index.php is called but then,...
I don't get this: They say, it is good to make a "Base Controller" that instantiates the database and session:
// Base Controller code
$this->db = Database::instance($db_group);
$this->session = Session::instance();
// Now in any controller which extends Base Controller
$var = $this->session->get('var');
$query = $this->db->query('SELEC...
To get started with Kohana quickly, I wonder if someone has ever made an sleek skeleton project that makes use of all basic things every web developer needs:
basic user authentification with login
retrieving some stuff from an MySQL database and displaying it
By hand I would do this pretty fast. But with Kohana it feels like I have t...
I had created my own little lightweight framework for small projects, and now switched to Kohana.
But I wonder what's the way to go to achieve navigation hierarchies.
Example: I have a menu like this:
Home | Products | Support | Contact
In my old framework, when the user clicked on "Products", my framework knew which navigation laye...
I am looking for the best practices with PHPUnit testing a project on KohanaPHP framework.
...
Kohana automatically sets up URLs like so
http://www.example.com/controller/method/argument1/argument2/etc
Now I like to use the dash to separate my words in the URL, and I have an address like so
http://www.example.com/business-hub
My controller is titled BusinessHub_Controller. What is annoying me, is for /business-hub/ to match th...
I've been using Kohana for a couple months now, and am still relatively new to the MVC style of organizing your code/presentation/db-layer. Unfortunately, while there is plenty of documentation on how to create a controller, establish a view, and interact with a db via a model, I've not found many resources that deal with clean, and sugg...
How would I construct a hook in Kohana so that ...
http://www.example.com/a_controller/non_existing_method
would route to to the controller title 'a_controller' except call the controller's index method and pass 'non_exisitng_method' as an argument?
It should also allow a fallback, so that if non_existing_method IS a method, it shou...
How does Kohana determine if a request is an AJAX one?
Is there anything different in the referrer string? Do I need to add a GET param, perhaps ?ajax=true
Thank you.
...
I have been using the CodeIgniter system for a while now - but it has it's short comings. I am grateful for what it taught me, but now I need a library for a new non-codeigniter project and so I am looking around for ideas on which libraries have things right and which don't. I will probably have to take pieces from several libraries to ...
I'm exploring a few PHP frameworks and the current front runner is Kohana.
Having a Rails background I've become used to what the rails community calls "RESTful" routes. So a "GET /posts" displays all posts and is handled by the index method of the Posts Controller. A "POST /posts" creates a new post object and is handled by a different...
I would like to know if it is acceptable/preferred to use self::method() and parent::method() when working in php classes.
You can use $this->method() but $this-> can also refer to a class variable, a parent class variable, or a method from the parent class. There is no ambiguity in self::
Is self:: depreciated and/or are there any ca...
We have a client for whom we build a lot of template based sites. Ideally we would use something like kohana (http://www.kohanaphp.com/) to handle the templating and make doing site wide changes a breeze.
Unfortunately our client cannot (and will not) host any server side code (and before you ask, this will not change and hosting the f...
Hi,
I'm using the Kohana PHP Framework for an application. Now I'm running into a problem, when jQuery does an AJAX request to a certain file, it does work, but when this file throws an PHP exception, jQuery fails and doesn't show the output of the file.
A little example, this is the piece of Javascript:
$.post($('#' + e.currentTarget...
Having used some PHP frameworks such as Codeigniter and Kohana for some smaller sites, I'm starting to wonder if MVC is still applicable for larger projects and, if so, what precautions need to be taken to maintain clean clode. What practices do the larger sites use in order to prevent this? Does Amazon's or Flickr's code use MVC or some...
how do I capture the submit event in this particular scenario( I am using Kohana):?
controller function (swo/test):
echo "Form succesfully submitted.<br/>";
$min = $_POST['price1'];
$max = $_POST['price2'];
echo "Minimum Value:" . $min . "<br/>";
echo "Maximum Value:" . $max;
$q = new Swo_Model;
$result = $q->searchRange($min, $max);
...
I saw this at the Kohana documentation:
$content = new View('pages/items');
$items = new Items_Model;
$content->items = $items->get_items($page_no, 10); // page to get starting at offset, number of items to get
As you can see, we can assume that we have get_items method for Items model that receives 2 parameters, $page_no and 10 (as ...
that's it. How do I implement the Kohana pagination library in MVC way? which code should go to the model? to the controller? to the view? I have seen tons of examples but none of them are implemented in MVC.
...
I have an image path string stored in a database
It goes like: img/uploads/imagename.jpg
I have a controller:
$this->image = new Image($wines->image)
//this is assuming that I have a wines table with the image property
$this->image->resize(60, 250, Image::AUTO)
echo $this->image->render();
//the problem is nothing is rendered
//...
straight to the point :
I am using Kohana, and I am looking at another script written in plain PHP. In the script, I have a class ShoppingCart. If I am to convert the script to Kohana, where am I to put the class, its methods and its properties?
Is it in my existing default controller? Or should I put it in a separate controller? Or a...