FuzzyBearBTC / PeercoinBlockExplorer

Peercoin Block Chain Viewer - written in php and used JSON RPC calls
http://blockexplorer.peercointalk.org/
6 stars 32 forks source link

Clean Up code #2

Closed FuzzyBearBTC closed 9 years ago

FuzzyBearBTC commented 10 years ago

Clean up code as there are features no longer used or commented out lines that do not need to be ther

FuzzyBearBTC commented 10 years ago

danbartram css cleanup done and labels instead of spans

danbartram commented 10 years ago

Organising

We could create directories for different item categories such as imgs for images (like the header banner) and css for CSS.


Models

I was thinking we could move the bc_daemon.php functions into a class, so that it's a lot cleaner to use.

Instead of the function being available in the global scope, you could replace:

getblockhash("123abc....");

With something like:

$Daemon->getBlockHash("123abc....");

This would just make the code a lot tidier and less cluttered than a big file with lots of functions (it's not bad at the moment, but might be a pain if it grows much).


Views

The other improvement we could do is creating a views folder which contains templates, like some functions do now in bc_layout.php.

Instead of running a function like site_footer(); which fires off a lot of echo statements, we could put pretty HTML code in separate view files.

Example:

views/footer.php

<div id="footer">
    <span>Example footer content by: <?php echo $username; ?></span>
</div>

Or create a View class which you can use like so:

$params["username"] = "Admin";

$View->load("footer", $params);

Both of those ideas sound good to you?