crubbles
03-26-2003, 03:28 AM
After making a less than a few websites in HTML with the standard left navigation column...I've come to realize how tiring it is to complete a 15+ page site and later decide that I need to add another link in the nav column. Then adding it to all 15 pages and ftp'ing them only to change my mind later.
The word efficiency doesn't come to mind
After reading a few webmonkey tutorials I decided PHP was my savior.
Perhaps I am approaching this in the wrong way, but I want to create a page with all the data that is often changed and placed on numerous places throughout the site.
Below you can see how I attempted this by some variables and functions.
An appropriate analogy would be the implementation of formatting a page via css stylesheet. Only I want to change the actual data displayed as opposed to the formatting.
In my index page the code I use to call the functions is:
<?php cenIndexLinks (); ?>
(This code is in the head: <?php include(inc.php); ?> )
As far as I can tell, the syntaxing is all correct...however I still recieve an error letting me know the inc.php page cannot be opened.
The code below is the inc.php page containing the arrays and functions.
<html>
<body>
<?php
/* This first variable is called at the bottom of every page of the site as it will change every year */
$copyright = "Copyright © 2003";
/* I'm decided to store some articles and other information here just to see if I really understood the tutorial..this info isn't going to be dynamic */
$articles = array (
array ("name" => "cr0",
"title" => "Title 1",
"author" => "Author's Name",
"date" => "00/00/00",
"body" => ". . ."),
array ("name" => "cr1",
"title" => "Title 2",
"author" => "Author's Name",
"date" => "01/01/01",
"body" => ". . . .")
);
/* This would be the part I'm most concerned with. This is the function I use to call the central index list (right nav link column) to be displayed on my page. This code snippet is inserted inside an HTML table' cell: <?php cenIndexLinks (); ?> */
function cenIndexLinks () {
echo ("<a href=link.html target=content>Link Text</a><br>");
echo ("<a href=link.html target=content>Link Text</a><br>");
echo ("<a href=link.html target=content>Link Text</a><br>");
echo ("<a href=link.html target=content>Link text</a><br>");
echo ("<a href=link.html target=content>Link Text</a><br>");
}
?>
</body>
</html>
Any help is greatly appreciated. I am making this site in order to learn PHP --not the other way around.
Please let me know if I am unclear in any way. As English is not my first language.
The word efficiency doesn't come to mind
After reading a few webmonkey tutorials I decided PHP was my savior.
Perhaps I am approaching this in the wrong way, but I want to create a page with all the data that is often changed and placed on numerous places throughout the site.
Below you can see how I attempted this by some variables and functions.
An appropriate analogy would be the implementation of formatting a page via css stylesheet. Only I want to change the actual data displayed as opposed to the formatting.
In my index page the code I use to call the functions is:
<?php cenIndexLinks (); ?>
(This code is in the head: <?php include(inc.php); ?> )
As far as I can tell, the syntaxing is all correct...however I still recieve an error letting me know the inc.php page cannot be opened.
The code below is the inc.php page containing the arrays and functions.
<html>
<body>
<?php
/* This first variable is called at the bottom of every page of the site as it will change every year */
$copyright = "Copyright © 2003";
/* I'm decided to store some articles and other information here just to see if I really understood the tutorial..this info isn't going to be dynamic */
$articles = array (
array ("name" => "cr0",
"title" => "Title 1",
"author" => "Author's Name",
"date" => "00/00/00",
"body" => ". . ."),
array ("name" => "cr1",
"title" => "Title 2",
"author" => "Author's Name",
"date" => "01/01/01",
"body" => ". . . .")
);
/* This would be the part I'm most concerned with. This is the function I use to call the central index list (right nav link column) to be displayed on my page. This code snippet is inserted inside an HTML table' cell: <?php cenIndexLinks (); ?> */
function cenIndexLinks () {
echo ("<a href=link.html target=content>Link Text</a><br>");
echo ("<a href=link.html target=content>Link Text</a><br>");
echo ("<a href=link.html target=content>Link Text</a><br>");
echo ("<a href=link.html target=content>Link text</a><br>");
echo ("<a href=link.html target=content>Link Text</a><br>");
}
?>
</body>
</html>
Any help is greatly appreciated. I am making this site in order to learn PHP --not the other way around.
Please let me know if I am unclear in any way. As English is not my first language.