Results 1 to 8 of 8

Thread: Unnecessary PHP? Alternatives?

  1. #1
    Join Date
    Jul 2008
    Location
    Pittsburgh, PA, USA
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Unnecessary PHP? Alternatives?

    Hey all. Here's the question:

    I've got a client who wants this: A page with links about different breeds of dogs. You click on the breed name, and it lets you view a 'statistics' page, which has photos, facts, etc. She suggested PHP to do this, but I think PHP might be unnecessary; I get the feeling there might be a quicker-to-integrate solution. I'm no PHP pro, and I've been wanting to learn PHP for a bit now, but this project is has a time frame I don't think I should be learning on her dime.

    That being said, if PHP would provide the simplest solution, and someone could provide link to a tutorial, that would be great. I'm open to any other ideas for a cool way to do this other than the obvious: straight up HTML.

    What would you guys do? Thanks...

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    It really depends on the workflow.

    What you could PHP for would be to have a database-driven website. So, the client could input a new breed, change images, facts, etc... at will.

    You could certainly hand code all the pages and link them up manually. If there is no need for dynamic content, or you want to be informed every time a new page is to be added then static HTML pages would be easier and 100% the way to go.

    Bascially, if you need a CMS (and don't want to use a commercial or open source solution), learn PHP. Otherwise, I don't see how PHP is applicable in the site you're working on.

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    In general, realize that PHP [only] generates HTML. [That is, it doesn't make special html-- it just automates the process of writing it somewhat.]*
    If you think it would be beneficial (that is, in the ways medyman listed) to have PHP generate content or templating, then use it.

    PHP is almost always harder to setup (especially if you aren't used to it), but also always easier to maintain (assuming it is setup well), and also very expandable.

    For a single page, a PHP system would rarely make sense. If you have 10 pages, however, using one PHP script (with a changing variable, for example), would save a lot of time.


    In this case, one advantage of PHP or a CMS is that your client could do all of the data work herself if you setup a management system. Easier, but only after the hard work is done.


    Anyway, rather than having us decide for you, here's a way you can decide yourself:
    Pick how you will store the data (and how it will be managed). Will you have a database? XML/text document on the server? Written right into the web page?
    Now, once you know that, it's simply a matter of getting the data. (And the approach for that is easy to pick, such as PHP for a database-- we can also help more once you know more about your method.)

    [EDIT: *added in edit for emphasis]
    Last edited by djr33; 08-17-2008 at 09:10 AM.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jul 2008
    Location
    Pittsburgh, PA, USA
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the quick responses.

    If I went with anything other than HTML it would have to be PHP. The client already has a MySQL database set up, and a working system for updating content using PHP. On the other hand, the client is learning HTML and plans to take over more basic site maintenance as time goes on. The plan is to have many 'stats' pages, and always be adding more, so it might be best to go with PHP.


    The previous people who managed the site are being slow on getting me the MySQL login info, but once I get it, is there a good tutorial that can illustrate to me what I need? I've only actually written PHP for MySQL a couple of times (user login and restricted access pages...etc), but I've edited it much more often, so at least I'm somewhat familiar.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I still use this for anything I forget. It's a great tutorial.
    http://php-mysql-tutorial.com
    It's easy and gets the point across. It doesn't go into great detail, but you can always refer to documentation on http://www.php.net for functions, and you can find other references for more complex MySQL.
    The basics are explained really well, though. (And it has some examples of projects you can try, or at least look at.)


    At this point, I'd say that going with PHP is definitely the right path. It will be harder than just setting up basic html pages, but it really makes more sense.
    If your client must have this quickly and won't wait for you to figure out the PHP, then basic HTML will get it done, but it just won't be nice to work with.


    If you want a really basic approach to a PHP method, here's an idea:

    1. Create a template page, which wants variables.
    Here's an example, and it's basic, but entirely expandable.
    PHP Code:
    <html>
    <head>
    <title><?php echo $title?></title>
    </head>
    <body bgcolor="<?php echo $bgcolor?>">
    <p>
    <?php echo $content1?>
    </p>
    <h1><?php echo $header?></h1>
    Date: <?php echo $date?><br>
    Type: <?php echo $type?>
    </body>
    </html>
    2. Now you can create a page to use that template:
    PHP Code:
    <?php
    $title 
    'This is my page!';
    $bgcolor '#00FF00';
    $content1 'Here\'s a bunch of content.<br>
    It\'s spanning a few lines and stuff.'
    ;
    $header 'Here\'s a big title on the page';
    $date 'January 1, 2000';
    $type 'Official';
    include(
    'template.php'); //NAME [and path] OF YOUR OTHER PAGE!
    ?>
    3. Here is what you end up with when you visit the page:
    [note: both pages must be named .php]

    Code:
    <html>
    <head>
    <title>This is my page!</title>
    </head>
    <body bgcolor="#00FF00">
    <p>
    Here's a bunch of content.<br>
    It's spanning a few lines and stuff.
    </p>
    <h1>Here's a big title on the page</h1>
    Date: January 1, 2000<br>
    Type: Official
    </body>
    </html>

    This is so easy to setup, it seems like a great solution for you. However, the problem is that this doesn't do any parsing of the text. So you and your client will need to use HTML and also escape any single quotes (see $content1 above).

    I hope this gets you started.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. The Following User Says Thank You to djr33 For This Useful Post:

    bistromath (08-17-2008)

  7. #6
    Join Date
    Jul 2008
    Location
    Pittsburgh, PA, USA
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Good links. I remember using php-mysql-tutorial.com, but I lost track of it. Looks like your example will be a good starting point for what I need. Thanks!

  8. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Realize that the example is a very basic (and very limited) way of doing this, and does not work with a database. It's just another way to go about it if you can't devote the time to getting the db working.
    (It may also give you some basic ideas for how to setup the page, though, so it's not a bad idea to see how it works.)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #8
    Join Date
    Jul 2008
    Location
    Pittsburgh, PA, USA
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Right, but it's a good start, and like you said, it's something I can expand on. The last developer is being slow getting the MySQL info to us anyway, and the client wants this done, so I think this is the right path for now. Thanks again.

Bookmarks

Posting Permissions

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