Mar 29

First you need to specify character set for HTML output.. in your page header add:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

in PHP you can use (this line must be first in your code):

<?php header("Content-type: text/html; charset=utf-8");?>

then you need to write a .htaccess in your root dir of your website:

# Set httpd charset to utf-8
AddDefaultCharset On
AddDefaultCharset utf-8
# Set php charset to utf-8 and setup mbstring (you may need to install mbstring module)
php_value default_charset utf-8
php_value mbstring.internal_encoding utf-8
php_value mbstring.func_overload 7

 

more info for romanian users at:
http://www.webdesignbox.ro/utf-8-in-paginile-web-diacritice-caractere-speciale-suport-multilingv

written by MG \\ tags: , , ,

Nov 21

Use query_posts() and pagination

These two lines of code basically use the WordPress query_posts()
function to exclude posts in a certain category. The first line of code
fixes the pagination issue of all posts being displayed on all pages.
Again, let’s say that we want to exclude all posts from the category
with an ID of 8 from our index page. Simply place the following code in
your index.php file before this line <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

1 <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
2  query_posts("cat=-8&paged=$paged"); ?>

Issues with this method:

This method will remove posts that are ONLY in the
excluded category. If a post is in the excluded category as well as
another category they will still show up on the home page.

written by MG \\ tags: ,

Aug 06

<?php
//get current month for example
$beginday=date(“Y-m-01”);
$lastday=date(“Y-m-t”);

$nr_work_days = getWorkingDays($beginday,$lastday);
echo $nr_work_days;

function getWorkingDays($startDate, $endDate){ Continue reading »

written by MG \\ tags: , ,

Jan 07

Error:

/download/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame_toGDImage’:
/download/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
/download/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/download/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/download/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame_ffmpeg_frame’:
/download/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1

Solution:

1. Open the file “/ffmpeg-php-0.5.0/ffmpeg_frame.c”

1. Replace all PIX_FMT_RGBA32 with PIX_FMT_RGB32

written by MG \\ tags: , , , ,