01-04-2019
Ravinder,
Please write a PHP function to parse the $color[] array and create the string(2) to append in the badge alert text.
Hint: You need to read a $serialized_badges JSON string (which we will get from the user table and convert it to a PHP array using json_decode() then perhaps a foreach() loop to compare against the current $color[] array.
Or, you can do all this in Javascript by storing the badge[] js array serialized in localstorage, which is how I would do it I think.... No reason to do this in PHP, so I think best to do in Javascript.
3 More Discussions You Might Find Interesting
1. What is on Your Mind?
Today I mapped out the new badging system using FA icons, Beta 1 in no particular order except a 6 x 8 grid:
https://www.unix.com/members/1-albums215-picture991.png
The prototype HTML code for this layout:
<style>
.fa-badge-grid {
font-size: 1.5em;
}
.row {
... (38 Replies)
Discussion started by: Neo
38 Replies
2. What is on Your Mind?
Dear All,
Here is the current status of the badging system:
The Beta 1 phase of the new badging system is close to completion.
42 prototype badges have been "allocated"
6 prototype badge slots are held in reserve
The "alert you have new badges" prototype is running and is currently... (4 Replies)
Discussion started by: Neo
4 Replies
3. What is on Your Mind?
I have moved the bug badge out of reserve and into the main stream. Basically, I will assign a color level like the others, based on who has made a good actionable bug report for UNIX.COM. "Good" means screenshots, links, and even details from web dev tools our the HTML source code. So far,... (0 Replies)
Discussion started by: Neo
0 Replies
LEARN ABOUT PHP
v8js.__construct
V8JS.__CONSTRUCT(3) 1 V8JS.__CONSTRUCT(3)
V8Js::__construct - Construct a newV8Jsobject
SYNOPSIS
public V8Js::__construct TRUE ([string $object_name = "PHP"], [array $variables = array()], [array $extensions = array()], [bool
$report_uncaught_exceptions])
DESCRIPTION
Constructs a new V8Js object.
PARAMETERS
o $object_name
- The name of the object passed to Javascript.
o $variables
- Map of PHP variables that will be available in Javascript. Must be an associative array in format array("name-for-js" => "name-
of-php-variable"). Defaults to empty array.
o $extensions
- List of extensions registered using V8Js.registerExtension(3) which should be available in the Javascript context of the created
V8Js object.
Note
Extensions registered to be enabled automatically do not need to be listed in this array. Also if an extension has dependen-
cies, those dependencies can be omitted as well. Defaults to empty array.
o $report_uncaught_exceptions
- Controls whether uncaught Javascript exceptions are reported immediately or not. Defaults to TRUE. If set to FALSE the uncaught
exception can be accessed using V8Js.getPendingException(3).
RETURN VALUES
Returns a new V8Js context object.
PHP Documentation Group V8JS.__CONSTRUCT(3)