VaultNetwork.netVault Network Boards
Author Topic: Code formatting [Locked]
-Prismatic-  1 star
Title: Owner
Posts: 50
Registered: May 26
30sf5ms.gif
HTML:

<!DOCTYPE html>
<html>
<head>
<title>CoreBB Test Page</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Vault Network Boards</h1>

<div class="forum-row">
<a href="/board/1/">General Discussion</a>
<span class="topic-count">42 topics</span>
</div>

<p>This is a sample HTML block with <strong>bold text</strong> and a link.</p>
</body>
</html>




PHP:

<?php
function format_username($username)
{
$username = trim($username);

if ($username === '') {
return 'Guest';
}

return htmlspecialchars($username, ENT_QUOTES, 'UTF-8');
}

$users = ['-Prismatic-', 'Admin', '<script>alert("x")</script>'];

foreach ($users as $user) {
echo format_username($user) . "<br>\n";
}
?>




Python:

class Notification:
def __init__(self, user, message):
self.user = user
self.message = message
self.unread = True

def mark_read(self):
self.unread = False

notifications = [
Notification("-Prismatic-", "Someone mentioned you in a thread."),
Notification("Admin", "Your topic was moved.")
]

for note in notifications:
status = "NEW" if note.unread else "READ"
print(f"[{status}] {note.user}: {note.message}")





CSS:

.forum-row {
background: #c0c0c0;
border-bottom: 1px solid #808080;
font-family: Verdana, Arial, sans-serif;
font-size: 12px;
padding: 4px;
}

.forum-row a {
color: #0000cc;
font-weight: bold;
text-decoration: underline;
}

.topic-count {
float: right;
color: #333333;
}




JavaScript:

function markNotificationRead(id) {
const row = document.getElementById("notification-" + id);

if (!row) {
return false;
}

row.classList.remove("unread");
row.classList.add("read");

return true;
}

markNotificationRead(42);


 

-----signature-----
_____.........--------===*
The More You Know.
Take what you want from this life. It's yours.

VaultNetwork.net is an independently operated community forum and is not affiliated with, endorsed by, or technically based on IGN, GameSpy, FilePlanet, GameStats, or the former IGN/GameSpy Vault Network.
References to VaultNetwork.net mean this site/domain. VNBoards-style presentation is a visual homage only. By using this site, you agree to the forum rules.