Hi Everyone
First off I don't know PHP except the includes statement which I use regularly to make the site a little easier to update.
But anyways am having an issue. I am trying to make a standard template page. On a prior site I had it set up this way with the code I will post below and it worked for me but I have tried to implement it on this site and am not having any luck.
Few things on the code below. It was designed for another site. So what I need is as follows. The home page should bring up the default index.txt file. That has the home page info on it. Second the code below has a table in the coding as I required a table on my site so that is in the code but for this site don't need the table. There is also one image in the code. That too is no longer required.
I will just leave these in place that way you can see the code I am working with so you can hopefully correct it to work for me as I am going nuts trying to get this to work.
Also somewhere in the coding it seems maybe there is an open link tag as I did get this to work a little bit but for some reason when it was the TXT file information was also being made to be a link even though the txt file for time being only contains basic text no coding what so ever.
Now what I need is as follows. Default home page TXT file loaded when home page loads. But the link below is what I was using for my site and when this was clicked it would load the TXT file for that page so the example link below would open up a members page that was associated with my message board I was using.
<a href="members.php?categories_file=Members">Forum Members Websites</a>
that link would bring up file members.txt which was stored in the text folder
Below is the code that in both cases was and is placed in the main window of the table I am using for layout. Last time this all worked perfectly but this time not sure why it refuses to load the page like it use to.
Can anyways sort this code so it works fine for me.
Thanks!!
Dave
<?php
if ($_GET['categories_file'])
$fp = fopen("text/$categories_file.txt", "r")
or die("Could not open $categories_file.");
while (!feof($fp)) {
$line = fgets($fp, 512);
$categories[] = $line; }
asort($categories)
or die("Could not sort array.");
$table_column_counter = 0;
echo "<table border='0' cellpadding='0' cellspacing='0' width='90%'>";
foreach ($categories as $item) {
if ($table_column_counter == 0) {
echo "<tr>\r\n"; }
$link = explode(",", $item);
echo "<td><img src='images/green.gif' width='13' height='13'><a
href='$link[1]' target='_blank'>".$link[0]."</a></td>";
if ($table_column_counter == 2) {
echo "</tr>\r\n"; }
$table_column_counter = $table_column_counter + 1;
if ( $table_column_counter >= 2 ) {
$table_column_counter = 0; } }
?>