Archive for March, 2009

Karaoke

Wednesday, March 25th, 2009

http://zazz.bg/channel:1552

http://www.karaokeparty.com/en/song/90/katy-perry/i-kissed-a-girl

OpenX issue with Pear

Monday, March 23rd, 2009

OpenX is comming with its own PEAR installation.

If your hosting company has preinstalled PEAR for you you might got the error

PHP Fatal error:  Cannot redeclare _pear_call_destructors() (previously declared in /usr/share/php/PEAR.php:765) in /home/…/ads/openx-2.6.4/lib/pear/PEAR.php on line XXX

To solve this make .htaccess file in the webroot of OpenX  – dont put the .htaccess in your web root.  Here is the contents of .htaccess :

php_value include_path ".:/home/domains/guda/ads/a/lib/pear"


You must enable AllowOverride in your apache configuration

 <Directory /home/domains/guda/cenite.com/openx_webroot>
      AllowOverride all
  </Directory>

Ref: https://developer.openx.org/jira/browse/OX-1006
http://forum.openx.org/index.php?showtopic=503420381

WordPress solution

Sunday, March 22nd, 2009

Limit the index page of your website to show only posts from certain category

The right place for this code is in index.php

  <?
   // query all the posts for each cat
 query_posts("cat=17"); // &showposts=2
  ?>
  <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

      <?php
        // http://codex.wordpress.org/Conditional_Tags
        // This is my second best choice! but with query_posts is nicer!
        // if (!in_category('17') && is_home()) continue;

      ?>

How to display Posts only directly connected to a category (no subcategories)

(more…)

Managing your own ads/blocks with OpenAds

Sunday, March 15th, 2009

I want to track my own blocks of banners with OpenAds.

Also those blocks must be embeded in the page – so iframe is not a solution.

What I want is to have OpenAds to trigger and decide which ads block to display.

What I have done is to create a text add , take the local (php) invocation code and put it in the place where the add will be displayed. Also I have made some modifications in the original include PHP code – strip the escaping and keeping the tracking html code.

<?php
  //<!--/* OpenX Local Mode Tag v2.6.4 */-->

  define('MAX_PATH', '/home/domains/guda/ads/openx-2.6.4');

  if (@include_once(MAX_PATH . '/www/delivery/alocal.php')) {
    if (!isset($phpAds_context)) {
      $phpAds_context = array();
    }
    $phpAds_raw = view_local('', 4, 0, 0, '', '', '0', $phpAds_context, '');
  }

 if (!empty($phpAds_raw['html'])) {
	$openx_tracking = "";
	$code = preg_replace_callback('/(<div.*?<\/div>)/', create_function(
			'$matches',
			'global $openx_tracking; $openx_tracking = $matches[0];  return "";'
		), $phpAds_raw['html']);

	$code = html_entity_decode($code, ENT_QUOTES);

	ob_start();
	$payed_company = array();
	eval($code);
	$my_own_content = ob_get_contents();
	ob_end_clean();

	echo $my_own_content;
	echo $openx_tracking;
  }
?>

Notice that the code is slightly changed.

And here is the text Ad content:

$payed_company = array("id" => "3617", "title" => '', "payed" => true);
include($_SERVER{DOCUMENT_ROOT}."/panels/payVitrina.php");

As you see this way you can “connect” the ads for a company with certain element from your page.

With this code you will be able to track the impressions of your block code.

Any help on the the tracking of the clicks will be welcome.

Wonderful XPath Tutorial

Thursday, March 12th, 2009

It is total time saving to learn XPath from this tutorial – fast and not like the USA style books.

http://www.zvon.org/xxl/XPathTutorial/General/examples.html

I have made a mirror on the tutorial because I aways forgot XPath

mirror