kohana

Help with a regex that strips out leading white space.

I am modifying a core function of the Kohana library, the text::auto_p() function. The function describes itself as "nl2br() on steroids". Essentially, it provides <br /> single line breaks, but double line breaks are surrounded with the <p> tags. The limitation I have found with it is that it will but <br />s in a <pre> element. This ...

How do I know if an ORM save() method generated an update or an insert query?

The problem: PHP Code (no framework) if ($this->uid) { $query = sprintf('UPDATE %sUSER SET USERNAME = "%s", ' . 'PASSWORD = "%s", EMAIL_ADDR = "%s", IS_ACTIVE = %d ' . 'WHERE USER_ID = %d', DB_TBL_PREFIX, mysql_real_escape_string($this->username, $GLOBA...

Is there a Kohana equivalent for the native mysql_free_result?

Like the question says ...

How do I access the static methods of a custom class in Kohana?

I have a user class with static methods getById and getByUsername I have the class in the application/libraries folder How do I call the classes from a controller? Theory 1: $this->user = new User(); $this->user::getById; Theory 2: $user = new User(); $user::getById; or is there a clean way of doing it much like how Kohana helpe...

Code in a RSS feed

I am using a feed creator (specifically, Kohana's feed::create()), except some of my text might be like this in the description element See code below <?php echo 'example'; ?> The feed creator is using the SimpleXML Library. Whenever the data is returned (using $xml->asXml()) the html angle brackets inside the description elem...

Is issuing a parameter via a URL the same as issuing a parameter via query strings (in Kohana)

example: verify.php?uid=5&token=TOKEN the same as: verify/5/TOKEN ? ...

Optimizing Kohana-based Websites for Speed and Scalability

A site I built with Kohana was slammed with an enormous amount of traffic yesterday, causing me to take a step back and evaluate some of the design. I'm curious what are some standard techniques for optimizing Kohana-based applications? I'm interested in benchmarking as well. Do I need to setup Benchmark::start() and Benchmark::stop() f...

Kohana, .htaccess, and $_GET

After uploading my Kohana project to my Godaddy server, I noticed my standard .htaccess file wasn't working sufficiently to provide the clean URLs. After some guidance, I ended up with the following rule: RewriteRule .* index.php?kohana_uri=$0 [PT,L] This got my nice-URLs working again, but today I find out that it may be breaking my ...

Kohana -- User Registration Runtime Error (auth)

I'm implementing the auth module in Kohana, and I can't seem to figure out the source of this error message--it happens when I submit a registration form that creates a user in the database (which it successfully does). An error was detected which prevented the loading of this page. If this problem persists, please contact the websi...

Kohana, Editing Cache doesn't Reflect in View?

I'm working on setting up caching for my site, but am having difficulty testing whether the caching is working properly or not. I've got the following in my controller: public function read($id, $slug = null) { $this->cache = Cache::instance(); $story = $this->cache->get("story".$id); if (!$story) { $story_model = new Story_M...

Why is my getter magic method using a class instance as an index?

here's my getter: public function __get($field) { if ($field == 'userId'): return $this->uid; else: return $this->fields[$field]; endif; } here's my constructor public function __construct() { $this->uid = null; $this->fields = array( 'username' => '', 'password' => '', ...

why am I getting a 404 in a page I currently am using when I use a callback function

here's the controller function register() public function register() { $userdata = array(); $formdata = array( 'uname' => '', 'password' => '', 'email' => '', 'fname' => '', 'lname' => '' ); // copy the form as errors $errors = $formdata; // process data if form is submitted ...

Extending the Template Controller in Kohana

I'm having a bit of confusion in attempting to retroactively create a new base controller for my project. If I'm not mistaken, all I need to do is create a file in application/libraries called MY_baseController.php containing the following: class baseController extends Template_Controller { public function __construct() { parent...

How to deal with mutliple sites that access one 'brain' ?

Generally, my development has only covered small to medium size companies and e commerce sites. My next project will encompass say 30 sites - however, they'll have about 95% in common with each other. I want them to have 1 'brain' that means I can roll out changes, updates to the framework etc only once. I wonder if the Stack Overflow ...

Determine Current Controller in Use for Kohana

What is the best way to determine which Controller class a Kohana application is presently using? Examples: http://sitesite.com/ - _defaultControllerName_ http://somesite.com/frontpage/articles - "frontpage" http://somesite.com/contact/ - "contact" ...

Deleting IE8 cache programmatically doesn't seem to work

i want to delete the cache in ie8 with the following code $this->cache= Cache::instance(); $this->cache->delete('tuinArray'); $this->cache->delete('intBreedte'); $this->cache->delete('intLengte'); i use the kohana framework it works fine in chrome and firefox, but i just seems that ie8 keeps the cache stored, could anyone tell ...

Referencing table with two different foreign keys to the same table in Kohana ORM

table user: |id|name|employee_priority_id|user_priority_id| table priority: |id|name| As you can see, there are two foreign fields to the same table. But Kohana ORM default looks for a field called priority_id, which doesn't exist. Is there a way to let Kohana ORM know that those two fields are an foreign key to that table. ...

How do I get response codes from Authorize.net with Koahana's payment module?

that's about everything I need to ask: after u call the process() method, I want to get Authorize.net response codes and text. Or is that not included in the library. All I can see are set_field() and process() methods ...

Kohana ORM - How can I do this?

Having never worked with ORM before I thought I would give it a try today, I've come across my first problem that I don't know how to solve (due to my lack of understanding how ORM really works.) Say I have three tables: Languages, Codes, and a pivot table Codes_Languages. These all have properly defined relationships in the models. No...

kohana quotes in query.

hey, i want to format a date in mysql using DATE_FORMAT(tblnews.datead, '%M %e, %Y, %l:%i%p') i cant seem to get the quotes right , so i keep getting errors. how would you put this in a query? ...