Jump to content
Sign in to follow this  
Balladeer

New TrueSite Template Beta

Recommended Posts

Trying to design a new template for my BoA Scenario Pages. This is what I have so far and I would like some feedback. I know the Next button links to a missing page. Haven't created a page for Beechford yet. I'm looking for broken links, odd displays, and suggestions for scenario stats, layout, or additions. Or just a thumbs up/thumbs down in general.

 

Thanks.

Share this post


Link to post
Share on other sites

fyi: i'm working on a new system for the scenario reviews that will make that ratings tab on the right a lot easier on your end.

 

on a design side i feel like having a tiny fixed-width detracts from it somewhat. I feel kind of silly scrolling an overflow:auto div when i have so much screen space that is just "the color purple". personal prefs though.

Share this post


Link to post
Share on other sites

The site looks good, it has an old-school look about it which fits in nicely. But you could change the high contrast (sky_blue against purple) of un-clicked links maybe ?

Share this post


Link to post
Share on other sites

@sy, yeah.. was being lazy because absolute positions are quicker to figure out than floats but I think I got it now. Shift-F5 if it still looks the same.

 

@BMA I'll look at other colors. Just want something obvious without making my eyes bleed. If you were to suggest a color what would you pick.

Share this post


Link to post
Share on other sites

I'd say any colour that doesn't glow like that, maybe the same shade of blue used for the hints' X markers.

 

Note : I felt this when I was browsing through the entire list, deciding what scenario to download. It probably isn't an issue when you come to the site to download just those scenarios you wanted.

Share this post


Link to post
Share on other sites

fyi: i'm working on a new system for the scenario reviews that will make that ratings tab on the right a lot easier on your end.

 

Let me know when you have this ready. I don't want to start transferring pages until the template is ready.

Share this post


Link to post
Share on other sites

The data will be exposed as such (I'm using Adrift as an example here):

 

In each CSR review, there will be a chunk of HTML embedded in it, as such:

<span data-csr-composite="eyJ0aXRsZSI6IkFkcmlmdCIsInRpZCI6MTIzMDcsInRhZ3MiOlsiYXZlcm51bSB1bml2ZXJzZSIsImJlZ2lubmVyIiwiY29tYmF0IGhlYXZ5Iiwic2hvcnQiXSwiYmdhc3AiOnsiNSI6MSwiNCI6MTMsIjMiOjIsIjIiOjAsIjEiOjB9fQ==" id="csr-composite">
Composite Score: ...
</span>

The data-csr-composite attribute contains encoded machine-readable data on the scenario. You can use a CSS selector to grab that information, and send it to a parser. Using QueryPath (which is basically jQuery for PHP), the following code will grab it:

<?php
$data = htmlqp($html, '#csr-composite')->attr("data-csr-composite");

This data is essentially a JSON object encoded using base64. You can decode it using the following PHP string:

<?php
$array = json_decode(base64_decode($data), true);

The JSON string will look something like the following (note that I am still developing the script to generate this, but it may change slightly as I (possibly) add more metadata about the scenario):

{
   "title": "Adrift",
   "tid": 12307,
   "tags": [
       "avernum universe",
       "beginner",
       "combat heavy",
       "short"
   ],
   "bgasp": {
       "5": 1,
       "4": 13,
       "3": 2,
       "2": 0,
       "1": 0
   }
}

Note that 'bgasp' is the abbreviation for the actual scenario stats. They are described in detail in this source config file. Basically, 5=best, 4=good, and so on down the line.

 

So, your solution will be to put this little function somewhere:

<?php // let's call this decode.php

require 'qp.php'; // Assuming QueryPath is somewhere in INCLUDE_PATH. May need to adjust.

/**
* NOTE: This function doesn't do much in the way of error handling. Will probably cause drama.
**/
function getPost($tid) {
 $url = "http://spiderwebforums.ipbhost.com/index.php?/topic/$tid-/";
 $html = file_get_contents($url);
 $data = htmlqp($html, '#csr-composite')->attr("data-csr-composite");

 return json_decode(base64_decode($data), true);
} // getPost

 

Then, once you've done that, you just need to simply include the following in each review page:

<?php
require '/path/to/decode.php';

$i = getPost(12307);
?>
<!-- html stuff here, yada yada -->
Best: <?php echo $i['bgasp']['5']; ?>
<!-- yada yada -->

 

Of course, with this data you can do a lot of stuff, look at this code:83 for a quick generator to list the "Composite Score" section

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×