Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Display different bodies of text into a table?

    Does anyone know of a way to use php to pull text from a file and put it into a certain table on a web page?

    For example say I have 6 links on one page of a website. I have one table with the 6 links and below that I have another table that is empty.

    Each time I click one of the links I want to display a certain body of text in the bottom table. I can't think of any other way to do this besides pulling from text files. I don't know if this is even possible but I'm trying to keep my navigation and number of pages on my site down to a minimum.

    Does anyone have any suggestions on how this could be done or a better way?
    Last edited by JoeBobJr; 01-11-2012 at 01:19 AM.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,492
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    You need to think about how to organize it.

    You can have 1 text file that contains all the text, or separate text files for each body.
    You can use MySQL for a database,
    You can use a plain text (.txt) file for a database,
    You can use Google Docs Spreadsheet for a database.

    There are thoughts to ponder ... if the user views a certain body and comes back
    to your site in 2 days, will they be on the same spot (using cookies)?

    Can the page refresh when they press the link, or should it use AJAX and update
    seamlessly, without a page refresh?

    How will you update the bodies of text?
    And do those text bodies need to contain HTML (like rich text?).

    All of those things result in different answers.

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    You need to think about how to organize it.

    You can have 1 text file that contains all the text, or separate text files for each body.
    You can use MySQL for a database,
    You can use a plain text (.txt) file for a database,
    You can use Google Docs Spreadsheet for a database.

    There are thoughts to ponder ... if the user views a certain body and comes back
    to your site in 2 days, will they be on the same spot (using cookies)?

    Can the page refresh when they press the link, or should it use AJAX and update
    seamlessly, without a page refresh?

    How will you update the bodies of text?
    And do those text bodies need to contain HTML (like rich text?).

    All of those things result in different answers.
    What I would like is one page that does everything. I'd like it to refresh within the page not actually the whole website.

    I'd like to have some links displayed to the user on a page. Each time a user clicks one of the links it displays the text I have set for that link. It will just be plain text. But when the user clicks another link I don't want the content to stay I want it to disappear and the next body of text be displayed.

    I was thinking maybe something like include files that are pulled when needed to display the content. Maybe set up variables in the code like $localservice = "I do computer repairs to desktops and laptops. I also do network installations, etc." for each thing I want to be displayed.

    So when the person clicks Local Services link it tells them what services I offer. I'll have a bunch of different things like that set up. I used to have it set up like this page here.

    http://www.apexcomputergroup.com/services.php

    If you click a link it opens another page with the information. I'm currently transferring all my stuff from html to php-nuke but not 100% positive on which CMS portal I will use. I learned to make a module that allows me to display something on a page. I was hoping not to create a new module for every page I need displayed seems like there has to be an easier way to just display the contents on the same page but without displaying it all at once and cluttering the page.

    If all that makes any sense?
    Last edited by JoeBobJr; 01-11-2012 at 04:31 AM.

  • #4
    New Coder
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I just decided to create a module for each link and be done with it. If anyone were to come up with a solution that would work to display different bodies of text with the click of a button or a link would be cool to know.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •