Results 1 to 4 of 4

Thread: [RESOLVED] PHP and SSI files

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Location
    Australia, Melbourne
    Posts
    29

    Resolved [RESOLVED] PHP and SSI files

    I am trying to figure out a way to have a list of links and if it is possible to reload the page and based on the link clicked include a .ssi file with the content. Don't really want to have a new php page for each link. I am a bit confused so if anyone can let me know if its possible or not and maybe some pseudo code would be great.

    Thanks!

    Edit:

    Also if anyone has another method instead of ssi that would be great. The content is just a list of quotes will be between 100-200 and hoping to categorize. I was going to store them in MySQL database but querying for all of them i thought might waste more bandwidth and also execution speed will be longer i believe.
    Last edited by SharpCode; Nov 14th, 2012 at 09:11 PM.

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: PHP and SSI files

    You could use the include()

    PHP Code:
    include 'inc/quotes.php'
    If you do not wish to use db, then you could store the items in XML file and let the client side JavaScript do the fetching of the quotes and displaying it.


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Location
    Australia, Melbourne
    Posts
    29

    Re: PHP and SSI files

    Taken a bit of a different approach. Definitely doing database but what i need to do now is have another content page that depending on the selection populates with other stuff. So if i clicked "test1" then url.com/test1 will be the url and it will populate with relevant data. But if had clicked "Test2" then it would be url.com/test2 with different information. Not sure if its dynamic (i guess it is). could this be done with just the quotes.php page or do i need more pages?

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: PHP and SSI files

    I do this kind of stuff all the time...

    My index.php will usually look something like this:

    Code:
    <?php
    
    $content = $_GET['page'];
    
    if !isset($content)
      $content = 'default'
    
    include_file('header.php');
    include_file('menu.php');
    include_file('sidebar.php');
    
    include_file($content.'.php');
    
    include_file('footer.php');
    
    ?>
    I don't think that's all exactly right, but close enough... it gets the idea across...

    Now the links look like this:
    index.php?page=links or index.php?page=quotes

    and it will load the proper page content...

    Now... if you want yoururl.com/links or yoururl.com/quotes as your url & links... then you need to set up a rewrite rule so that youurl.com/quotes gets translated into index.php?page=quotes by the server. google URL rewrite Apache (or IIS if that's what you're using) there's pleeeeeenty of examples out there...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Click Here to Expand Forum to Full Width