Jump to content

Way to show multiple txt files ....................


Cooleyvol

Recommended Posts

Ok, so I have a site with a page that I want to show multiple .txt files inside it based on the button clicked at the top of the page.

 

I know how to include a txt file in that page, but I don't know how to make the txt file shown on the page chosen by the user selecting the web nav button of his choice.

 

I know I could create multiple pages with the nav area at the top and each txt file on a separate page, but I'd like to create just one page and have only the middle content (text file) change based on the button selected.

 

The nav area is at the upper portion; the txt file would display in a table below the nav area.

 

Is there a way to do this?

 

Here's a link to the page:

http://iff.totalsportsworld.net/apexnav.php

 

The buttons in the blue/yellow area would control which text file shows up in the area just below it (white b/g).

 

Mark Cooley

cooleyatcharterdotnet

Link to comment
Share on other sites

I see no reason why ajax would be a suggested solution.

 

All you simply need do is make you nav links pass a variable via get, then use this to display the correct file. eg;

 

<ul>
  <li><a href="?f=foo">foo</a></li>
  <li><a href="?f=bar">bar</a></li>
  <li><a href="?f=bob">bob</a></li>
</ul>
<?php

  if (isset($_GET['f'])) {
    if (file_exists($_GET['f'] . '.txt')) {
      echo file_get_contents($_GET['f'] . '.txt');
    }
  }

?>

Link to comment
Share on other sites

I see no reason why ajax would be a suggested solution.

 

All you simply need do is make you nav links pass a variable via get, then use this to display the correct file. eg;

 

<ul>
  <li><a href="?f=foo">foo</a></li>
  <li><a href="?f=bar">bar</a></li>
  <li><a href="?f=bob">bob</a></li>
</ul>
<?php

  if (isset($_GET['f'])) {
    if (file_exists($_GET['f'] . '.txt')) {
      echo file_get_contents($_GET['f'] . '.txt');
    }
  }

?>

 

How would that be worked given the image in the supplied link to the page? That image will be hotspotted and those will be linked areas to the different txt files.

Link to comment
Share on other sites

I see no reason why ajax would be a suggested solution.

 

All you simply need do is make you nav links pass a variable via get, then use this to display the correct file. eg;

 

<ul>
  <li><a href="?f=foo">foo</a></li>
  <li><a href="?f=bar">bar</a></li>
  <li><a href="?f=bob">bob</a></li>
</ul>
<?php

  if (isset($_GET['f'])) {
    if (file_exists($_GET['f'] . '.txt')) {
      echo file_get_contents($_GET['f'] . '.txt');
    }
  }

?>

Could I link the hotspots using just this code:

<a href="?f=foo"></a>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.