Standard PHP library, PEAR, and templates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jay

    Standard PHP library, PEAR, and templates

    Newbie alert.

    Is the standard php library exclusively for PHP5 or is there one for PHP4?
    How do I start using it? Is there a require or include directive needed in
    order to make use of it?

    Same question for PEAR. Is there a PEAR for PHP4 or only for PHP5? How do I
    start using its facilities? Is there a require or include directive?

    Lastly, I'd like to start using templates. From what I've read, they
    simplify code so I don't have to play quoting games like:

    echo "foo=\"blah \"" . $foo['bar'] . 'blah' . "bar$foo=\"blah \"";

    which is a real drag. I can usually simplify lines like above, but they
    never completely simplify to my satisfaction. Googling revealed a bunch of
    template libraries. Is there a generally accepted standard one?

    I'm using Debian testing/PHP4/Apache/mysql (but thinking of switching to PHP5
    and postgresql).

    Thanks!
  • Meião

    #2
    Re: Standard PHP library, PEAR, and templates

    There is PEAR for PHP4.
    as far as i can remember it is bundled with php. unless you're using
    Debian packages, then you need to install php4-pear.
    you need to include (or require) the pear module you want to use. Check
    the examples on PEAR page.

    Now, standard PHP library? All the stuff in the documentation is
    bundled in PHP. You only need to include external modules.

    about quoting:
    echo "$bar"; //displays $bar contents
    echo '$bar'; // displays $bar (the string)

    you can:
    echo "foo=\"blah\"$f oo['bar']blahbar$foo=\"b lah\"";
    even though this string is illegible

    Comment

    • Sean

      #3
      Re: Standard PHP library, PEAR, and templates


      Jay wrote:[color=blue]
      > Newbie alert.
      >
      > Is the standard php library exclusively for PHP5 or is there one for PHP4?
      > How do I start using it? Is there a require or include directive needed in
      > order to make use of it?[/color]

      I think it is only available in php 5 (not sure though!). And is
      included by default in PHP5.
      [color=blue]
      >
      > Same question for PEAR. Is there a PEAR for PHP4 or only for PHP5? How do I
      > start using its facilities? Is there a require or include directive?
      >[/color]

      Allot of pear libraries are php 4 and 5 compatible. To use a pear lib
      like DB you will need to put include('DB.php ') in your scripts. Each
      library should state if it is compatible with php 4 and 5 and the most
      popular ones are compatible with both.
      [color=blue]
      > Lastly, I'd like to start using templates. From what I've read, they
      > simplify code so I don't have to play quoting games like:
      >
      > echo "foo=\"blah \"" . $foo['bar'] . 'blah' . "bar$foo=\"blah \"";
      >
      > which is a real drag. I can usually simplify lines like above, but they
      > never completely simplify to my satisfaction. Googling revealed a bunch of
      > template libraries. Is there a generally accepted standard one?
      >
      > I'm using Debian testing/PHP4/Apache/mysql (but thinking of switching to PHP5
      > and postgresql).
      >
      > Thanks![/color]

      Allot of people have their own preferences. But I would say if there is
      a standard one is it smarty.

      Comment

      Working...