PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label kohana. Show all posts
Showing posts with label kohana. Show all posts

Monday, October 31, 2022

[FIXED] What is Cache Tagging?

 October 31, 2022     caching, kohana, performance, php     No comments   

Issue

There is Cache_Tagging in Kohana but it does not explain what it is. Can anyone tell what Cache Tagging is supposed to do or when do we use it ?


Solution

Some cache implementations allow you to add one or more tags to any data item you store in the cache, and then find or delete all items with a given tag. This can be useful for a number of things, most significantly batch updates (you add a bunch of related stuff to the cache, tag it with a version string, and when you later learn that data from that version has become outdated, tell the cache to drop it all at once).



Answered By - Michael Borgwardt
Answer Checked By - Marilyn (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, October 23, 2022

[FIXED] Why does PHPExcel try to create a class name out of the Excel file name when used inside Kohana?

 October 23, 2022     kohana, php, phpexcel     No comments   

Issue

I am trying to build the PHPExcel library into an application built with the Kohana PHP framework.

In a test app outside the Kohana framework, I can create and read Excel files fine.

And inside the Kohana application, creating a file works:

$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("Test Generator")
    ->setTitle("Test Excel5 File");
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', 'Hello');
$objPHPExcel->getActiveSheet()->setTitle('Test Sheet');
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('test123.xls'); //created in the root directory of application

However, when inside the Kohana framework when I try to read a file with this code:

$objReader = PHPExcel_IOFactory::createReader('test123.xls');

I get this error:

alt text

How can I prevent PHPExcel/Kohana from trying to create a class name out of the Excel file name?


Solution

The createReader() method expects the filetype as a parameter (eg Excel2007, Excel5, Excel2003XML, OOCalc, Gnumeric, CSV), not the filename.

// Use the IOFactory to instantiate a reader of the correct type
$objReader = PHPExcel_IOFactory::createReader('Excel5'); 
// Use the reader to load the file, and return a PHPExcel object
$objPHPExcel = $objReader->load('test123.xls'); 


Answered By - Mark Baker
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, March 10, 2022

[FIXED] Routing in Kohana in development

 March 10, 2022     kohana, mamp, php, routes     No comments   

Issue

I am setting up my new web application using the Kohana framework.

I am using MAMP so the app is located in the htdocs folder, with this structure:

---htdocs
 --foo
  -application

I am getting this error when viewing http://localhost:8888/foo/

Kohana_HTTP_Exception[ 404 ]: The requested URL foo was not found on this server.

In the bootstrap.php the route is the default Kohana one

Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(
array(
    'controller' => 'welcome',
    'action'     => 'index',
));

Solution

Check your application/bootstrap.php file for:

Kohana::init(array(
    'base_url'   => '/foo/',
));

This is required for Kohana to understand it's in /foo/ folder.

UPD The requested URL foo was not found on this server exception message is generated if no action_<action> method was found in Controller.

If no Route was found Unable to find a route to match the URI: exception message is genereted.

Not shure Routing works as expected, but it works ;).

So check your Controller file for apropriate action method.



Answered By - s.webbandit
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, February 15, 2022

[FIXED] kohana framework doesn't load module on linux server while load it perfectly on mamp

 February 15, 2022     frameworks, kohana, linux, mamp, php     No comments   

Issue

well, question is in subject, here i can give you some details. Error is Class QIWI is not found. In bootstrap it is uncommented, when i use

    Debug(Kohana::modules()) 

it shown like module is loaded. folder three is

    --modules
    --|-qiwi
    ----|--classes
    -------|--Kohana
    ----------|--Qiwi.php (class Kohana_Qiwi)
    -------|Qiwi.php (class Qiwi extends Kohana_Qiwi)

i think that is a filename issue, but it seems like files r named correctly


Solution

Try to uncomment this line in bootstrap:

spl_autoload_register(array('Kohana', 'auto_load_lowercase'));


Answered By - Mariyo
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing