Get KoolPHP UI with 30% OFF!

Integrate KoolControls in CodeIgniter PHP Framework

Michael
Hello,
I can use KoolControls in a standalone project without any problems, see code below:
<?php 
    /*
     * Please put this file in the same folder with KoolControls folder
     * or you may modify path of require and scriptFolder to refer correctly
     * to koolgrid.php and its folder.
     */
    include "KoolControls/KoolGrid/koolgrid.php";
    include "KoolControls/KoolAjax/koolajax.php";
    include "KoolControls/KoolGrid/ext/datasources/PDODataSource.php";
    $koolajax->scriptFolder = "KoolControls/KoolAjax";
 
    
    $DB_HOST = 'localhost'; //Host name<br>
    $DB_USER = 'sakila'; //Host Username<br>
    $DB_PASS = 'caroline'; //Host Password<br>
    $DB_NAME = 'sakila'; //Database name<br><br>
    $ds = new PDODataSource(new PDO ("mysql:host=$DB_HOST; dbname=$DB_NAME;", $DB_USER, $DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"))); // PDO Connection
 
    $ds->SelectCommand = "select actor_id, first_name, last_name from actor";
 
    $grid = new KoolGrid("grid");
    $grid->scriptFolder = "KoolControls/KoolGrid";
    $grid->DataSource = $ds;
    
    
 
    $grid->styleFolder = "default";
    $grid->Width = "655px";
    $grid->Height = "300px";
    $grid->PageSize = 25;
    $grid->AjaxEnabled = true;
    $grid->KeepRowStateOnRefresh = true;
    $grid->AllowScrolling = true;
    
    $column = new GridBoundColumn();
    $column->DataField = "first_name";
    $column->HeaderText = "Vorname";
    $column->Width = "45%";
    $grid->MasterTable->AddColumn($column);
    
    $column = new GridBoundColumn();
    $column->DataField = "last_name";
    $column->HeaderText = "Nachname";
    $column->Width = "45%";
    $grid->MasterTable->AddColumn($column);
    
    $column = new GridBoundColumn();
    $column->DataField = "actor_id";
    $column->HeaderText = "ID";
    $column->Width = "10%";
    $grid->MasterTable->AddColumn($column);
    
    $grid->MasterTable->AllowHovering = true;
    $grid->MasterTable->VirtualScrolling = true;
    $grid->MasterTable->AllowSelecting = true;
    $grid->MasterTable->AutoGenerateColumns = false;
    $grid->MasterTable->AutoGenerateDeleteColumn = false;
    $grid->MasterTable->AutoGenerateExpandColumn = false;
    $grid->MasterTable->Width = "655px";
    $grid->MasterTable->RowAlternative = true;
    $grid->MasterTable->Pager = new GridPrevNextAndNumericPager();
 
 
    $grid->Process();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>KoolGrid</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    </head>
    <body>
        <form id="form1" method="post"> <!-- You should render the grid inside a form tag, in case $grid->AjaxEnabled = false the grid needs a form to operate. -->
		<?php echo $koolajax->Render();?>
		<?php echo $grid->Render();?>
	</form>
    </body>
</html>

This gives me a nice grid with default style, virtual scrolling, ajax and pager:

However, if I put the very same code in a view file in CodeIgniter and the KoolControls folder in the same folder, I am getting a grid without style, virtualscrolling and pager which does not work:

Here is the directory structure:

I dont know why KoolGrid works nicely as standalone, and not inside CodeIgniter.
Note, ideally, the KoolControls folder should not reside in the a particular view folder of CodeIgniter, but directly in the 'view' folder so it can be used from all views, but i could not make this work either.
KoolControls are real good components, but if they don't play nicely together with PHP Frameworks, they are worthless. No one will build complex PHP applications without a framework.
I hope you guys at KoolPHP will fix this soon.
Posted Jul 5, 2016 , edited Jul 5, 2016 Kool
Peter
Hi Michael,
Please do this:
1. Put the KoolControls folder in the "assets" folder of CodeIgniter.
2. In the Controller action, please make "require" to KoolGrid as you normally do.
3. Important:
$grid->styleFolder="default";
$grid->scriptFolder= URL_TO_ASSETS."/KoolControls/KoolGrid";

Where URL_TO_ASSETS = base_url."/assets"
Posted Jul 6, 2016 , edited Jul 6, 2016 Kool
Michael
Hi Peter,
base_url() . "/assets" is not working and I am getting this message:
Severity: Warning
Message: require(): http:// wrapper is disabled in the server configuration by allow_url_include=0
I tried FCPATH instead:
$this->load->helper('url');
    
    $URL_TO_ASSETS = FCPATH . "assets/";
    require $URL_TO_ASSETS."KoolControls/KoolGrid/koolgrid.php";
    require $URL_TO_ASSETS."KoolControls/KoolAjax/koolajax.php";
    require $URL_TO_ASSETS."KoolControls/KoolGrid/ext/datasources/PDODataSource.php";
    $koolajax->scriptFolder = $URL_TO_ASSETS."KoolControls/KoolAjax";
   
    $grid = new KoolGrid("grid");
    $grid->scriptFolder = $URL_TO_ASSETS."KoolControls/KoolGrid";

but this does not work either, it gives me same blank table as in picture above.
Any suggestions?
Posted Jul 6, 2016 , edited Jul 6, 2016 Kool
Peter
KoolControls folder needed to put somewhere public which browser can access directly (like css or js).
How do you normally includes a JS file or a CSS file in your project? Please try to do the same to set the scriptFolder properties.
Please consider the KoolControls as a folder containing JS file. Basically, client-side need to load javascript code generated from php file of each controls, for example koolgrid.php
Posted Jul 6, 2016 Kool
Peter
If you are able to send me the link to a sample of CodeIngter page with KoolGrid included, I will tell you correct scriptFolder settings right away.
Posted Jul 6, 2016 Kool
Michael
Hi Peter,
Thanks for your explanations. Now I understand. I am running on 127.0.0.1 and I hardcoded this for testing. And now it works ;) Only need to figure out how to dynamically get the correct url at runtime.
Michael
Posted Jul 6, 2016 Kool -
Peter
Awesome! Any difficulty, please let us know.
Posted Jul 6, 2016 Kool -
Garison
The Ionic improvement process is quite simple. Stage one is to foster the application UX and pages structure with UI/UX planner. The following stage where Ionic engineers are required, to foster a rakish based application, the code can be abused by other web designers for Progressive Web Application for instance. The code reuse, for this situation, can be broad. The third stage is to wrap the Angular code into Ionic and markup the perspectives into Ionic UI lattice which is extraordinarily created for portable based gadgets like telephones and tablets. The following stage will be construct and arrangement which incorporate the cloud-based Ionic stage. These are run of the mill phases of the Ionic programming life cycle click site
Posted Aug 30, 2022 , edited Sep 1, 2022 Kool
Karen
Thanks for this post. part of speech refers to the grammatical category. Which is used to describe words with similar properties. For example, both nouns and verbs are under a category pop over here it is one of the basic knowledge about language. In other words, it is important to understand the hidden meanings in words on the basis of their inherent characteristics.
Posted Oct 21, 2022 , edited Oct 21, 2022 Kool
brian
Hello, buddies! Catch read review will help you detect mistakes in the text that you would have missed otherwise. This instrument is easy to use, handy, and cost nothing. Anyone may use it, and you'll be pleased with the outcomes, I'm sure. You just need to put your text to it and wait for the verification to be finished. Good luck, pals!
Posted Dec 2, 2022 Kool
Joann
I wanted to know something about PHP Framework. When I googled, the link of this post came in front of me. In this post, PHP Framework was explained in very simple language. But when I try this website then I am redirected to the sentence checker site. Where I got some details about the Sentence Fixer tool. This site is working on improving the English for others.
Posted Jan 25, 2023 Kool
Elbert
Yesterday when I was running Instagram. Then I came across a post on PHP Framework. From here I got the best information about PHP Framework. I found this very informative post I liked this post. Here I also got information about a grammar tool. I have heard many names of this tool. I found this tool very good to improve English.
Posted Feb 27, 2023 Kool
Patricia
Hello! This adverb clause checker is popular due to its affordability and huge number of free features. With its help, students around the world not only correct adverbs, but also many grammatical, spelling and punctuation errors in the text. You can also test our assistant right now and make sure it's accurate!
Posted Mar 1, 2023 , edited Mar 1, 2023 Kool
Patricia
Why is it a profitable and right decision to use the services of our research center from Ukraine? navigate to this website and you will find out that in Ukraine the market makes it possible to select an engineer who will be suitable for your project and find solutions for updating your product.
Posted Mar 11, 2023 Kool
Mabel
Hello! Do you write texts that should be understood by the reader as accurately as possible? There are many factors that go into this, such as the correct use of adverbs. In order not to waste time on self-checking, find more info about our online tool. It will check your text for errors in adverbs of any type.
Posted Mar 20, 2023 Kool
Mattew
Hello! Do you want to check your spelling? Then pay attention to this site see it here, by going here you get full access to a great tool for checking text! Everything is very easy and simple, and also this corrector can correct mistakes in your place, you should pay attention to this, don't waste time and try!
Posted Mar 22, 2023 , edited Mar 22, 2023 Kool
Gregory
If you have a business or created a project and you need to label data, then there are several options. It is difficult and time-consuming to control this process on your own, and therefore you can use an online service that will provide you with a team of the best data marking specialists in virtual mode. You can get a ready-made team or complete it according to your requirements and the scope of your project. Teams work for results and quality. To explore the details click here.
Posted Mar 27, 2023 , edited Mar 27, 2023 Kool
Garison
This article on mental health app development is a comprehensive and insightful guide for anyone looking to create an app in this important field. It covers everything from market research to design and features, making it a valuable resource for developers. The examples of successful mental health apps are especially inspiring.
Posted May 3 , edited May 3 Kool
Franny
When integrating external JavaScript and CSS libraries like KoolControls into your project, how do you typically manage and organize these assets to ensure they are easily accessible and maintainable? Are there specific tools or practices you find particularly effective in keeping your client-side dependencies well-structured?
Posted Jun 19 Kool