Author Topic: In Development: PHP function to read CiT xml file  (Read 5685 times)

BitLoadR

  • Lieutenant
  • ***
  • Posts: 55
  • <F6> <F6> <F6> ...
In Development: PHP function to read CiT xml file
« on: October 26, 2011, 08:57:54 AM »
I'm working on a PHP function that reads the XML file from your CiT Data Feeds (http://cit.cohtitan.com/manage/feeds) and generates a list of characters. And if a character name is clicked it shows specific items for that character like name, level, origin, archetype, powers, biography.

Although still in beta and requiring some massive recoding, the 0.4 version works quite nicely.
This way it would be easy to implement the data from CiT into your own fansite and keep it up-to-date while playing.

When finished I'll offer the source code, PHP files and additional instructions on my own site.

You can see this beta in action here, but be aware that it currently shows my characters and is subject to change without notice.
« Last Edit: January 20, 2012, 07:18:44 AM by bitloader »
playing on Reunion as Star Jewel, Emberflair, Lumitia, Novaspark, Dawnshade, Mystfure, Ion Blaze, Heatstrike, more...

BitLoadR

  • Lieutenant
  • ***
  • Posts: 55
  • <F6> <F6> <F6> ...
Re: In Development: PHP function to read CiT xml file
« Reply #1 on: February 02, 2012, 02:02:26 PM »
*tiny bump*

The code works great!  :D
After some tweaks and killing a few bugs, the PHP code now correctly shows information read from the XML file.
I've added a function to the code that makes the app look for additional image files and text files containing extended biography information and (if found) replaces those items with the files it found on the server.

For example:
On my website I have a page that shows all the characters I own. For the sake of simplicity, there are only 2.

- One (let's call her Brawly Bird) is a level 40 brute with a lot of cool action photos and a biography spanning over 200 lines.
All basic information like XP, Inf, Level have been tracked using Sentinel, but a few of the action photos (taken via screenshots) are located in a folder on my webpage's server, and the extended biography is located in a simple txt file on that same server.

- The other (named iNewb) is a level 2 defender with only a profile photo and a biography sayin "I'm new! Help?!".
The profile photo has been uploaded to CIT and the bio has been pulled out of the game using Sentinel. (the standard procedure)

Now what does my app do when our visitor, let's call him "Mister G.", goes to my webpage and clicks on iNewb's button:
- the app loads the XML file from CIT
- speeds through its contents until it encounters the character name "iNewb"
- runs a quick for-next loop to extract the required data from the file (XP, Inf, Level, Bio, Avatars)
- checks if a separate avatar photo and bio file are available on my server (which they are not)
- shows this information in a (styled) table using the Bio and Avatar from CIT since it did not find separate files.

But what happens when Mister G opens the page for Brawly Bird:
- the app loads the XML file from CIT
- speeds through its contents until it encounters the character name "Brawly Bird"
- runs a quick for-next loop to extract the required data from the file (XP, Inf, Level, Bio, Avatars)
- checks if a separate avatar photo and bio file are available on my server (which they are)
- shows this information in a (styled) table using the Bio and Avatar found on my server.


If neither CIT nor the server have avatar or bio information, the app shows a message "no data found" or something similar.
Although this could be changed to anything you'd like.

With this function it is possible to upload photos of your characters (like action photos) to your server and have them displayed on your website instead of CIT's standard avatars, giving you the freedom to show different photos but up-to-date information tracked with Sentinel. And create a very in-depth biography of your characters, that surpasses the +/- 1000 characters allowed in the game.

I'm still working on a routine that will make the app pick a random photo out of a collection of photos for a character.

I'll post more updates when I can.

* by "photo" I actually mean any graphic that represents the character. Could be a screenshot, drawing, photo of a sculpture, a logo, or its name in very cool fonts.
« Last Edit: July 10, 2012, 11:21:16 AM by bitloader »
playing on Reunion as Star Jewel, Emberflair, Lumitia, Novaspark, Dawnshade, Mystfure, Ion Blaze, Heatstrike, more...

BitLoadR

  • Lieutenant
  • ***
  • Posts: 55
  • <F6> <F6> <F6> ...
Re: In Development: PHP function to read CiT xml file
« Reply #2 on: July 10, 2012, 11:26:46 AM »
- New update -

Working on the Json data files. Found a way to "dissect" the data and put it in arrays.
Working example: http://bitloader.comuf.com/pub/cohjson.php
(still improving on code)

I'd like to know if the 'data feed code' option is working properly. So I politely ask that some of you
test the program by inputting your own data feed code as found on http://cit.cohtitan.com/manage/feeds (when logged in).
« Last Edit: July 10, 2012, 11:51:45 AM by bitloader »
playing on Reunion as Star Jewel, Emberflair, Lumitia, Novaspark, Dawnshade, Mystfure, Ion Blaze, Heatstrike, more...

eabrace

  • Titan Moderator
  • Elite Boss
  • *****
  • Posts: 4,291
Re: In Development: PHP function to read CiT xml file
« Reply #3 on: July 10, 2012, 01:42:12 PM »
With just a brief look and a few extra clicks on links for good measure, my data feed (cizmfptCE2PjU) appears to work with that.
Titan Twitter broadcasting at 5.000 mWh and growing.
Titan Facebook

Paragon Wiki admin
I was once being interviewed by Barbara Walters...In between two of the segments she asked me..."But what would you do if the doctor gave you only six months to live?" I said, "Type faster." - Isaac Asimov

Cannonfodder

  • Lieutenant
  • ***
  • Posts: 84
Re: In Development: PHP function to read CiT xml file
« Reply #4 on: July 10, 2012, 03:24:27 PM »
Plugged in my feed.  Clicked on a couple.  Seemed to work fine.

(ciwoBFjlZFCAs)
--Jason
@Cannonfodder
Victory:  Cannonfodder 50 Inv/SS
Virtue:  Pravda 50 Bots/FF
The Hall of Justice/The Hall of Doom /chanjoin "Victory Badges" /chanjoin "Virtue Badges"