|
|
|
|
![]() ![]() |
Sep 8 2005, 05:12 PM
Post
#11
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 19 Joined: 8-September 05 From: Atlantic Canada Member No.: 11,632 |
QUOTE(BuffaloHELP @ Aug 30 2005, 12:16 AM) I have been reading up on search engine's ability to cache one's site and I realized that FRAME is something these search engines don't really like. You can read it on Google's search FAQ and just recently my page was cached by Yahoo after taking down my frame index page to no frame page. So here is what I would like to do and I would like you super coders help. PHP seems to be the best choice since when using INCLUDE command my index page includes not only my three separate pages in one, but it helps to have content rather than showing only HTML <FRAMESET name=topFrame rows=68,* frameBorder=0 framespacing="0" border="0"> as a main page. <FRAME name=treetop src="EN_treeTop.htm" noResize target="mainpage" scrolling="no"> <FRAMESET name=mainFrame cols=200,*> <FRAME name=contents src="EN_Tree.htm" target="mainpage" scrolling="no" noresize> <FRAME name=mainpage src="EN_intro.htm" scrolling="auto" noresize> </FRAMESET> This is how I had my page laid out. I designed it this way to resemble your regular Windows help familiarity navigation. Attached figure 1. ![]() I had it this way so that the BOX 1 and BOX 2 were never reloaded when a selection from BOX 2 (a tree style expandable/collapsible menu) occurs and only BOX 3 will load the intended page. It was fine and it worked beautifully. But now, I would like to have this as PHP. This is how my index page's code is: HTML <html> <? include 'top.html' ; include 'menu.php' ; include 'main.html' ; ?> </html> I already have the PHP navigation menu made for BOX 2 but whenever I click on the link, it opens up in new page. Instead of using FRAME, I have those laid out as TABLE. My questions are: 1)Is there anyway I can target the link to the BOX 3 using TABLE's command (like name="main") from menu click on BOX 2? 2)Could I still use JAVA coded menu.html (the original menu) instead of menu.php? 3)If TABLE isn't the answer, could you recommend me the right one? For a working demo (not mine) please refer to http://www.esat.kuleuven.ac.be/~tvandera/phpmenu/ page and see the concept that I have in my mind. Except that I would like to refrain from using FRAMEs. Thank you. Your best bet would be to use <div> tags, and dynamically load the innerHTML. You could hold the html in a database, then when the main page loads, grab all your code from the database, throw it into javascript variables and use the links to call a load function. Or you could use an iframe to throw the other pages in. Keep in mind the following example probably doesn't work. If you want a working example I'll try to finish the script this afternoon... CODE <?php //Your query would go here, and you would simply echo the results to javascript variables. I won't do all the coding in this example. ?> <html> <script> //these variables have been echo'd with php, filled using a php query from the //database. var page1 = "some html"; var page2 = "other html"; function loadContent(pagename){ if( pagename == "page1.html") document.getElementById('content').innerHTML = page1; //and so on, you could use a switch statement here as well. } </script> <body> <div name='content'></div> </body> </html> This post has been edited by cmatcmextra: Sep 17 2005, 06:07 PM |
|
|
|
Sep 9 2005, 05:42 AM
Post
#12
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 85 Joined: 27-August 05 From: QLD, Aus. G'day! Member No.: 11,186 |
mike_savoie, kick me if i'm wrong - but did you say pull all the content from the database at load? If the guy has any more than say, 500k of html in his site, that's going to be a little expensive. I've never used JS, but i'm sure they provide some functions to query a database - if so, i think a better solution would be to load the index page at load time, then get the JS script to ask for the other pages as needed.
|
|
|
|
Sep 9 2005, 06:00 AM
Post
#13
|
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,161 Joined: 9-May 05 From: Brisbane, QLD Member No.: 6,818 |
QUOTE(littleweseth @ Sep 9 2005, 03:42 PM) I've never used JS, but i'm sure they provide some functions to query a database You can't query a database with javascript - it's all client side. QUOTE(Lozbo @ Sep 7 2005, 04:22 PM) is this site loading only content based on the querystring and leaving all data which has loaded alone, or you mean it actually reloads the exact same page, and places the content where it belongs? Couse if so (not loading the page again), could you point out how you manage to do that (which i think you must have fixed with JavaScript)? It is actually reloading the page each time you click on a link because the links all load up a different querystring. But I guess because the basic page layout isn't changing, it seems like the background never changes (well it seems like that for me - maybe people on slower connections will notice a reloading of the background). The links look like this: CODE <ul id="links"> <li id="news"><a href="?page=news" title="News"><span>news</span></a></li> <li id="about"><a href="?page=about" title="About GRiT"><span>about</span></a></li> </ul> Then the main content area is like this: CODE <div id="text"> <h1 id="<?echo$qString?>hd"><?echo$qString?></h1> <?php include ("$path.inc"); ?> </div> I've used an if...else and a switch statement at the top of the page to work out what $path is based on the querystring. Each include then contains the HTML that is unique to each page. The links on the left are also generated the same way but they're a bit more complicated cos they're actually reading the directory and then printing the links based on which files it finds (and using the file names as the names for the links). This way the links are automatically generated each time you create a new include and the person who I did the site for doesn't have to worry about adding links into the HTML. |
|
|
|
Sep 17 2005, 05:46 PM
Post
#14
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 282 Joined: 1-September 05 From: Wanatos Member No.: 11,382 |
QUOTE(Tyssen @ Sep 9 2005, 12:00 AM) The links on the left are also generated the same way but they're a bit more complicated cos they're actually reading the directory and then printing the links based on which files it finds (and using the file names as the names for the links). This way the links are automatically generated each time you create a new include and the person who I did the site for doesn't have to worry about adding links into the HTML. Wow, that is really cool... could you explain a little more that? how did you achieve that? i supose it has something to do with php file reading functions right? And this threads question in the first place i think has not been completely answered, so is there a way to load content into divs or table cells without reloading the rest of the page? and without having to load all content into js the first time a user enters the site? |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 10th October 2008 - 11:44 PM |