I'm using Bootstrap datepicker and I'd like to make that when datepicker shows, default date would be set after 14 days from today. I've got this code but it doesn't work, default date is still set to today. Could anyone explain what am I missing? Thanks in advance. 

JS:

  var plus14days = new Date();

  plus14days.setDate(plus14days.getDate() + 14 );
  $(".datepicker").datepicker("setValue", plus14days);



Question: Critique Requested on PHP Pagination Class
Answer: You can use commas to separate similarly scoped class properties. This will make your code a little easier to read and make it easier to modify.

public
    $items_per_page,
    $total_items,
    $current_page,
    //etc...
    $get_page
;


You probably shouldn't rely on GET variables. Passing these values in as parameters allows for more extensibility. That being said, I think your constructor might be doing a tad too much already and you might consider using some individual setters. Look into the Single Responsibility Principle. This goes along with what Fleshgrinder said about using more methods.

Please, always use braces on your statements, especially on long complex ones. PHP, by default, does not support true braceless syntax, otherwise you would be able to neglect them everywhere. Doing so makes your code much more legible. The advantages of neglecting them, if there even are any, are negligible.

if(!is_numeric($this-&gt;items_per_page) OR $this-&gt;items_per_page &lt;= 0) $this-&gt;items_per_page = $this-&gt;ipp_array[0];

//compared to
if(!is_numeric($this-&gt;items_per_page) OR $this-&gt;items_per_page &lt;= 0) {
    $this-&gt;items_per_page = $this-&gt;ipp_array[0];
}


The same applies for foreach loops. In addition, ternary statements are nifty, but should only be used when doing so does not detract from legibility. In the following code I have no idea what's going on.

foreach($this-&gt;ipp_array as $ipp_opt) $items .= ($ipp_opt == $this-&gt;items_per_page) ? "&lt;option selected value=\"$ipp_opt\"&gt;$ipp_opt&lt;/option&gt;\n":"&lt;option value=\"$ipp_opt\"&gt;$ipp_opt&lt;/option&gt;\n";

//compared to
foreach($this-&gt;ipp_array as $ipp_opt) {
    if($ipp_opt == $this-&gt;items_per_page) {
        $items .= "&lt;option selected value=\"$ipp_opt\"&gt;$ipp_opt&lt;/option&gt;\n";
    } else {
        $items .= "&lt;option value=\"$ipp_opt\"&gt;$ipp_opt&lt;/option&gt;\n";
    }
}


Additionally, the above could be modified to reduce repetition like so:

$selected = $ipp_opt == $this-&gt;items_per_page ? 'selected' : '';
$items .= "&lt;option $selected value=\"$ipp_opt\"&gt;$ipp_opt&lt;/option&gt;\n";


In response to some of Fleshgrinder's points:

Use proper cameCase notation for property and method names

This is a stylistic choice, though one I agree with. This is entirely up to you.

Keep everything protected unless you have a good reason to keep it private or expose it with public

Good advice, but to expand upon this, an element only has to be public if it should be accessible or modifiable outside of its current scope (the current class).

Use single or double quotes throughout your code, but don’t mix it (consistency)

Again, another stylistic point... sort of... Single quotes are string literals. This means that PHP interprets the contents between single quotes as being nothing more than a string. Double quotes are processed by PHP for evaluation, thus you are able to put PHP variables directly in the string and have them be properly escaped. As such, double quotes are ever-so-slightly slower, but it is negligible. Consistency is important, but don't let it stop you from using single/double quotes as they were meant to be used.

Enclose your variables in {} if you embed them in strings

This is only necessary if the variable you are including is complex. For example:

$string = "This is $simple, and this is {$complex[ 'elem' ]}";


Sorry this is kind of rushed, I might come back and add to this later. Hope this helps!