stupid question i will more than likely get ridiculed for, but such is the nature of tdubi know html/xml pretty well...css makes sense, i don't have formatting trouble and my site is overly simple...however, i do NOT know the more powerful programming languages of things lik PHP, so i'm at a loss as to how to do this:let's say my site has 6 pages in 3 categories set up with the following file structure (bracket indicates a folder, dash indicates a file):ROOT [content] [contact] -about.html -directions.html [faqs] -ask.html -answer.html [products] -overview.html -details.html -contact.html -faqs.html -products.html [css] -index.css -site.css [images] -logo.jpg -image1.jpg -index.htmldoes that file structure make sense? anywho, you start out on a gateway page (index.html)...you select from the main menu one of the three options (the three .html files in the "content" folder)...once you get to that page, you have two more sub-menu options in addition to the 3 main menu options (the files within the corresponding folder comprise the sub-menu - for example, "contact.html" references the two files in the "contact" folder)...get it?i'm using includes to put in "logo.jpg" and the main menu (with the options being the three .html files inside the "content" folder)...these components (logo and main menu) are included on every single page no matter where it is on the site...makes sense, right?so here's the problem - these includes have to have different file paths depending on what level (how deep) the .html file is at ("contact.html" and "about.html" can't have the same link to "index.html" because it's relative to location)...right? so at this point, i'm barely saving any coding time by using includes because i have to have a different one for each levelmy question is this - is there a way to reference an external file (the same way you include a .txt file containing the html coding for the main menu) that will reference the external file's location instead of the location of the .html document that called it? CSS works like this...if i have all of my stylesheets in the "css" folder, then i make any links (say, background images) relative to the .css file's location, not the .html file that uses itdoes any of this make sense? yes, i realize that a more powerful/functional code can do this...but i don't KNOW other code, and as this isn't my job (the example is just an example...i'm working on my own personal site), i don't really want to take the time to learn (even basically) another languageany help will be much appreciated
6/20/2006 2:24:02 PM
Try using absolute links instead of relative links.e.g. Use - http://www.yoursite.com/faqs/pageyouwant.html and not ../faqs/pageyouwant.html
6/20/2006 2:27:35 PM
use dreamweaver and DW templates to take care of the relative links for you
6/20/2006 3:29:11 PM
^^ i don't like to do that because i can't test anything off-line^ i don't own dreamweaver...i really like hard coding (i know dreamweaver gives you design and code views)i appreciate the suggestions...i was just curious as to whether or not there were any code possibilities that i wasn't aware ofEDIT: the file structure diagram didn't come out like i wanted...so i may not have explained what i meant clearly enough[Edited on June 20, 2006 at 4:20 PM. Reason : structure]
6/20/2006 4:17:52 PM
learn php[Edited on June 20, 2006 at 5:10 PM. Reason : http://us2.php.net/include/]
6/20/2006 5:09:50 PM
use absolute links relative to the web rootaka /faqs/pageyouwant.html just make sure your php base path settings are mapped to the web root directory. Otherwise set the open base path and then call it.This will work on your local server and remotely.
6/20/2006 5:34:41 PM
okay...so if i put this:<? include("main_nav.php") ?>on my page, once i upload it will simply insert the code contained in the "main_nav.php" file? won't i run into the same problem as using <!-- #include file="../includes/main_nav.txt" -->? also, using the php code above, can i use a relative path like the .txt one above?EDIT: i admit that i understood very little of ^...can you give me an example of how it would be coded?[Edited on June 20, 2006 at 5:40 PM. Reason : .]
6/20/2006 5:39:03 PM
6/20/2006 6:08:59 PM
^^ You don't need the () so it should be: <? include 'main_nav.php' ?>That will pull the file, if its in the current working directory. So yes, in essense, you have the same problem as before. But, as stated in the thread, if you make it from the web root, add something to your tree like:[php]and then put main_nav.php in there, then you could do something like:<? include '/ROOT/php/main_nav/php' ?> where ROOT is the name of the main directory ofthe page, so say you called the direcotry that you have labeled ROOT MyPage just replace ROOT with MyPage, whatever is in the directory tree.If you do that, then no matter what directory the page you are accessing is in, it will know where to look for the main_nav.php file.
6/21/2006 1:44:07 AM
^ i might be misunderstanding your post...it seems like your solution is pretty much what i have now, simply using an include file...my problem is that it inserts the code into the calling file (which, i know, is what it's supposed to do)...however, that means any image links that are in the CALLED file have to be written in relation to file CALLING the includethat doesn't really help me as it means that i can't use the same snippet of code for files at different levels because the links won't be the samelet me try to explain what i'm looking for (which people may have understood, but i haven't really found a solution yet)...when an external CSS file is included on a page, it doesn't matter where the calling page is located...links within the CSS file are relative to the file itself, not the calling page (which is why you can use a single CSS file for an entire website)...i want the same thing, but i want to use it for calling snippets of code that will be the same on ALL pages (the main menu, for example)i COULD use a base href, or use absolute links, but like i said, it doesn't allow me to work offline...i also would prefer not to use dreamweaver (or similar) because i'd rather rely on code optionsi do, however, appreciate everyone's input
6/21/2006 1:04:48 PM
bttt
6/22/2006 8:48:04 AM
too many words skype me and explain it and i might think about it hahaha[Edited on June 22, 2006 at 11:27 AM. Reason : .]
6/22/2006 11:26:21 AM
6/22/2006 2:40:24 PM
dude, we are being EXTREMELY basic with you here.if you dont understand what we are telling you it's because you don't understand basic principles, not because we aren't giving you what you want.You need to learn PHP, and programming in general. Go get a book.
6/22/2006 3:09:10 PM
well, you really aren't answering my question (not that you have any obligation to), which is why i keep repeating it...the question is:
6/22/2006 3:20:21 PM
The absolute direct, exact and concise answer to your question is:
6/22/2006 3:54:47 PM
seriously you can just search for an html tutorialthis is pretty basic stuff and should be covered in detail in any tutorial
6/22/2006 4:14:09 PM
^^ that little bit of additional explanation DID help and i found a tutorial using some keywords you provided...thank you (no sarcasm)^ html isn't the issue...php, which is MORE difficult, is the issue thanks for suggestions everyone
6/22/2006 8:09:58 PM
seriously you can just search for an php tutorialthis is pretty basic stuff and should be covered in detail in any tutorial
6/22/2006 8:38:44 PM
http://www.w3schools.com/[Edited on June 22, 2006 at 9:24 PM. Reason : http://www.w3schools.com/]
6/22/2006 9:24:06 PM
that's a good site (been there long time ago)
6/22/2006 9:25:28 PM
htmlcodetutorial.com is one of the best sites out there for basic questions. w3schools covers a lot more but doesn't have a learning path associated with it.
6/22/2006 9:46:41 PM
6/22/2006 9:49:46 PM