Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Looking for somebody who will tutor me in PHP

    I want to learn PHP, but reading tutorials is getting hard for me. I learned HTML by looking at the coding and the webpage and matching up the codes to what it does. It's hard to find php scripts for websites because when you look at the source it's all in HTML. I'm a quick learner so you won't have to help me for very long. I just need somebody to guide me through it.

    I want to be able to create a website similiar to this

    http://www.rachelmcadams.org

    I could probably figure out how to do that layout in HTML, but she uses PHP and I was wondering if one of you all could figure out what she did and explain it to me.

    I hope I explained myself well enough...

  • #2
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    I think you may have to bite the bullet on this one. And try to take a few tutorials and there are some that are pretty straight forward. Atleast take a tutorial and build up some kind of foundation. This would make it easier for you and your tutor. PHP tutorial If you have any questions then I am sure the folks here wouldn't mind helping you. But try and help yourself a little first.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #3
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I actually have already. I've been reading up on tutorials on various different sites, all of which say the same thing. I've looked at a few scripts I downloaded from various places and can point out variables, functions, etc. I have a bit of basics already. It's the application part that's getting to me. I already asked my former host to set up an account for me that I can practice with. I just can't figure out how to use php. I could make a website using frames, a css file, and tables and make it like that Rachel site, but I want to try using PHP instead.

  • #4
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,091
    Thanks
    2
    Thanked 23 Times in 23 Posts
    If you don't find that you are able to learn well using online tutorials, perhaps getting a book would help you better. I would hightly recommend Build Your Own Database Driven Website Using PHP & MySQL. This book is great for beginners and starts out simple, building on each concept as it goes. There are quite a few scripts in the book, each of which is accompanied by an explanation of how they work. Best of all, you can download the first few chapters of the book to try it before you buy it.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #5
    Regular Coder goughy000's Avatar
    Join Date
    Nov 2005
    Location
    England
    Posts
    415
    Thanks
    0
    Thanked 0 Times in 0 Posts
    At the bottom of the page you linked to it says

    Powered by cutenews
    You can download a version of cutenews for free and dont need much php knowledge to install it, it dosnt even use a database

    google it

  • #6
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh thanks. I didn't notice that.

    So how would I use PHP to make a "template" sort of thing? Hm, this might be a little long-winded, excuse me.

    You know how you can use a css file and frames to make a website so whenever you change the layout, you only have to change the css file and positioning the frames? That's how I used to make websites. How would I convert a website like that over to PHP? I can't figure out how people use PHP in their websites.

    Like, for example, another Rachel website (I was on a 'The Notebook' picture spree last night)

    http://www.rachel-mcadams.com/

    If I were to code it, I would've used frames. To make a website that huge, I couldn't possibly come up with the time to change every single page each time I changed the layout, so I would use frames so I would only have to change one page. Is there a way to use PHP instead?

    I don't understand how I would to do that and that's what I wanted somebody to help me with. I want to save myself time and also stop using frames because they start be annoying after a while.

    I apologize if I'm confusing, but I'm sort of confused myself. Help?

  • #7
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.zend.com/php/beginners/index.php

    You have a couple of options for a template.

    You can create a few files which you will include on every page

    e.g.
    header.php
    menu.php
    footer.php


    page.php
    PHP Code:
    <?php
    include('header.php');
    include(
    'menu.php');
    ?>
    <!-- CONTENT -->
    <h1>hello</h1>
    <?php
    include('footer.php');
    ?>

    Another option is to have a full template page where you include the content. This can also be referred to as a content management system.

    PHP Code:
    <?php
    include('header.php');
    include(
    'menu.php');
    ?>
    <!-- CONTENT -->
    <?php
    include($_GET['page']);
    <?
    php
    include('footer.php');
    ?>
    This is a basic example
    http://degs.co.uk/test/hct/include%20via%20url/

  • #8
    New to the CF scene
    Join Date
    Dec 2004
    Location
    Manchester
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    I think you are getting a little confused! There is no conversion from HTML, CSS to PHP. PHP code is more than often embedded inside HTML. The fact that the page has a .php extension suggests this (although using PERL's MOD_REWRITE allows you to basically use any extension but dont worry about that right now). PHP is used to add dynamic functionality to a web site as the http protocol is purely static and HTML on its own cannot achieve this.

    Let me give you a quick example

    Here is a bit of HTML that prints out usernames and login times (this may be used as some kind of report)
    <table>
    <tr>
    <th>Username</th>
    <th>Last Login</th>
    </tr>
    <tr>
    <td class="user">Joe.Bloggs</td>
    <td class="login">01/01/2006</td>
    <tr>
    <tr>
    <td class="user">Super.Man</td>
    <td class="login">15/01/2006</td>
    <tr>
    </table>

    Now this is a bit pointless really because using HTML on its own means that you have to manually add to the table to keep the report upto date for you system admin to see. What we need is a database that stores usernames and login times that we can report on. HTML does not have the ability to connect to any database so that is where PHP comes into play.

    Here is the above example again only this time we are using a loop in PHP to list out all the users and their logon times from a database (Forget about the code syntax if you are learning).

    <table>
    <tr>
    <th>Username</th>
    <th>Last Login</th>
    </tr>
    <?php
    $db->query("select name, logintime from users");
    while($row = $db->fetchRow()) {
    ?>
    <tr>
    <td class="user"><?php print $row['name']; ?></td>
    <td class="login"><?php print $row['logintime']; ?></td>
    <tr>
    <?php } ?>
    </table>

    Like the other posts mention, you require a beginners guide to kick start yourself. The penny will drop. If you want to make a web site like the one you mention then use your HTML,CSS knowledge to build up a page template but save the files with a .php extension. Then when you get to grips with php you can start to embed your php code in the template to print out news items, pictures, etc..

    Obviously your testing server requires php be installed or files with a .php extension will not run. You cannot preview .php files in your web browser from a local file location either unless php is running on your own computer.

  • #9
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for that website. I haven't ever come across it before and at a glance it looks really helpful (It'll give me something to look at during the ridiculous american idol commercials. What happened to the one-sponsor thing?!)

    I guess I worded it wrong. I didn't really mean "convert". I guess I just wanted to figure out how to use PHP instead of gobs of HTML that gets crazy when a website gets so big.

    I'm trying to get a paper started at my school and my principal mentioned wanting it online since it's easier. I knew that would bring a huge obstacle because we'd have to find somebody to make it and I thought if I could master PHP over the summer and make the website myself and keep it up it'd be so much easier. I found this one online paper that looked REALLY awesome and I realized that it was all coded in PHP. I hope I can get a hang of it!

  • #10
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    Perhaps it would be useful if I mentioned how I learnt PHP.

    To begin with I built a page for a site as normal using HTML and CSS. I then identified areas of that page that would be identical or near identical on every single page. As suggested above, these areas will typically be the header, navigation and footer of each page.

    Then, I started taking the code for these sections out of the main template and putting it in a seperate file. These seperate files are then called in to the main template by use of <?php include('file');?>. Once you've done that, you can happily build a 1000 page site knowing that you'll be able to change the included sections of every page simply by editing one file.

    Later, I began to realise that while this was pretty great, without embellishment it's also fairly inflexible. What if I wanted to have slightly different navigation on a few pages, or add a banner to the homepage only? This is where you start picking up on some of the other slightly more advanced basics of php - things like switch statements and if/else statements that allow you to generate a different outcome based on criteria that you set. In the above examples, you could use php to fetch the current URL of the page, and then change the content of the header or navigation areas based on this.

    Learning while doing a task like this is the best way to pick things up if you ask me. The above gives you the basics of a quickly editable website; when combined with clever use of CSS you can achieve your goal of being able to change the layout, design and content of an entire site very quickly.

    Until you have done the above, I wouldn't worry about trying to learn anything more than the basics. It's one of those things where you can just keep building up the complexity of the code as you go quite happily.

    I did however have a book on php to hand at all times and this proved invaluable, I would definately advise you to buy one -- it doesn't have to be a huge tome, any small beginners guide is going to do the job. Also, the PHP manual is great for finding out what a particular function does and how to implement it. Meanwhile, this forum is great for finding out what function you need to achieve a particular outcome in the first place

    Hope that's of some use...

  • #11
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My consulting fee is 175$'s an hour. If you can afford it I can do what ever you want me to do
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #12
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be rich, Spirt!

    I was trying to read up on switch statements when I figured out that's what the rachel site was using (or I think it was that site. Might be the school paper site). It changes the URL does it not? Because I was looking at the switch tutorial and it was like php?x=whatever and the whatever was a case. I didn't quite understand the point of using them. Somebody mind letting me in on the great use of it? Or correct me if what I think it is is wrong.

  • #13
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jenmarie
    You must be rich, Spirt!
    You dont have to pay health care...
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #14
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    I was trying to read up on switch statements... It changes the URL does it not?
    That's not quite correct, it's more likely what you were reading was changing something else based on the URL.

    Switch is used to compare one value to a number of other values (the individual cases you were talking about) and when php finds a match it executes the code found in the matching case. An incredibly simple (and completely useless) example using a switch statement - I have commented this throughout so you can see what's going on.
    PHP Code:
    <?php 
    $number 
    2   //this sets the value of $variable to 2.

    switch ($number) { //this tells php that it should compare $number to the different cases within the switch statement.

    case 1//the first case
    $text 'Case 1 is a match'//the resulting code should case 1 be a match for $number, in this case I simply assigned some random text to the $text variable.
    break; // a break ends each case.

    case 2:
    $text 'Case 2 is a match';
    break;

    case 
    3:
    $text 'Case 3 is a match';
    break;

    default:
    $text 'None of the cases matches the value of $number';
    break;

    // remember to close the switch statement!

    echo $text// prints out the text assigned to the $text variable.
    ?>
    So what is the end result of this code?

    Case 2 is a match
    Can you see how this works in essence now?
    Last edited by Pennimus; 02-22-2006 at 11:53 PM.

  • #15
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess. But what's the point? How do you use that with the websites?

    http://www.digital-web.com/articles/easypeasy_php/

    That's the tutorial I was reading about switches. I saw that it had $id in it and then in the website links it was ?id so that's how I connected it. They also used include.

    This all just gives me a headache, haha. Maybe I should tackle it when I really know what my website to look like. Gee, Jen, what an idea.

    Thanks for helping though. I appreciate it.
    Last edited by jenmarie; 02-23-2006 at 12:31 AM.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •