473,394 Members | 1,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Default SSI help -->Creating a seperate Index page ?

Just wanted to say hello to all the other newbies, and ask my first question:
Your help is extremely needed, and I would appreciate anyone who can help.

I am trying to make a website with SSI (server side includes), so my site doesn't take years to load.

Here is my html and <?php ?> function:

Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <div id="container">
  3.  
  4. <?php include_once('includes/search.php');?>
  5. <?php include_once('includes/tabs.php');?>
  6. <?php include_once('includes/menu.php');?>
  7.  
  8.  
  9. <div id="content">
  10.  
  11.  
  12. <?php
  13.  
  14. include_once('includes/mission_statement.php');
  15.  
  16. include_once('includes/framed_gallery.php');
  17.  
  18. if($_GET['page'])
  19. {
  20.  
  21. include('pages/' . $_GET['page'] . '.php');
  22.  
  23. }
  24. else
  25. {
  26. include('pages/home.php');
  27. }
  28.  
  29.  
  30. ?>
  31.  
  32.  
  33. </div>
  34. <?php include_once('includes/footer.php');?>
  35.  
  36. </div>
  37.  
  38.  
  39. </body>
  40. </html>


Here is my menu:
Expand|Select|Wrap|Line Numbers
  1. <div id="side_bar_menu">
  2.  
  3.  
  4. <div class="glossymenu">
  5. <a class="menuitem_home" href="http://bytes.com/community/greenfield" ></a>
  6.  
  7. <a class="menuitem_about submenuheader" href"../greenfield/home.php?page=Welcome"> </a>
  8. <div class="submenu">
  9. <ul>
  10. <li><a href="http://bytes.com/community/greenfield/home.php?page=Welcome">Welcome</a></li>
  11. <li><a href="http://bytes.com/community/greenfield/home.php?page=Community">Our Community</a></li>
  12. <li><a href="http://bytes.com/community/greenfield/home.php?page=Common">Commom Experiences</a></li>
  13. <li><a href="http://bytes.com/community/greenfield/home.php?page=Expectations">Expectations of Students</a></li>
  14. </ul>
  15. </div>

What I don't understand is how I can get ONLY the index page to show these:

include_once('includes/mission_statement.php');

include_once('includes/framed_gallery.php');


with out it having to stay on every page there after...???

Thanks in advance,
Digital Drew
May 15 '09 #1
4 1684
Ciary
247 Expert 100+
first of all, welcome on the forum.

/* second: php is a server side script. so all lines of php are processed by the server before it send the page to the browser, any lines of php (like include-once) aren't shown in the sourcecode. instead, your browser will still receive the full html code send by the server. so ssi isn't a way to make your page load faster. */

last: consider using code-tags in your posts on the forum. it makes your code easier to be read.

/*a tip: if you want to hide your code in sourcecode: use javascript/ajax to load your page. your html will still be visible in firebug though */

EDIT: srr i think i misunderstood your question:

try this:
Expand|Select|Wrap|Line Numbers
  1. if($_SERVER['PHP_SELF']=="index.php"){
  2.  
put it around the lines you only want to show on index.php
May 15 '09 #2
prabirchoudhury
162 100+
1. you call all the different pages just frm the index.php page and stay there..

call your described pas as index.php page. make three part of ther page
a. header part : cinstant header part

b content part : would be dinamic body part and this part would call the different function according to request.

c. footer part: constant footer part



Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <body>
  3. <!-- start header part -->
  4. <div id="container">
  5.  
  6. <?php include_once('includes/search.php');?>
  7. <?php include_once('includes/tabs.php');?>
  8. <?php include_once('includes/menu.php');?>
  9.  
  10. <!-- end header part -->
  11.  
  12.  
  13. <!-- start content part -->
  14. <div id="content">
  15.  
  16.  
  17. <?php
  18.  
  19. include_once('includes/mission_statement.php');
  20.  
  21. include_once('includes/framed_gallery.php');
  22.  
  23. if($_GET['page'])
  24. {
  25.  
  26. include('pages/' . $_GET['page'] . '.php');
  27.  
  28. }
  29. else
  30. {
  31. include('pages/home.php');
  32. }
  33.  
  34.  
  35. ?>
  36. </div>
  37. <!-- end content  part -->
  38. <!-- start footer part -->
  39. <?php include_once('includes/footer.php');?>
  40.  
  41. </div>
  42.  
  43.  
  44. </body>
  45. </html>
  46.  
  47.  
May 15 '09 #3
Markus
6,050 Expert 4TB
For further reading, check out the MVC architecture (design pattern). Mixing your PHP (read: not server-side-includes) with your HTML (presentation) is generally a bad idea.
May 15 '09 #4
Thanks to every one's prompt answers:
[b]Ciary:[b] Your edit was correct, and I'm going to try the
# if($_SERVER['PHP_SELF']=="index.php"){
tomorrow when I get a chance.

and

[b]Markus:[b] Thanks, I went to the MVC link you provided and I tried 2 frameworks before I stuck with CodeIgnitor, seems easy to follow and being more of a designer than a developer, it will absolutely work perfectly with my workflow in contrast to using simple PHP scripts here and there.

Thanks again!

DigitalDrew
May 16 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: jgb_dba | last post by:
Hello, I not exactly sure how to determine the table when given the following information: -- Could not find the index for RID '999999' in index page ('1:99999999'), index id ), database...
0
by: xixi | last post by:
we are using db2 udb v8.1 on win 64 bit HP titanium machine with fp3 with type 4 db2jcc.jar driver. i have two database created under different patition on same drive. when i do db2dart on the...
1
by: A.M-SG | last post by:
Hi, I have a web service with two soap extensions enabled on it. When I run the default IIS method invoke page, the invoke button bypasses all my soap extensions. But when I call the...
2
by: Henry Sun | last post by:
Hi all, New to ASP.NET and this Newsgroup. recently I saw some major websites use ascx page as their index page (e.g. index.ascx?ProductId=blah). I did a little bit rearch but I still couldn't...
5
by: nex85 | last post by:
Hi, On Yahoo! web hosting, we are able to create subdomains, like: 1. yourplace.me.com 2. myplace.me.com 3. ourplace.me.com as subdomains of a site, e.g., www.me.com
5
by: james00 | last post by:
Can anyone help me create a script like Yahoo.com and Msn.com has it for parsing to the index page. (like if you go to yahoo.com it brings you to http://www.yahoo.com or if you try to switch bettwn...
1
by: S_K | last post by:
Hi, I need to create and display a completely new and seperate web page from within an existing web page. Response.Redirect("localhost....") dosen't do it because I have a SINGLE web page when I...
2
by: S_K | last post by:
Hi, I need to create and display a completely new and seperate web page from within an existing web page. Response.Redirect("localhost....") dosen't do it because I have a SINGLE web page when I...
8
luckysanj
by: luckysanj | last post by:
Dear Sir, How can i redirect index page to wwx.site.com/me/index.php. I have not fineshed front index page work so now i want to redirect this page to my personal information which is located...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.