LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-15-2016, 09:42 AM   #1
StorageDon
LQ Newbie
 
Registered: May 2013
Posts: 10

Rep: Reputation: Disabled
Hide HTML Division if directory is missing


I have a simple home page, I'd like to modify.

It has four division that I would like to independently hide if a directory it needs is missing. That way the user only sees what's currently available.

Here is the present state of the html file:

<html>
<head>
<style>
div {
background-color: lightgrey;
width: 500px;
height: 150px;
border: 5px solid green;
padding: 10px;
margin: 25px;
vertical-align: middle;
}
img {
background: #3A6F9A;
vertical-align: middle;
}
</style>
</head>
<body>
<div style="width: 100%; height: 75px; font-size: 40px; font-weight: bold; text-align: center; background-color: lightgrey;">
Welcome to the Repo...
</div>
<p>
if (System.IO.File.Exists("./rhel"))
{ <div>
<a href="./rhel/"><img border="0" alt="Red Hat" src="redhatOSicon.png"></a>
</div>
<p>
} <div>
<a href="./centos/"><img border="0" alt="Fedora Server" src="centosOSicon.png"></a>
</div>
<p>
<div>
<a href="./fedoraserver/"><img border="0" alt="Fedora Server" src="fedoraOSicon.png"></a>
</div>
<p>
<div>
<a href="./debian/"><img border="0" alt="Debian" src="debianOSicon.png"></a>
</div>
<p>
<a href="/">From the begining...
</a>
</body>
</html>

Thanks in advance for your help.
 
Old 07-15-2016, 12:10 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Code:
if (System.IO.File.Exists("./rhel"))
Looks like you're already doing that?

Also, the whole thing looks to me like it could probably be replaced with Apache or NGinx's directory indexes.

Last edited by dugan; 07-15-2016 at 12:14 PM.
 
Old 07-15-2016, 02:24 PM   #3
StorageDon
LQ Newbie
 
Registered: May 2013
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
Code:
if (System.IO.File.Exists("./rhel"))
Looks like you're already doing that?

Also, the whole thing looks to me like it could probably be replaced with Apache or NGinx's directory indexes.
Dugan;
Thanks for the reply.
I am using Apache, on a fedora server 23.
I'm just trying to get a little fancy.
The code I had in there was wishful thinking. it obviously does not work when you view the web page. (see attachment)
Attached Thumbnails
Click image for larger version

Name:	webpage.jpg
Views:	11
Size:	237.1 KB
ID:	22471  
 
Old 07-15-2016, 07:58 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
If you want something fancy, give this a try:

https://larsjung.de/h5ai/

Or my own project for nginx:

https://github.com/duganchen/ngx-responsiveindex

If what you're currently serving up is an HTML file and not, say, a PHP file, then your approach won't work. You need some server-side logic for this.

Last edited by dugan; 07-15-2016 at 08:00 PM.
 
Old 07-16-2016, 01:40 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by dugan View Post
If what you're currently serving up is an HTML file and not, say, a PHP file, then your approach won't work. You need some server-side logic for this.
what i thought.
using php would be the most common approach, i think.
if that is new to you, get aquainted!
https://en.wikipedia.org/wiki/PHP
http://www.w3schools.com/PHP/php_intro.asp
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a HTML page to hide the running process of software LinpusKelvin Linux - Newbie 4 07-08-2010 05:49 AM
Hide index.html, dir list before authentication in apache shan_nathan Linux - Server 2 05-13-2008 10:50 PM
help on hide display on HTML antony_csf Programming 2 10-19-2004 08:12 PM
How to hide your HTML code (funny) boreo General 6 12-16-2003 11:45 PM
missing html files in my home directory scottsteib Linux - Newbie 0 07-29-2003 09:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration