Add Link Tree

This commit is contained in:
Clortox 2021-01-04 20:34:14 -05:00
parent 5221e41a5e
commit 2b7a9a6dd4
3 changed files with 72 additions and 16 deletions

View File

@ -63,6 +63,38 @@
</table>
</div>
</div>
<?php
if($isTree){
echo <<< cardHead
<div class="card bg-dark text-white ml-4 mr-4">
<div class="card-header">
cardHead;
echo '<h2>' . $treeName . '</h2>';
echo <<< tableandcard
</div>
<div class="card-body">
<table id="treeTable" class="display table text-white">
<thead>
<tr>
<th>Link</th>
<th>Url</th>
</tr>
</thead>
<tbody>
tableandcard;
foreach($tree_names as $i=>$currentLink){
echo '<tr>';
echo '<td><a href="' . $tree_links[$i] . '">'
. $currentLink . '</a></td>';
echo '<td>' . $tree_links[$i] . '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
echo '</div>';
echo '</div>';
}
?>
</body>
</html>

View File

@ -14,10 +14,6 @@
* These can start with "#" to direct to a tag on the page, could be an internal
* link by using "/listing.php?folder=SomeFolder", or could be an external site
*
* $nav_rname and $nav_rlink are for a link on the right side of the nav bar.
* This link is by default an ad for this repo, however you can disable it by
* setting $isrNav to false, or change it to advertise anything you choose!
*
* The navbar can be disabled by changing isNav to false
*
* These associate in order ie the Tag $nav_names[3] will direct the user to
@ -26,7 +22,6 @@
*/
$isNav = true;
$isrNav = true;
$nav_names = array(
'Home',
@ -38,10 +33,6 @@
'https://github.com/Clortox',
);
//$nav_rname = 'Git this site!';
//$nav_rlink = 'https://github.com/Clortox/SimpleFileRepository';
/* Directory Variables
*
* Each variable in $dir_dirs will be a listing
@ -74,6 +65,39 @@
'dir/books',
);
/* Link Tree
*
* My use case for this program is to be a NAS/Portal Page for my network,
* and due to the ammount or raspberry pis and other devices running web
* interfaces, I figured a link tree would be very useful
*
* You can disable this if you so choose, however for those who tend
* to run their own personal servers I find this to be very useful
*
* Each varaible in $tree_names will be a listing under the OtherSites header
* Each varaible in $tree_links will be a link that can be chosen
* $treeName will be the header all of the linktree card on the main page
*
* The entire tree can be disables by setting $isTree to false
*
* These associate in order ie the entry $tree_names[3] will have the link
* $tree_links[3]
*/
$isTree = true;
$treeName = "Local Network";
$tree_names = array(
'Ender 3',
'CNC',
);
$tree_links = array(
'http://192.168.1.111',
'http://192.168.1.100:8000',
);
/* Convo
*
* These are little tag lines that will appear on the header.

View File

@ -1,7 +1,6 @@
<?php
$clientip = $_SERVER['REMOTE_ADDR'];
$serverip = $_SERVER['SERVER_ADDR'];
?>
<header>
@ -16,14 +15,15 @@
if($isNav){
echo '<nav class="navbar navbar-expand-lg
navbar-dark border border-secondary">';
foreach($nav_names as $index=>$name){
echo '<a class="navbar-brand" href="' . $nav_links[$index] . '">'
. $name . '</a>';
}
echo '<ul class="nav navbar-nav">';
foreach($nav_names as $index=>$name){
echo '<li class="navbar-brand"><a href="'
. $nav_links[$index] . '">'
. $name . '</a></li>';
}
echo '</ul>';
echo '</nav>';
}
?>
</div>
</header>