Fotobunny: LiveJasmin(AWE) XML Feed Decoder

LiveJasmin(AWE) XML Feed Decoder

Posted on 10/12/2009

Overview

My XML decoder allows you to embed any profile data from LiveJasmin in your own web pages.

You may also define a list of favourite models which may wel be either models you wish to promote or just models that you feel have more chance of getting someone to sign up and hence make you money.

A simple demo is running on LiveBunnyGirls where it is displaying a who's online now photo grid. You may use the script in any number of PHP pages and with as many different templates as you need. You have the full data from a model's profile available to you, including photos. The templates use the Smarty template engine.

Contact me at webmaster at fotobunny.com if you wish to purchase a copy. Alternatively you will get the script for free if you sign up under my affiliate id

The script comes with a set of example PHP scripts and Smarty templates, so you could get going by simply installing and adding a single line to your existing page...

This page goes through the various ways you can use the script

Installation

  • unzip the archive file somewhere outside your webroot for security
  • you will then have a directory called awesome containing these directories:
    • awesome/templates
    • awesome/examples
    • awesome/scripts
  • edit the file awesome/config.inc to insert your affiliate id in AWE_AFFID and optionally tweak these other values
    • define('AWE_AFFID', 'fotobunny');
    • define('AWE_PROGRAM', 'REVS');
    • define('AWE_LANDINGPAGE', 'freechat');
    • define('AWE_SITE', 'jsm');
  • you can add any number of favourite models to config.inc by adding them to the array 'models' in the following format:
$_AWESOME['models'] = array
(
  'modelnick1' => 1,
  'modelnick2' => 1,
  'modelnick3' => 2,
  'modelnick4' => 5,
);
  • your favourite models will always be displayed if online and in order of rank from 1 upwards. If you do not care about the order they are displayed in you can just assign them all the same rank as follows:
$_AWESOME['models'] = array
(
  'modelnick1' => 1,
  'modelnick2' => 1,
  'modelnick3' => 1,
  'modelnick4' => 1,
);
  • make sure the script is able to write create the directory cache. It will create the following directories beneath it:
    • awesome/cache/a/aa through awesome/cache/z/zz
    • awesome/cache/smarty
    • awesome/cache/smarty/templates_c
    • awesome/cache/smarty/cache

Setup Your Templates

The script comes with a few templates that should be good enough to start with. You can use any Smarty syntax in your templates and have available any model data that exists in the who's online now light feed for non-favourite models and full profile xml feed for favourite models.

These are some example templates:

mini_profile.tmpl

<table>
  <tr>
    <td>
       <a href="{$link}" 
          alt="{if $status eq 'Online'}Chat with {$performerid} Now!{else}View {$performerid}'s profile{/if}" 
          title="{if $status eq 'Online'}Chat with {$performerid} Now!{else}View {$performerid}'s profile{/if}" 
          target="_blank">
          <img src="{$picture}" width="160" height="120" border="0">
      </a>
    </td>
  </tr>
  <tr>
    <th><small>{$performerid}</small></th>
  </tr>
  <tr>
    <td align="center">
      {if $status == 'Online'}<b><small>Online Now!</small></b>{else}<small>offline</small>{/if}
    </th>
  </tr>
</table>

small_profile.tmpl

<table width="440">
  <tr>
    <td align="center">
      <a href="{$link}" target="_blank">
        <img src="{$picture}" width="200" border="0">
      </a>
    </td>
  </tr>
  <tr><td align="center"><h2>{$performerid} is {$status}</h2></td></tr>
  <tr><td>{$bio}</td></tr>
</table>

profile.tmpl (extract)

Nickname: {$screenname} <br>
Age: {$age} <br>
Sex: {$sex} <br>
Sex preferences: {$sexpref} <br>
Height: {$height} <br>
Weight: {$weight} <br>
Breast size: {$breastsize} <br>
Hair color: {$haircolor} <br>
Hair length: {$hairlength} <br>
Eye color: {$eyecolor} <br>
Build: {$build} <br>
Race: {$ethnicity}


Setting up your PHP Pages

Each page you wish to embed model's data within needs to include the file awesome.inc as follows:


require_once("path-to/awesome.inc");

So if your home directory contains two sub directories awesome with the script and public_html containing your web root you would just need to embed:


require_once("../awesome.inc");


Embedding Model Data

You have 3 options. You can either embed data as:

DescriptionPHP CodePHP Example
a single model awe_single_model(modelnick, template); awe_single_model('xAnnax', 'profile.tmpl');
a list of models awe_models(count, template); awe_models(8, 'small_profile.tmpl');
a grid of models awe_models_grid(rows, cols, template); awe_models_grid(10, 8, 'mini_profile.tmpl');

The calls may be mixed and matched on the same page, no model will appear twice.


Selecting the Models to display

Any favourite models who are online will appear first in the order you have defined in config.inc. If you need to display more models than you have online favourite models available the rest of the models are chosen as follows:

DescriptionPHP Code
Only display favourite models who are online awe_show_models(AWE_ONLINE_FAV);
Pad with favourite models who are offline awe_show_models(AWE_FAV);
Pad with any online models awe_show_models(AWE_ONLINE);

Example:


<?php
awe_show_models(AWE_ONLINE);
awe_show_grid(10, 8, 'mini_profile.tmpl');
?>


Optional Settings

Some other settings are available in config.inc, the two most useful ones affect how long the script retains a cache of model data before redownloading. In normal use you won't need to change them.

NameValueDesciption
AWE_CACHE_MAXAGEsecondshow long to keep the whosonline now cache. never set to 0 as this means never expire the cache
AWE_PROFILE_CACHE_MAXAGEsecondshow long to keep the full profile cache for a favourite model. 0 means only ever download once

Posted by | tags | Posted on 10/12/2009