PHP Classes

File: example2.php

Recommend this page to a friend!
  Classes of Full name   x64 Feeds Generator   example2.php   Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: This is an example giving the data as a file database
Class: x64 Feeds Generator
Generate cached XML feeds using templates
Author: By
Last change: Updated for new changes to the class.
Date: 18 years ago
Size: 1,265 bytes
 

Contents

Class file image Download
<?php
require_once("x64_feeds.php");

class
wrapper extends x64_feeds
{
    var
$get_data=true;

    function
wrapper($database='',$path='./')
    {
       
$this->x64_feeds($database,$path);
    }

    function
get_data()
    {
        for (
$n=0;$n<15;$n++)
        {
           
$data[$n]="title="."Test... #$n&author=".((mt_rand(0,1))? "Me&mail=me" : "you&mail=you")."@mydomain.com&link=".urlencode("http://mysite.com/index.php?id=$n")."&description=".urlencode("This is ".((mt_rand(0,1))? "a testing" : "simple").((mt_rand(0,1))? " entry" : " string"))."&category=".((mt_rand(0,1))? "foo" : "bar")."&published=".urlencode(date('D, d M Y H:i:s T',time()-(mt_rand(0,3600))))."&id=$n";
        }
        return
$data;
    }
}


$use_cache= true;
$cache_expire=20*60;
$query_type="path";
$path='example2.php';

$title="x64 Feeds Generator Example #2";

$q=$_SERVER['QUERY_STRING'];
$format='';

if(
$query_type=='path')
{
   
$format=substr($q,0,strlen($q)-4);
}
else
{
    if(isset(
$_GET["format"]))
   
$format=$_GET["format"];
}

if(
strstr($format,"."))
die(
'ERROR: Invalid Query');

$feeds_g=new wrapper("example2");
$check=$feeds_g->init($format);
$feeds_g->set_data($title);
$feeds_g->setup_generator(10,$path,$query_type,$use_cache,$cache_expire);

if(!
$check)
die(
'ERROR: Invalid/Unknow Format');

$feeds_g->auto_process();

?>