Category 'D'


Very short snippet: Currency format in PHP

. PHP offers two convenient functions to format (and print) Currency: money_format() and number_format() . The first can be used in conjunction with setlocale() to set the format type according to their own country, for example:

More ...

Very short snippet: PHP isset_post ()

Often you have to check if a variable in the POST was sent and, if not, assign a default value. Instead of using the syntax:

1
isset ( $_POST [ 'var_post' ] ) ? $_POST [ 'var_post' ] : default ; $ Miavar = isset ($ _POST ['var_post'])? $ _POST ['var_post']: default;

More ...

WordPress: customize the navigation between the posts

WordPress offers many features to navigate through the various posts and pages forward and backward. These are used within the themes, often in a completely interchangeably, although they contain some differences. This, in fact, create some confusion in the choice of the function to use. Here are some notes:

More ...

Overloading

Overloading is a really useful feature of some object-oriented programming languages. However, no tuti OO languages ​​support it, and some of the "implementing" or so limited or different. In general, functions or methods, overloading allows you to create two or more functions / methods that have the same name but accept different parameters, for example:

More ...

Very short trick: disable the resizing of a textarea on Safari

In any browser developed starting from the rendering engine WebKit (as apputo Safari or Chrome ), the fields textarea show, in the lower right, the characteristic feature of resizing. If such specificity can be really useful in certain cases, in others it is transformed into an element annoying.

More ...

jQuery Simple Slider 1.1.0

l'attributo rel in questo modo: Inspired by the suggestion that Santino Bivacqua I added jQuery Simple Slider can be set for each single slide a timeOut different tags by inserting in li the attribute rel in this way:

More ...

jQuery Simple Slider

jQuery Simple Slider allows you to quickly create a feature slide show from a simple list UL/LI :

More ...

Very short trick: take random elements from an array in PHP

The function shuffle() PHP "mixes" literally the elements of an array:

1
2
3
4
array ( "ele1" , "ele2" , "ele3" , "ele4" ) ; $ A = array ("ele1", "ele2", "ele3", "ele4");
$a ) ; print_r ($ a);
$a ) ; shuffle ($ a);
$a ) ; print_r ($ a);

More ...

Mathematics: resize in proportion

ci viene chiesto di renderlo più piccolo del 20%! Given a large rectangular object w and high h we are asked to make it smaller by 20%! First of all, we decrease of 20% its width:

1
object.width object.width = - ((object.width * 20) / 100)

from which

1
object.width object.width = - (object.width * 0.2)

from which

1
object.width = object.width * (1-0.2)

For the height is exactly the same.

When there's a third object, ie there has been given the percentage to be removed from our object, but by a third party, we have:

1
2
3
rate = object.width / object.height
object.width = terzo.width * (1-0.2)
object.height = object.width / installments

More ...

jQuery Plugin footer caption: add captions to images

jquery.footercaption.js is a plugin for jQuery that can dynamically add captions to images and other elements on the page ( click here for a demo).

More ...



Stop SOPA