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> </table>
</div> </div>
</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> </body>
</html> </html>

View File

@ -14,10 +14,6 @@
* These can start with "#" to direct to a tag on the page, could be an internal * 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 * 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 * 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 * These associate in order ie the Tag $nav_names[3] will direct the user to
@ -26,7 +22,6 @@
*/ */
$isNav = true; $isNav = true;
$isrNav = true;
$nav_names = array( $nav_names = array(
'Home', 'Home',
@ -38,10 +33,6 @@
'https://github.com/Clortox', 'https://github.com/Clortox',
); );
//$nav_rname = 'Git this site!';
//$nav_rlink = 'https://github.com/Clortox/SimpleFileRepository';
/* Directory Variables /* Directory Variables
* *
* Each variable in $dir_dirs will be a listing * Each variable in $dir_dirs will be a listing
@ -74,6 +65,39 @@
'dir/books', '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 /* Convo
* *
* These are little tag lines that will appear on the header. * These are little tag lines that will appear on the header.

View File

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