Designing Index Page With Target - - the table instead of using frame
BuffaloHELP
Aug 30 2005, 03: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
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.
you mean 'it opens up in a new page' as in it loads a new page, or opens in a new *window*?
before we go on, a little pedantism : use <?php, not <?. <? is no longer supported.
Anyway, i believe the short answer is : no. Not without client-side scripting, like javascript, grabbing pages from your server and popping them into the 'content cell' of your template. If you still want to use javascript for you menu, btw, you can. You should be able to just whack the JS code into a separate file and include that, though i've never touched JS so i wouldn't know for sure. Google be thy friend and all that.
Anyway, the best you can do with a pure PHP layout/menu is to keep the state of your menu-tree alive using sessions, cookies, POSTdata or some combination of the above. Actually, this i cool because the menu keeps its state across browser sessions, if you like the idea of that.
Cookies aren't really hard (you just have to learn not to trust user data ) and the same applies for POSTdata.
As a further aside - why tables? You could instead use html DIVs and CSS for great justice, and so on. All you need is a little simple CSS even IE can understand. Try the following :
i would have to agree no matter how you slice it using frames won't give the search optimization your looking for.
but to answer your question use the
CODE
target=main
in your url and that will open it in the same page without opening a new window.
but yeah its better to do it in window and not in frames, yeah it will be messy but if you use external php files you won't be dealing with all the coding in one editor.
I recently tried to do the same thing with my site. Its still being tested (hence the name test.php), but it works by being based entirely off of the index page, calling other pages only when they are needed. For example, clicking the Mailing List link opens the mailing list page in the middle section, but nothing else reloads or changes.
I am using div's on the main page, with the central div containing some code to load the right files. If its the kind of thing you're looking for then I'll be happy to give you the code and help you out.
If you look at a site I did - Pure GRiT - there is only actually one PHP page that calls in the rest of the content from includes (based on what is in the querystring) so it kinda mimics the way frames work (notice that the background & header never actually move).
The only reasons div's shouldn' work are if you've done something funky with the nesting of tags, the stylesheet is lost in the mail or the browser you're on suxoring. Div's have been around for a long time though, so they should damn well work even in IE 4.
If you look at a site I did - Pure GRiT - there is only actually one PHP page that calls in the rest of the content from includes (based on what is in the querystring) so it kinda mimics the way frames work (notice that the background & header never actually move).
Hi Tyssen, just a question, 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)?
<div tags have been their that long WOW , but you would thinking that they wouldn't work as well, because css was barely thought of back in IE4 days, (i think).
i can only image what a website would have looked like in IE4 with using the div tags .
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?
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).
<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.
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.
Let's Talk about basic mysql commands used in php. I will now show you a list of the most common
MySQL FUNCTIONS : QUOTE mysql_connect(MySQL server name,username,password) - opens a connection
to a MySQL server. mysql_select_db(database name,connection id) - selects a database residing on
the MySQL server. The database name parameter referes to an active database on the MySQL server that
was opened with the mysql_connect function. The connection identifier is a reference to the current
MySQL connection. mysql_query(sql query) - sends a query to the currently ac....
I am cleaning the erros of a php script with the line error_reporting(E_ALL); in the begginig of it.
But i am becoming several notices based on the same issue: Notice: Undefined index: add in
C:\xampp\htdocs\webshop\index.php on line 27 27: if($_POST ) 28: {
I do not understad why i am becoming this error. Add is a variable sent with the post method by a
formular. Add is not declared before the POST call in index.php but it should not. If anyone knows
the answer it would be great so i can clean those notices. Thanks in advanced.....
There are alot of sites out there with the index.php as the main page right? (Namely all of them)
However when some coders create sites, they create separate entitites and pages with a ?page=4
modifier, or whatever page they want it to be. I don't know how to do that, because each page
is 'based' off of the index.php page, when I find an example, i'll post it here, but
Does anyone know how to do this? Panda Like I said, this is hard to explain, so when I get an
example, I"ll post it here. Panda....
Looking for designing, index, page, target, table, frame
Searching Video's for designing, index, page, target, table, frame
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.