Archive for January, 2010

wordpress | No Comments | January 26th, 2010

Add this function to function.php file

function getImage($num) {
global $more;
$more = 1;
$link = get_permalink();
$content = get_the_content();
$count = substr_count($content, ‘
$start = 0;
for($i=1;$i<=$count;$i++) {
$imgBeg = strpos($content, ”);
$postOutput = substr($post, 0, $imgEnd+1);
$postOutput = preg_replace(‘/width=”([0-9]*)” height=”([0-9]*)”/’, ‘/width=”117″ height=”68″/’,$postOutput);
$postOutput = preg_replace(‘/alignright/’, ‘alignleft’,$postOutput);

$image[$i] = $postOutput;
if(stristr($image[$num],’‘.$image[$num].”“; }
$more = 0;

and call it as where you want to show image <?php getImage(‘1′); ?>  .. inside loop.

quick fix | No Comments | January 16th, 2010

add this code in your .htaccess file

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} .*jpe?g$|.*gif$|.*png$ [NC]

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !yoursiteurl\.com [NC]

RewriteCond %{HTTP_REFERER} !google\. [NC]

RewriteCond %{HTTP_REFERER} !live\. [NC]

RewriteCond %{HTTP_REFERER} !yahoo\. [NC]

RewriteCond %{HTTP_REFERER} !msn\. [NC]

RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]

RewriteRule .* – [F]

and replace this :: yoursiteurl with your site URL

Uncategorized | No Comments | January 7th, 2010

CGI server cant parse php in html pages with .htaccess

In that case we can use SSI (Server Side Includes).

you need to use SSI in your .html and htm files. There is an easy solution for this.
Just add the following line in your .htaccess file:

AddHandler server-parsed .html .htm

This line will tell the server to parse your .htm file as SSI and execute any SSI directives you have there.

The most common usage of SSI is to include the contents of an external file onto a page or across multiple pages on your site. Modify the external file, and all pages that have this file embedded is also updated with the modified information. For a site that uses the same header, navigational menu, or footer across pages, for example, this can save you countless time and energy. The syntax to embed the contents of an external file onto the current page is:

<!--#include file="external.htm"-->
<!--#include virtual="/external.htm"-->

Which one to use depends on where “external.htm” is located. The first command assumes that the file is located in the same directory as the document containing it while the second syntax uses an absolute reference to “external.htm” starting from your root HTML directory. Typically you’ll want to turn to the second syntax, as the external files to include most likely will be in a central directory while the pages including them are scattered across different directories.