:: Forums HOT :: Credits :: Staff :: Users :: Join Staff :: SayBox Rules & Info :: Link Us :: Awards :: ShrimPedia :: Forums HOT :: Topsites :: Gallery :: Oekaki HOT :: Books :: Scans :: Calendars :: Covers :: Festival :: Episodes :: :: Voice Cast :: Quotes :: Music :: DVDs :: Movie :: World Wide Dubs :: Hiromu Arakawa :: Volumes :: Chapters :: :: Straying Rondo :: Sonata of Memories : NDS :: Dual Symphony : PS2 :: Broken Angel :: Crimson Elixir :: Girl Who Succeeded God :: Dream Carnival : Other :: coming soon :: :: Decks : Card Listings :: Base Set :: EX1: Blood & Water :: EX2: Artificial Human :: EX3: Alchemist's Gate :: Promo Cards :: Secret Rares :: Icons :: Fanart :: Fanfics :: Color Bars :: Other Fun Stuff :: Friend Only Banners :: Wallpapers :: Animated GIFs :: Photoshop Brushes :: Winamp Skins :: Mood Themes :: ROMs :: Free Layouts :: Color Chart :: Scripts :: Tutorials :: LJ Layouts « ? Hagaren # » « ? Steel Bonds # » Official Site fm_alchemist fullmetal_info |
With normal HTML, if you wanted to add a link to the sidebar, you would have to do it on every page, and it's tedious work. That's where php comes into play. I don't really get that one code everyone seems to use, and I got one of my own. First, make sure you have a php compliant webhost. That's defiantly important. =p Okay, I'll make up a quick little webpage. Code: That code there will give me this page. It's a simple layout Now, as my site grows bigger, and I have 20 differnet content pages, it's gonna become a pain to add in a link to the sidebar. I'd have to edit all 20 pages, just to add that one link. And what happens when I want to add yet another? I have to edit all 20 pages again. That's where PHP comes in. I can turn the above single file into 3 seperate ones, and it'll make my updating life very easy. I'm gonna break it down into three files, "layout1.php", "index.php", and "layout2.php". On all my pages, everything up to where the main content begins is the same. Code: I'm gonna add PHP Code: Warning: main(layout1.php): failed to open stream: No such file or directory in /home/pokejung/public_html/webmasters/tutorphp.php on line 88 Warning: main(layout1.php): failed to open stream: No such file or directory in /home/pokejung/public_html/webmasters/tutorphp.php on line 88 Warning: main(): Failed opening 'layout1.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/pokejung/public_html/webmasters/tutorphp.php on line 88 to the front of the file. What the include function does is... well, include. It'll take all the code from layout1.php and stick it into index.php. So if I were to look at the source of index.php, I would see this Code:
The exact same thing as what it looked like before I took out the beginning stuff and put it in layout1.php. Now, like the beginning bit, the end bit is the same throughout all my pages. So I'll take this bit here, and put it in a new file labelled layout2.php Code: |
Affiliates | |||||||||
Don't steal my stuff please! *puppy dog eyes* |