-
Nov 14th, 2012, 08:03 PM
#1
Thread Starter
Junior Member
[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.
-
Nov 15th, 2012, 03:09 AM
#2
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,...
-
Nov 15th, 2012, 08:47 AM
#3
Thread Starter
Junior Member
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?
-
Nov 15th, 2012, 12:37 PM
#4
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|