scripting workflow - PHP

This is a discussion on scripting workflow - PHP ; I just have a few questions regarding workflow when producing scripts. First off, do people prefer to have all their code in one file? Or multiple separate files? I know functions and classes are good to keep in separate files, ...

+ Reply to Thread
Results 1 to 4 of 4

scripting workflow

  1. Default scripting workflow

    I just have a few questions regarding workflow when producing scripts.

    First off, do people prefer to have all their code in one file? Or
    multiple separate files? I know functions and classes are good to keep
    in separate files, but i am talking about say for example a news
    system, etc.

    Next off, how about when actually assembling the files? Do you produce
    all of your html output, then say build all of your functions - then
    say build the logic?

    Does that make sense?

    I had in the past use DW for building php apps, and as an exercise to
    myself I am forcing myself to hand code to learn better. But I do
    however want to increase my productivity.

    If anyone has any pointers on this type of stuff - it would be much
    appreciated!

    Thanks!

    d

  2. Default Re: scripting workflow

    Hi,

    I don't have your problems because I use a Template Engine.
    I usually have one main PHP script for the application, which doesn't deal
    with HTML directly. Other PHP scripts are libraries or special objects
    like the Template Engine itself.
    This also enables me to work WYSIWYG with user interfaces (templates).

    -------------------
    Skrol 29
    www.tinybutstrong.com
    -------------------

    "DuSTiN KRySaK" <mailinglists@digitalcollision.com> a écrit dans le message
    de news: 8217b6d00f799818de0ad8030d1e0436@digitalcollision.com...
    >I just have a few questions regarding workflow when producing scripts.
    >
    > First off, do people prefer to have all their code in one file? Or
    > multiple separate files? I know functions and classes are good to keep in
    > separate files, but i am talking about say for example a news system, etc.
    >
    > Next off, how about when actually assembling the files? Do you produce all
    > of your html output, then say build all of your functions - then say build
    > the logic?
    >
    > Does that make sense?
    >
    > I had in the past use DW for building php apps, and as an exercise to
    > myself I am forcing myself to hand code to learn better. But I do however
    > want to increase my productivity.
    >
    > If anyone has any pointers on this type of stuff - it would be much
    > appreciated!
    >
    > Thanks!
    >
    > d


  3. Default RE: [PHP] scripting workflow

    > First off, do people prefer to have all their code in one
    > file? Or multiple separate files? I know functions and
    > classes are good to keep in separate files, but i am talking
    > about say for example a news system, etc.


    For me, this largely depends on project size and the types of
    functions/classes I'm making. If it's a huge project, I may make a few files
    with the functions/classes that are similar so I only have to include the
    fewest amount (hopefully one) per function of the script. If the script
    itself is small (say, under 500 lines) I'll probably just write it all in
    one file if the script itself has one main purpose. But really, this will
    depend from project to project.

    > Next off, how about when actually assembling the files? Do
    > you produce all of your html output, then say build all of
    > your functions - then say build the logic?


    I typically make a "header" and a "footer" file and include those when
    necessary. The script itself produces the content and just fills in the
    middle between the header and footer.

    Other people will likely use templating engines (Smarty being a popular
    choice) for larger projects where a good separation of content and design
    are needed.

    > I had in the past use DW for building php apps, and as an
    > exercise to myself I am forcing myself to hand code to learn
    > better. But I do however want to increase my productivity.
    > If anyone has any pointers on this type of stuff - it would
    > be much appreciated!


    Personally, I think the most important aspect of productivity is knowing how
    to identify and use the right tool for the job. And as such, getting a lot
    of exposure to the different tools and options you have available is the
    most important factor in knowing what tools are at your disposal.

    Other people with stronger opinions of specific tools will likely have a lot
    to say about those methods, but I prefer versatility to knowing one or two
    tools/utils/apps very well.

    Just my $.02.

    -M

  4. Default Re: scripting workflow

    I hand code everything I do in php. I separate functions and class in
    referenced files that are grouped by function in the site(i.e. - all queries
    are in queries.php, the db connection is done in dbconn.php, etc...). This
    will allow a project to grow without having to rewrite everything. Also
    debugging is easy. If you know a query is failing, open the queries.php
    file.

    The structure I use is to build the entire page as a variable, usually
    called $page, that I print after it has been completed. So from the html
    doctype tag to the closing html tag I simply append to one variable and
    print.

    CJ


    "DuSTiN KRySaK" <mailinglists@digitalcollision.com> wrote in message
    news:8217b6d00f799818de0ad8030d1e0436@digitalcollision.com...
    >I just have a few questions regarding workflow when producing scripts.
    >
    > First off, do people prefer to have all their code in one file? Or
    > multiple separate files? I know functions and classes are good to keep in
    > separate files, but i am talking about say for example a news system, etc.
    >
    > Next off, how about when actually assembling the files? Do you produce all
    > of your html output, then say build all of your functions - then say build
    > the logic?
    >
    > Does that make sense?
    >
    > I had in the past use DW for building php apps, and as an exercise to
    > myself I am forcing myself to hand code to learn better. But I do however
    > want to increase my productivity.
    >
    > If anyone has any pointers on this type of stuff - it would be much
    > appreciated!
    >
    > Thanks!
    >
    > d


+ Reply to Thread