WordPress Add Pagination

The easiest method I found to add a good pagination:

1. Install WP-PageNavi plugin.
2. In the template file, the loop should be like this:

<?php
// The Query,
$the_query = new WP_Query( 'category_name=blog&amp;paged='.$paged );

// The Loop which loops through all the posts of category
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
<?php the_content(); ?>
<?
endwhile;
//call wp-pagenavi plugin
wp_pagenavi( array('query' =>$the_query ));

// Reset Post Data
wp_reset_postdata();
?>

3. Change how many posts do you want to display per page in the admin, Settigs/Reading/Blog pages show at most.

 

That’s it, very easy to implement.

Posted in Wordpress | 1 Comment

Magento – There has been an error processing your request FIX

There has been an error processing your request

Exception printing is disabled by default for security reasons.

Error log record number: 911585915504

A solution I found to this problem is by adding a php.ini file in the root of your magento installation, and adding the following code in it:

memory_limit = 256M
max_execution_time = 18000
magic_quotes_gpc = off
flag session.auto_start = off
zlib.output_compression = on
suhosin.session.cryptua = off
zend.ze1_compatibility_mode = off
extension=mcrypt.so
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so
zend_extension=”/usr/local/Zend/lib/Optimizer-3.3.9/php-5.2.x/ZendOptimizer.so”

Posted in Magento, Open Source for Web | 6 Comments

Remove value from input with jQuery

This jQuery code removes the value of a input text type when the user clicks on the input.


$(document).ready(function(){
$('input:text').each(function() {
var label = $(this).val();
$(this).focus(function() {
if($(this).val() == label) {
$(this).val('');
}
});
$(this).blur(function() {
if($(this).val() == '') {
$(this).val(label);
}
});
});
});
Posted in JavaScript | 1 Comment

Facebook app beginner code example

Since it was not so easy for me to get things up and running, I wanted to share it for other developers. This code gets all videos that are uploaded to a page. First you should download the php sdk from github.


<?php
require_once 'facebook.php';

$app_id = "226102437478452"; //Your application ID
$canvas_page = "http://apps.facebook.com/your_canvas_page/"; //Your canvas page
$secret = '1b919de960ba93165650c2385a5b1c7e'; //Your application secret

$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&amp;redirect_uri=" . urlencode($canvas_page);
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
} else {

//this uses the facebook object from facebook.php
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $secret,
));
$user_id = $facebook->getUser();

//page id
$page_id = '134501956646782';
$page_data = $facebook->api('/'.$page_id.'/videos/uploaded');

print_r($page_data);

}

?>
Posted in Facebook | 2 Comments

Albanian Fried Dough with cheese and squashes

Albanian Fried Dough in the pan
Ingredients
1 egg
1 teaspoon of salt
1 teaspoon of sugar
1 teaspoon of baking soda
400 gr flour
500 gr yoghurt
1 or 2 squashes
100 gr or more white cheese

Mix the egg with the yoghurt. Add the flour slowly and continue mixing. Cut the cheese in tiny pieces and put them in the mix. Grind the squashes and add them into the mix.
Continue mixing…
With a spoon, grab some of the mixture and put it in the hot cooking oil (I prefer olive oil).

The result:
Albanian Fried Dough

Posted in Cooking | 2 Comments

My ASUS G73SW Republic Of Gamers Laptop

A week ago I purchased for $1450 the ASUS G73SW 4.4Kg desktop replacement laptop and I love it.

It’s not a laptop you can travel with though.

 

 

Here are the main technical specifications:

  •  Processor: Intel® Core™ i7 2630QM Processor
  • RAM: 8Gb DDR3
  • HD: 1Tb
  • Optical Drive: Blu-Ray DVD Combo
  • Display: 17.3″
  • Graphics: NVIDIA® GeForce® GTX 560M 1.5Gb

 

Posted in Uncategorized | Leave a comment

My very first web site

This is the very first website I’ve developed in Joomla 1.5. I made some fixes because the site got hacked, the english version wasn’t working. I noticed that 2 installations of Joomla were used, one for each language :D . For the existence of multilanguage components? I didn’t know at that time. I’ve deleted the english version, was unuseful, then installed the Joomfish component, added the translations, and that’s it :) .

Posted in Diary | Leave a comment

First diary post

Just added the diary page. I created a page template which gets the posts from the “Diary” category and assigned it to the Diary page.

Posted in Diary | Leave a comment

Developing an Android App

I’ve got my Samsung Galaxy S2 a week ago, now I want to develop an app for it.
I am also reading a book along the way.

Posted in To Do List | 2 Comments

Quit Smoking

I hope this time I’ll quit for real :)

Posted in To Do List | 4 Comments