Forum Moderators: coopster

Message Too Old, No Replies

php include ...Paths?

Newbie...results = blank page

         

russgri

1:39 am on Feb 1, 2003 (gmt 0)

10+ Year Member



My efforts to convert from frames to templates are sadly lacking
Probably missing some shorthand that I think is code.

//paths.inc
<?php
$baseDir = '/www'; // root directory
$includesDir = 'includes/'; // includes directory
$cssDir = 'css/'; // css directory
$jsDir = 'js/'; // js directory
?>
-----
//Shared Server /home/username/www
//contents of /www
css/
stylesheet01.css
stylesheet02.css
images/
image01.gif
image02.gif
includes/
fileHead.inc // [1]
pageFooter.inc // [2]
pageHead.inc // [3]
index.php // [4]
js/
script01.js
script02.js
paths.inc // [5]

russgri

1:43 am on Feb 1, 2003 (gmt 0)

10+ Year Member



//I left some out
=================
[1] fileHead.inc
==================

<html>
<head>
<title>myRoot.net ¦ <?php echo($title);?></title>
<?php
for ($i=0; $i<count($css); $i++) {// loop through $css array
echo("<link href=\"$cssDir$css[$i]\" ##TRUNCATED CSS LINK## >\n");
}
for ($i=0; $i<count($js); $i++) {// loop through $js array
echo("<script src=\"$jsDir$js[$i]\" ##TRUNCATED SCRIPT TAG##>\n");
}
?>
</head>
===================
[2] pageFooter.inc
===================

<div id="footerDiv">FOOTER CONTENT</div>

=================
[3] pageHead.inc
=================

<div id="headerDiv">
## HEADER CONTENT ##
</div>
==============
[4] index.php
===============
<?php
$title='home';
$js = array('script01.js','script02.js');
$css = array('01.css','02.css');

include('paths.inc');

/* this line calls fileHead.inc, which writes from "<html>"
to "</head>" - fileHead.inc calls the first three vars above*/

include($includesDir . 'fileHead.inc');
?>
<body>
<?php
/*this line calls pageHead.inc, with "page" header content -
(nav, logotype, breadcrumbing, date, etc.)
not to be confused with fileHead.inc which writes "file" head
content (<html><head><title></title><link /></head>) */
include($includesDir . 'pageHead.inc');
?>
<div id="content">BODY CONTENT</div>

<?php /*this line calls pageFooter.inc, which writes "page" footer content
(copyright, contact links, etc.)-- */
include($includesDir . 'pageFooter.inc');
?>
</body>
</html>

jatar_k

6:30 pm on Feb 1, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to the boards russgri,

I am not totally sure what the question is. That is a chunk of code and I am not totally sure what I am looking for.

I assume you are getting a blank page in the browser for index.php. Have you looked at the page source in your browser to see if the html looks correct or is there no html? Is it including anything?

What results or errors are you getting?

russgri

1:10 am on Feb 2, 2003 (gmt 0)

10+ Year Member



The page ..domain.com/index.php...
shows the correct source but I cannot copy it to my computer and name it html or phtml and get to work
Here is the paths.inc code


<?php
$baseDir = '/www'; // root directory
$includesDir = 'includes/'; // includes directory
$cssDir = 'css/'; // css directory
$jsDir = 'js/'; // js directory
?>

[edited by: jatar_k at 11:25 pm (utc) on Feb. 2, 2003]
[edit reason] no urls please [/edit]

jatar_k

11:46 pm on Feb 2, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



to rename it your server would have to be configured to parse those extensions for php.

If it works as index.php why do you need to rename it?

russgri

11:49 pm on Feb 3, 2003 (gmt 0)

10+ Year Member



The above code with changes:
<code>filenames were changed from:
*.inc to *.inc.php</code>
The changes were made in the include folder and also on
index.php

When I access the file it includes the files in the source but page still remains blank.

Do I need an htaccess file?