PDA

View Full Version : Custom XML like tags...?


BulForce
07-18-2005, 05:30 AM
Hi everybody,

I want to create a custom template tags, for example <phpdig:advertisments/>

I have add the following code to my search.php file

After:

else {
die("Cannot find search_function.php file.\n");
}


added this lines:

if (is_file("$relative_script_path/libs/advertise_functions.php")) {
include "$relative_script_path/libs/advertise_functions.php";
}
else {
die("Cannot find advertise_functions.php file.\n");
}


I have place this code in advertise_functions.php

<?php include('../phpadsnew.inc.php'); ?>


The phpadsnew.inc.php is requered from the third part advertise server, in order to serve ads. This file must be included on any page that the ads will be shown. And then on the places where the must be shown i must place this code:

<?php
if (@include('../phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('', 3, '', '', '1', $phpAds_context);
$phpAds_context[] = array('!=' => 'bannerid:'.$phpAds_raw['bannerid']);
echo $phpAds_raw['html'];
}
?>

I have try to make this by just simply put the code in the template file, but it was not parsed by the server and the output was the code itself. So i want to make it like <phpdig:advertisment> and place this tag on the places where the ads must appear.

If anyone know how to make this, please share with me. Also this will be HOWTO for creating and other custom tags.

Thank you.

Charter
07-18-2005, 04:56 PM
http://www.phpdig.net/forum/showthread.php?t=74
http://www.phpdig.net/forum/showthread.php?t=348