Jump to content

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.



Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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: ...

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:

$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:

$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",
       "combat heavy",
   "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:

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...