User | Post |
Darth Coby
Posts: 539/1371 |
Yes, use include to insert a header and a footer, put it on every page and you'll only have to edit one file to edit them all. |
Exadis
Posts: 15/32 |
Originally posted by mvpo.geo Yeh now I really need help on somthing else cause thanks to yall I figured that out Thanks. But Im making like a site directory, and it will be on everypage of the website, Is there a way to make it so I can edit just one menu and its changes them all? I think it can be done in css or java but Im not 100% sure.
If you have your main site all in one page, like you asked for in your first post, then somthing like this should work.
*NOTE* example is from one of my acmlm board files.
$head="whatever you want the head to be";
print "$head";
if($page==whatever){
print " this pages content "
}
And for every if($page==whatever) , you should always have that one head displayed, and the "this pages content " displayed underneath.
This also can be done with footers. |
ErkDog
Posts: 449/982 |
you would be doing a local include though
include ('filename.ext'); |
mvpo.geo
Posts: 15/48 |
Heck no lmao, frames are definitly no! I found one thing but Im not sure if it work 100% is this ok?
include 'http://www.example.com/file.txt?foo=1&bar=2'; ?>
|
ErkDog
Posts: 441/982 |
use frames.....
or if you are using PHP
make a header.inc file
and just include the header at the top of every PHP page |
mvpo.geo
Posts: 14/48 |
Yeh now I really need help on somthing else cause thanks to yall I figured that out Thanks. But Im making like a site directory, and it will be on everypage of the website, Is there a way to make it so I can edit just one menu and its changes them all? I think it can be done in css or java but Im not 100% sure. |
Darth Coby
Posts: 538/1371 |
Yes that's possible, you need to use POST/GET variables though. Then you check what the value of the variable is and then load the appropriate part of the page, and no, it's still very fast because it only loads what it needs. |
ErkDog
Posts: 409/982 |
yes he said put all sites in ONE file not call a bunch of other files from one file...
you might as well just have multiple files if you do that |
Icy Guy
Posts: 13/36 |
Originally posted by ErkDog Icy guy... that's cheating and not at all what he's talking about
I was merely expanding on what Dragato was saying, which seemed to be what the topic creator was asking about.
Also, I was never aware you could "cheat" when writing a program or HTML/PHP/etc. If it's efficient and it works, who cares how you wrote it? In this case, it's all a matter of not having to write multiple If-Then statements for handling each page on the site. |
FreeDOS
Posts: 414/1657 |
Erk: Most of Invision Power Board is in the index.php file
It's quite easy to make it all one file. Just use if(). No biggie. |
ErkDog
Posts: 257/982 |
Icy guy... that's cheating and not at all what he's talking about
you are still maintaining the differet parts of the website in seperate files.....
and just "including" them
so you might as well just be doing snitz.php
|
Icy Guy
Posts: 12/36 |
When I was fiddling with PHP, I found out about another way of doing what Dragato said. Set your site up, so that when you click a link, it changes a page I.D. Confused? I'll demonstrate: http://hostultra.com/~rwarchive/
When you click one of the links, it takes you to another page, with a mostly similar URL, but the "id" portion of the URL (what comes after "sections.php?id=", to be exact) changes. So when the id is "snitz," it loads one page, "ubb" another, etc. Here's the code we used for sections.php, which is the "main" loader:
include ("$id.txt")
?>
(If that doesn't work, remove the quotation marks.)
We have a bunch of different text files that have the same names as the I.D.'s in the URLs; snitz.txt, ubb.txt, etc. This code takes the value of the I.D. in the URL and tells it to load the text file with the same name as that. Make sure you write all your HTML for the page's content in the text file.
Also, if you're looking for security, I'd suggest using some sort of a directory system. Example:
lt;?php
include ("includethis/$id.txt")
?>
Put all your text files in the "includethis" directory and they'll be loaded from there. No one will ever know unless you tell them.
I hope this hasn't been too confusing. It's been a while since I've coded any PHP.
(This has been ANOTHER long-ass post, brought to you by Icy Guy.) |
ErkDog
Posts: 238/982 |
Metroid not really
you could in theory have this entire forum, for example in ONE file......
and instead of having differnet pages you'd have a switched case
if action=viewthread do this function......
if action=viewonline do this function if action=FAQ do this function
etc... etc.....
just makes it alot harder to maintain and manage... but yes, you can do it...... |
SyntaxLegend
Posts: 9/222 |
depending on how big the site was, wouldnt that take ages to load? |
Dragato
Posts: 23/25 |
If you mean having everything in say the index page you could have it so you get linked to index.php?id=whatever
then the PHP page would look like
if ($id=="whatever"){ $content="this is the whatever page"; } echo $content;
|
Exadis
Posts: 8/32 |
He asked me about this on AIM earlier, and I couldent help him out ...
He wants to know if its at all possiable to make a main site all in one .php file by useing something like if($page==whatever){ print" this ";} kinnda thing ... |
mvpo.geo
Posts: 10/48 |
Does anyone know the script and how to have all my sites as one big PHP site? I heard it is possible but don't know how to do it. Can anyone please help me with getting my site to this? |