All pastes #805290 Raw Edit

index.php, facnav.php

public php v1 · immutable
·published 2007-12-04 05:27 UTC
rendered paste body
index.php<!-- NOTE! Before switching over to new intranet, remember to change the absolute links to the php include files! --><?php	echo '<?xml version="1.0" encoding="utf-8"?>';	require 'http://web1.riversideg-h.schools.nsw.edu.au/intranet-new/scripts/include.php';?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!-- InstanceBegin template="/Templates/Student Intranet.dwt.php" codeOutsideHTMLIsLocked="true" --><head><!-- InstanceBeginEditable name="doctitle" --><!-- InstanceEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="stylesheet" type="text/css" href="../../../studentintranet.css"><!-- InstanceBeginEditable name="head" --><?php	//include('http://web1.riversideg-h.schools.nsw.edu.au/intranet-new/scripts/facnav.php');	include(dirname(__FILE__).'/scripts/facnav.php');	$title = getFoldernameArray("Faculties", "Faculties");	var_dump($title);/*	if ($title)	{	echo '<title>';	foreach ($title as $word)	{		echo $title;	}	echo '</title>';	}	else echo '<title>Riverside Girls High School</title>';*/?><!-- InstanceEndEditable --></head><body><div id="page">     <div id="header">         <div id="topbox"><h1> Student Intranet </h1></div id="topbox">        <table cellspacing="0" id="intranetnav">        <tr> 			<td><a href="http://web1.riversideg-h.schools.nsw.edu.au">Home</a></td>			<td><a href="../../Faculties/">Faculties</a></td>			<td>Rspace</td>			<td><a href="../../../SRC/">SRC</a></td>			<td><a href="/gallery">Photos</a></td>			<td><a href="http://portal.det.nsw.edu.au">Portal</a></td>			<td><a href="http://web2.riversideg-h.schools.nsw.edu.au/netstorage">My Files</a></td>        </tr>        </table id="intranetnav">    </div id="header">        <div id="content">         <div id="randomimgs" align="center">         <?php			include 'http://web1.riversideg-h.schools.nsw.edu.au/intranet-new/scripts/randomimgscript.php';            ?>        </div id="randomimgs">		               <div id="rightlinks">		<?php			include 'http://web1.riversideg-h.schools.nsw.edu.au/intranet-new/scripts/imslinks.php';        ?>		</div id="rightlinks">        <div id="stuff">		<!-- InstanceBeginEditable name="stuff" -->		<h2>Careers</h2>        <ul>        	<li><a href="job_searching.doc">Using The Internet for Job Search</a></li>			<li><a href="TVET Courses/NSI Course Guide 2006.doc">TVET Courses</a></li>			<li><a href="sex-discrimination-act.pdf">Sex Discrimination Act</a></li>            <li><a href="podcasts/">Podcasts</a></li>        </ul>      <!-- InstanceEndEditable -->        </div id="stuff">    </div id="content"></div id="page"></body><!-- InstanceEnd --></html>facnav.php<?php/* This script is meant to be a flexible breadcrumbs script for the student intranet. * Breadcrumbs are nav, eg. Home - Faculties - English (etc.) * It basically reads the URL/path and makes it look pretty. * * This script can just be included using php include() in the ... hrm. * Ideally it should sit above the random images, in the randomimgs div but that's not open for editing. May need to fix that... * Perhaps it can also be in the page title? * Also, it's not sitting where it will eventually be sitting - perhaps createCrumbs can return a 2d array, * with folders matched to folder path hrmm. * Need to fix the way it handles non-existence of root folder - maybe throw an error. * Need to append the current file name to the end of it all in some way, perhaps? The filename isn't included in path. *//** * Reads the directory structure of where the page resides, * changes it to the desired 'root', * splits the folders into individual array items * and replaces the root folder name with "Home". * * @param root The name of the folder that the user will see as the "Homepage" of the site * @param homedispname What you want the user to see as as the "Homepage" link. Defaults to "Home". * @return folders An array of strings that can be used as individual breadcrumbs, or -1 if it didn't exist. */function getFoldernameArray($root="intranet-new", $homedispname="Home")//function getFoldernameArray($root, $homedispname){	//everything before the folder with the name defined in user-given $root will be stripped out of the string	$path = getcwd(); 	//echo "Full path: ".$path."<br />\n";	if (substr_count($path, $root) < 1) //check $root is actually part of the path of this current page	{		//echo "The root folder doesn't exist in this path. FAIL!<br />\n";		return -1;	}	$path = substr($path, stripos($path, $root)); //strip out everything before the declared root	//echo "Rooted path: ".$path."<br />\n";	$homedpath = substr_replace($path, $homedispname, 0, strlen($root)); //replace root folder name with 'Home'	//echo "Homed path: ".$homedpath."<br />\n";	$folders = explode("/", $homedpath);	//echo "Breadcrumbs: ".$folders."<br />\n";		if ($folders)	{		returna($folders);	}	else	{		return($homedispname);	}}/** * This function returns an array of relative paths, for the anchors of the breadcrumbs. * @param root The first folder, root of the relative paths. * @return folderpaths An array of relative paths, or -1 if the root specified doesn't exist */function getFolderpathArray($root="intranet-new")//function getFolderpathArray($root){	$path = getcwd();	if (substr_count($path, $root) < 1) //check $root is actually part of the path of this current page	{		//echo "The root folder doesn't exist in this path. FAIL!<br />\n";		return -1;	}	$path = substr($path, stripos($path, $root)); //strip out everything before the declared root		$varpath = $path;}?>