Archive

Archive for May, 2013

In ExtJS 4.2 hidden field occupies space

May 21st, 2013 No comments

ExtJS 4.2 has been with us for some time and like every first major version has minor errors. One of them is that the hidden fields in the form are not entirely hidden. The fields are not visible, but they can be seen in the table that the field is thus creates about 3-5px height for each hidden field.

Error has been detected by the people of Sencha team and will be corrected in the next version. In the meantime, here’s a simple way how to patch. In the CSS file that you use for your style insert the following line

.x-form-item-hidden { display:none; }

CSS style is in the above table. In this way, the hidden field become completely hidden.

More about this problem

ExtJS 4 – Tree Grid with lines

May 14th, 2013 No comments

ExtJS 4 gives you the ability to combine two objects: Tree and Grid. To do this you need to add the attribute “column” in the object tree. You specify the columns you want to display, as it did for the grid. Tree is shown in this way there is no border bottom which separates the rows.\r\n\r\nnull\r\n\r\nIf you want to display lines need to create additional CSS style that will then be included in the configuration part of tree. For this occasion, I create two styles:\r\n\r\n\r\n.border-line &gt; td {\r\n border-bottom: 1px solid #eee !important;\r\n}\r\n.border-cell &gt; td {\r\n border-bottom: 1px solid #eee !important;\r\n border-right: 1px solid #eee !important;\r\n}\r\n\r\n\r\nThe second step is to call the appropriate style as follows:\r\n\r\n\r\nviewConfig: {\r\n getRowClass: function(record) { return ”border-line”; }\r\n}\r\n\r\n\r\nAbove code will create a line under each row of trees that might look something like this:\r\n\r\nline\r\n\r\nAnd if you replace “<em>border-line</em>” with “<em>border-cell</em>”, you can get an effect similar to the following figure:\r\n\r\ncellExtJS gives you the ability to combine two objects: Tree and Grid. To do this you need to add the attribute “column” in the object tree. You specify the columns you want to display, as it did for the grid. Tree is shown in this way there is no border bottom which separates the rows.\r\n\r\nnull\r\n\r\nIf you want to display lines need to create additional CSS style that will then be included in the configuration part of tree. For this occasion, I create two styles:\r\n\r\n\r\n.border-line &gt; td {\r\n border-bottom: 1px solid #eee !important;\r\n}\r\n.border-cell &gt; td {\r\n border-bottom: 1px solid #eee !important;\r\n border-right: 1px solid #eee !important;\r\n}\r\n\r\n\r\nThe second step is to call the appropriate style as follows:\r\n\r\n\r\nviewConfig: {\r\n getRowClass: function(record) { return ”border-line”; }\r\n}\r\n\r\n\r\nAbove code will create a line under each row of trees that might look something like this:\r\n\r\nline\r\n\r\nAnd if you replace “<em>border-line</em>” with “<em>border-cell</em>”, you can get an effect similar to the following figure:\r\n\r\ncellExtJS gives you the ability to combine two objects: Tree and Grid. To do this you need to add the attribute “column” in the object tree. You specify the columns you want to display, as it did for the grid. Tree is shown in this way there is no border bottom which separates the rows.

null

If you want to display lines need to create additional CSS style that will then be included in the configuration part of tree. For this occasion, I create two styles:

.border-line &gt; td {
  border-bottom: 1px solid #eee !important;
}
.border-cell &gt; td {
  border-bottom: 1px solid #eee !important;
  border-right: 1px solid #eee !important;
}

The second step is to call the appropriate style as follows:

viewConfig: {
  getRowClass: function(record) { return 'border-line'; }
}

Above code will create a line under each row of trees that might look something like this:

line

And if you replace “<em>border-line</em>” with “<em>border-cell</em>”, you can get an effect similar to the following figure:

cell

Date validation in PHP

May 10th, 2013 No comments

What happens if a user enters as birthday 31/02/2000.?
Is the date will be properly stored in the database?

Of course not. 03.03.2000 will be saved, because we have 3 days exceeded the number of days in February. It would be nice to warn him of the mistake. To do this, they would have to make a function that would control date.

PHP already has a function to check the validity date:

bool checkdate(int $month, int $day, int $year);

For the month, day and year, the function will return if the date is correct or not.

Categories: PHP Tags: ,

Get the controller and method name in CodeIgniter

May 10th, 2013 No comments

CI contains functions which see the link structure and extracting from it the name of the controller and the method that are called. These are the functions:

$this->Router->fetch_class(); // Class = controller
$this->Router->fetch_method();
[/ code]

What is important, if you are using CI routing, these two functions will recognize this and send you the correct name of the controller and its methods. Example:

For link:
http://www.onlineshop.com/product/samsung-s3-case/123
Routing redirects to:
http://www.onlineshop.com/products/view/123/
CI will return as a controller “products” and as a method “view” .

For more data about routing, go to CI URI Routing.

Categories: PHP Tags: , ,