Listing web projects (a suggestion)

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Listing web projects (a suggestion)

Postby akinola84 » 13. July 2010 13:22

Hi all!
I have been trying to find a way to display a list of the web project we developed in our Xampp environment. It's rather a piece of work trying to remember all the:....http://localhost/siteone, http://localhost/twosite, http://localhost/topwebb, http://localhost/tripweb, http://localhost/etcetera. That is assuming siteone, twosite, topwebb, tripweb, and etcetera are directories in your /opt/lampp/htdocs/ directory and are such that they are names of the root directory of web projects...etc.

Well, for my part, i came up with a little work around. This will require creating a projects.php in /opt/lampp/htdocs/ and modifying navi.php in /opt/lampp/htdocs/xampp/ and language files (in this case en.php) in /opt/lampp/htdocs/xampp/lang/.


en.php in /opt/lampp/htdocs/xampp/lang/
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//added the following line to the top of the file
$TEXT['navi-projects'] = "Projects";
$TEXT['txtNoProject'] = "No projects yet.<br />To create a new one, just create a directory in 'htdocs'.";
////////////////////////////////////////////////////////////////////////////////////////////////////////////


navi.php in /opt/lampp/htdocs/xampp/
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//added the following immediately after "WEBALIZER" link:<a class=n target=content onClick="h(this);" href=webalizer.php><?=$TEXT['navi-webalizer']?></a><br>
/////////////////////////////////////////////////
<!-- custom code --><a class=n target=content onClick="h(this);" href=/projects.php><?=$TEXT['navi-projects']?></a><!-- end of custom code -->
////////////////////////////////////////////////////////////////////////////////////////////////////////////


projects.php in /opt/lampp/htdocs/
////////////////////////////////////////////////////////////////////////////////////////////////////////////
<?php
include "xampp/langsettings.php";
//xampp HTDOCS directory i.e current directory
$dir = ".";
// List of directory that are included in /opt/lampp/htdocs by default and to be ignored
$projectsListIgnore = array ('.','..','xampp', 'webalizer');
// obtain project list by their directory names
$dirHandle = opendir($dir);
while ($directory = readdir($dirHandle))
{
if (is_dir($directory) && !in_array($directory,$projectsListIgnore)) //ignore "FILES" as well
{
$projectList .= '<li><a target="_top" href="'.$directory.'">'.$directory.'</a></li>';
}
}
closedir($dirHandle);
if (!isset($projectList))
$projectList = $TEXT['txtNoProject'];

//output to be displayed
$pageContents = <<< EOPAGE

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html lang="en" xml:lang="en">
<head>
<title>{$langues[$langue]['titreHtml']}</title>
<meta http-equiv="Content-Type" content="txt/html; charset=utf-8" />
<style type="text/css">
* {
margin: 0;
padding: 0;
}
html {
background: #F8E8A0;
}
body {
margin: 1em 10%;
padding: 1em 2em;
font: 80%/1.4 tahoma, arial, helvetica, lucida sans, sans-serif;
border: 2px solid #FB7922;
background: #fff;
position: relative;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
ul.projects {
list-style: none;
line-height: 24px;

padding-left: 22px;
}
ul.projects a {
padding:3px 4px;
color: #FB7922;
font-weight: bold;
text-decoration: none;
}
ul.projects a:hover {
color: #fff;

background-color:#FB7922;
}
</style>
</head>
<body>
<h2>{$TEXT['navi-projects']}</h2>
<ul class="projects">
$projectList
</ul>
</body>
</html>
EOPAGE;
echo "";
echo $pageContents;
?>
////////////////////////////////////////////////////////////////////////////////////////////////////////////



well..... someone can help improve on it...
akinola84
 
Posts: 2
Joined: 12. July 2010 11:22

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 21 guests