PHP Tutorials.

Discussion in 'The Living Room' started by Will, Apr 25, 2003.

  1. #1
    Will

    Will LPA Addicted VIP LPA Addicted VIP

    Joined:
    Aug 25, 2002
    Messages:
    35,486
    Likes Received:
    38



    Does anyone know where I can find PHP tutorials? I don't need them urgently, but I would like to know where I can find them as I want to convert my site to PHP.

    Thanks in advance. :)
     
  2. #2
    Omar

    Omar Administrator LPA Super Member

    Joined:
    Jul 13, 2002
    Messages:
    4,272
    Likes Received:
    18



    unfortunetly, it's not as simple as html, in fact, I've been trying to learn it, but most of the tutorials I've been to are either:

    a. dont explain to how plug it into a site
    b. give and take from other languages

    Anyways, tell me what you need PHP for and I'll get you the script for it ;-)
     
  3. #3
    Will

    Will LPA Addicted VIP LPA Addicted VIP

    Joined:
    Aug 25, 2002
    Messages:
    35,486
    Likes Received:
    38



    Er, I just want to write my site in PHP instead of HTML, that's all.
     
  4. #4
    musicman

    musicman New Member

    Joined:
    Mar 9, 2003
    Messages:
    2
    Likes Received:
    0



    Heres some steps for php

    1. Make your layout
    2. Delete where your content would go and put in the following code:
    <#?php include ("$page"); ?> <-- Remove the "#"
    For the $page thing, you can put anything u want, like $goto.
    3. Now name that file main.php
    4. Now make your content pages, like information about catching a bug or some sort. Have the file have a html, txt, or htm extensions.
    5. When linking to the page, you would put the following code:
    http://www.YOURSITE.com/main.php?$page=VARIABLE
    The VARIABLE is what your page is, like site.html or some sort. For the $page part, you have to put whatever you put whatever in place of your content.
     
  5. #5
    Will

    Will LPA Addicted VIP LPA Addicted VIP

    Joined:
    Aug 25, 2002
    Messages:
    35,486
    Likes Received:
    38



    I've already done that, but I want to code my entire site in PHP.
     
  6. #6
    Alex

    Alex Ambient

    Joined:
    Jul 13, 2002
    Messages:
    1,552
    Likes Received:
    4



    Will, PHP is an embedded language and there for there is no kind of new/special HTML to learn. PHP is just adding dynamic elements into your normal HTML pages. Of course it can get a lot more advanced than that (e.g. LPAs main file has no HTML in it and runs an advanced templating systems designed by me) but you need to start with the basics.

    http://www.devshed.com is my fav tutorial library
     
  7. #7
    Alex

    Alex Ambient

    Joined:
    Jul 13, 2002
    Messages:
    1,552
    Likes Received:
    4



    Here is an example of a template page of LPA that PHP reads and then makes.

    Code:
    {%}{title.News}{pagetitle.Linkin Park News}{networktitle.Network}{vis.1}{%}
    {tmpl.head}
    {content.17.10}
    {tmpl.colbreak}
    {Nad}
    {tmpl.foot}
    
    :chemist:
     
  8. #8
    Will

    Will LPA Addicted VIP LPA Addicted VIP

    Joined:
    Aug 25, 2002
    Messages:
    35,486
    Likes Received:
    38



    That right there is what I want to learn.

    Simplify my pages. :chemist:
     
  9. #9
    d0dGy MiKE

    d0dGy MiKE Well-Known Member

    Joined:
    Aug 1, 2002
    Messages:
    231
    Likes Received:
    0



    Code:
    {%}{title.News}{pagetitle.Linkin Park News}{networktitle.Network}{vis.1}{%}
    {tmpl.head}
    {content.17.10}
    {tmpl.colbreak}
    {Nad}
    {tmpl.foot}
    Isn't that using string replacements?
    =========================
    A personal favourite of mine is http://www.phpfreaks.com/ it has the full php command index and also specialises in demonstrating some of them to make it more understandable, seeing as the documentation from php.net is really confusing for beginners
     
  10. #10
    Omar

    Omar Administrator LPA Super Member

    Joined:
    Jul 13, 2002
    Messages:
    4,272
    Likes Received:
    18



    no will, ur running away from me lol

    How can I make the site so that I can change the design without having to change every page manually?
     
  11. #11
    d0dGy MiKE

    d0dGy MiKE Well-Known Member

    Joined:
    Aug 1, 2002
    Messages:
    231
    Likes Received:
    0



    well what you could do let say have one template and the only bit you wud have change is the "content" area. and you would all all ur nice luvly links like index.php?p=stuff... provided that the template is called index.php and the content for that specific example is called stuff.
    First you'd make your design template and then where you want the content area to go put in this code:
    Code:
       <?php
     	if(!isset($p)) {
         $p = "home"; }
         include("content/" . $p . ".php");
       ?>
    What that says is if a variable 'p' is not set then p will automatically be set to 'home' . so when it gets to the include() it will pick up the file within the 'content' directory and plonk it into that content area space that u put the code. [ that sounds so confusing :p]

    What you do is for all of your bits of content, such as lets say two pages called 'music' and 'lyrics' the links to those pages would be :
    [*]index.php?p=music
    [*]index.php?p=lyrics
    and if you input those into the php coding instead of the variable $p it would look like
    [*]include(content/music.php);
    [*]include(content/lyrics.php);

    I made that worse than it really is, all u gotta do is make a directory called 'content' and put all of your content files into that direcotry. make your main template and then finally stick that bit of coding where yu want the coding to go.

    it's possible to play around with the code to do lots of other things, you cud rename the variables and directoy name if you want... thats hwat i like about php, so much more scope than regular html
     
  12. #12
    Alex

    Alex Ambient

    Joined:
    Jul 13, 2002
    Messages:
    1,552
    Likes Received:
    4



    In a way yes but a lot more toys are coded into the site then you can see. And dont forget that 100% of LPAs content is stored in a database and not to file. LPA is the most dynamic site ive coded to date.
     

Share This Page