SitePoint Sponsor

User Tag List

Page 2 of 4 FirstFirst 1234 LastLast
Results 26 to 50 of 99
  1. #26
    SitePoint Wizard Ren's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    1,060
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    Useful classes for you are

    * GD
    ...
    I've a Canvas interface, with implementations for GD, SVG using PHP5 DOM, Ming for SWF, and CPDF for PDF, plus a little helper for GD to create HTML client side image maps. (Pens & Fills can have a URL attached, which for SVG & SWF gets combined directly into the image.)

    Ontop of that have graphs/charting, so can generate pie charts, 3d pie charts, 3d bar charts, including grouped, stacked variations, in any of the 4 formats.

  2. #27
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  3. #28
    SitePoint Addict
    Join Date
    May 2003
    Location
    The Netherlands
    Posts
    391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I normally use abstract and concrete ...

    I know, damn noise, but I couldn't help it ...

  4. #29
    SitePoint Wizard
    Join Date
    Jul 2004
    Location
    Minneapolis, MN
    Posts
    1,924
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm currently working on some reusable classes for a couple of my projects, but at the time I only reuse:

    - Error Handling/Logging
    - Validation (various validation functions)
    - Page Load (loads a config file, language, and database connection, commonly used in my programs)

  5. #30
    SitePoint Addict
    Join Date
    Apr 2002
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Session Handler Class (gc, saves to database)
    Datagrid Class (like the one in .NET)
    Mysql Classes (Statement, Result)
    Drop-Down Class (create an HTML select by passing it an array)
    User Class (new user, save to session, validate user)
    Last edited by warjockey; Mar 30, 2005 at 10:10.

  6. #31
    Google Engineer polvero's Avatar
    Join Date
    Oct 2003
    Location
    Mountain View
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    These are my favorite classes which I like to reuse a lot (which I've built).
    The first does a DB back up of the fields you want and outputs a csv file nicely

    PHP Code:
    /////////////////////////////////////////////////////
    /*                                    |
    | Project Author: Dustin Diaz                    |
    | Script Name: CSV DB Export                  |
    | Script Release Version: 1.0                    |
    |                                    |
    ////////////////////////////////////////////////// */
    /*
    Script Execution Description:
    The following class will gather a list fields in a Database and export
    them into a csv or tab delimmited format. The user will be prompted to save the document 
    to their own hard drive however a local server copy will also be stored in the $folder var.
    Note: to reuse this class, you must supply a folder name that has global writable permissions. (CHMOD 777)
    */

    class exportInfo
    {
    var 
    $export_type// This configures the type of file you'll be exporting. 2 Params include 'csv' or 'txt'
    var $export_folder// path to exported folder. May be relative or absolute.
    var $runquery// query ran to fetch information
    var $fields = array(); // holds array of fields that will be exported. This is what will show up in the exported file

        
    function exportInfo $type,$folder,$query,$fields )
        {
        
    $this->export_type $type;
        
    $this->export_folder $folder;
        
    $this->runquery $query;
        
    $this->fields $fields;
        }
        
        function 
    runAll ()
        {
        
    // Run 'em and Go
        
    $this->generateFields();
        
    $this->export();
        }
        
        function 
    generateFields()
        {
            while ( 
    $r mysql_fetch_array($this->runquery) )
            {
                for ( 
    $k=0$k count($this->fields); $k++ )
                {
                    
    $this->fieldsReturn .= $r{$this->fields[$k]}.", ";
                }
            
    $this->fieldsReturn .= "\r\n";
            }
        }
        
        function 
    export()
        {
        
    header("Pragma: public");
        
    header("Expires: 0");
        
    header("Cache-Control: private");
        
    $today date('m-d-Y-h-i-s');
        
    $file_name 'exports_'.$today;
        
    $go fopen $this->export_folder.$file_name.'.'.$this->export_type'w' );
        @
    fwrite$go$this->fieldsReturn );
        @
    fclose($go);
        
    // We'll be outputting a txt
        
    header("Content-Type: application/octet-stream");
        
    // It will be called filename.ext
        
    header('Content-Disposition: attachment; filename="'.$file_name.'.'.$this->export_type.'"');
        
    // header("Location: exports/$file_name.txt");
        
    @readfile($this->export_folder.$file_name.".".$this->export_type);
        die();
        }
    }

    $fieldNames = array('sampleField1','sampleField2','sampleField3');
    $eQ mysql_query("select * from tblName where ".$conditions." order by sampleFild1");
    // Let's get this pawty stawted...
    $exporter = new exportInfo ('csv',"/exportsFolder/",$eQ,$fieldNames);
    // Run 'em and flea!
    $exporter->runAll(); 
    This next function is just a general function I think I attach into my global functions file site wide... it basically converts a full sql date into how you like:

    PHP Code:
    function convertSqlDate$sqlDate,$dateParams )
    {
    $ex_full_date explode(" "$sqlDate);
    $ex explode("-"$ex_full_date[0]);
    $date date($dateParamsmktime(0,0,0,$ex[1],$ex[2],$ex[0]));
    return 
    $date;


  7. #32
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,037
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I'm still doing PHP4 for Development and haven't made any inroads to PHP5... Yet....

    So, I've been a huge fan of Harry F's MySQL and MySQLResult classes. I only slightly tweaked them to suit my quirky style of programming adding a few functions to the MySQL class. I also use DOMXML.
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  8. #33
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Maine
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by someonewhois
    paging
    Can I please see that class, and how you implement it? It sounds interesting.

    As for me, I started my site when I knew nothing about OO...or databases for that matter. I always just wing it.

    So as of now, I only have a pwnage BBCode class/engine. ^_^

    In version 2, however, I plan to base the whole thing around OO (PHP4, though. ) Hopefully, I'll also get a DS soon after.

    I'm already working on my template for it.

    The API, by the way, is going to go open source.


  9. #34
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    Australia
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ren
    Most of database classes have become redundant since moved to PDO / PHP5, that does connections, prepared statements, result iterators.
    An adaptor for PDOStatement to SeekableIterator pretty replaces all that, for common applications.
    Wow! I didn't realise this I've been using ADODB database abstraction for ages now and its easily my most used class. Or are you not refferring to database abstraction? (runs to php.net to look).

    Other than that, a simple cart class that I often plug in for simple shopping and a 'user' class which handles authentication, new user creation etc etc.

  10. #35
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've been using ADODB database abstraction for ages now and its easily my most used class.
    Time to play catch up then

    Documentation on PDO is a bit scarce though, bar the Oracle article and a presentation, I've not seen anything else

  11. #36
    I <3 Internet Tekime's Avatar
    Join Date
    Dec 2003
    Location
    Maine
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use ADODB everywhere, everything else is custom. I would die without my classes.

    template class
    session class
    resourcepool class
    validation class
    parsing class
    tree class
    user class
    permission class
    components class
    menu class
    config class
    gui class
    Scriptalicious SEO Scripts
    Save 20% with coupon code SPROCKS


  12. #37
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    Australia
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    Time to play catch up then

    Documentation on PDO is a bit scarce though, bar the Oracle article and a presentation, I've not seen anything else
    Seems I'm not the only one, quite a few still using ADODB.
    .. oh now I realize why - "This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk." (http://au2.php.net/pdo)

    and...

    The following drivers currently implement the PDO interface:

    Driver name Supported databases
    PDO_DBLIB FreeTDS / Microsoft SQL Server / Sybase
    PDO_FIREBIRD Firebird/Interbase 6
    PDO_MYSQL MySQL 3.x/4.0
    PDO_OCI Oracle Call Interface
    PDO_ODBC ODBC v3 (IBM DB2 and unixODBC)
    PDO_PGSQL PostgreSQL
    PDO_SQLITE SQLite 3.x

    ADODB has a few more I believe. (even though I only use postgres and mysql 90% of the time).

  13. #38
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This extension is EXPERIMENTAL.
    Go on, live on the edge

    It's experimental true, but at the moment, so is PHP5. At the end of the day, if the developers of PHP5 can't fix the bugs, etc PHP5 could I suppose in the most extreme case, fall flat on it's face?

    Stranger things have happened. But seriously, I don't thing there is too much to worry about this extension being experimental. The DOM in PHP4 is experimental, and if that extension had to change, a lot of websites today would break for example. Can you honestly see this extension (PHP4 DOM) changing?

  14. #39
    SitePoint Zealot tabula's Avatar
    Join Date
    Nov 2004
    Location
    AZ
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Question

    Can someone show some of their input validation classes. These would be interesting to look at. Not necessarily the code to the class, but show the code for using it.


    Also, could someone tell me what they find so useful about user classes?

  15. #40
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A good example is those used by WACT. Download it and have a peek

  16. #41
    SitePoint Member
    Join Date
    Jan 2005
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ADODB, SMARTY, a user authentication class, a cookie encryption class, file handling, a menu class.

    At the moment, all I am doing is using preexisting libraries as I see fit. I am hopefully going to use a consistant methodology that I can use for each of my projects.

  17. #42
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    Australia
    Posts
    381
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WACT looks simultaneously mysterious and interesting (scurries off to learn what refactoring and modular patterns based frameworks are..)

    I'll check it out for sure. I might also start a web page called "When wikis go wrong" the first entry will be http://wact.sourceforge.net/index.ph...rprisePatterns

    As for a user class - mine is pretty straight forward and has functions such as populate_user, validate_user, remove_user, update_user, etc etc. Used in conjunction with a 'priviledge' class which adds/deletes/checks permissions for users and adds new permission groups it works well. With both I can create user login systems pretty quickly.

    For a ton of pre-made classes, www.phpclasses.org is always good.

  18. #43
    Massimiliano Bruno Giordano sid egg's Avatar
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    1,280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tabula
    Question

    Can someone show some of their input validation classes. These would be interesting to look at. Not necessarily the code to the class, but show the code for using it.


    Also, could someone tell me what they find so useful about user classes?
    Mine just validates based on "rules" (reg-exps). Eregi is the best way to do it.

    *Read the note on the italicized part in Dr. Livingston's post below!
    Last edited by sid egg; Mar 30, 2005 at 09:34.
    GamesLib.com - the slickest, most complete and
    easily navigatible flash games site on the web.

  19. #44
    SitePoint Enthusiast csweb's Avatar
    Join Date
    Dec 2004
    Location
    UK
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I most use
    *user class - checks login, get user info etc
    *display class - asigns content/headers displayes

    And thats it my oo programming is pritty poo i just realised i had loads of function in the user class that i only use once e.g lostpassword i cant work out if thats bad..

  20. #45
    SitePoint Wizard Ren's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    1,060
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pfitz
    Wow! I didn't realise this I've been using ADODB database abstraction for ages now and its easily my most used class. Or are you not refferring to database abstraction? (runs to php.net to look).
    I was referring to my own personal database abstraction classes/libraries.

    ADODB I believe (not used it) still offers some advantages over PDO, in that it assists in writing non-specific database SQL. Things like retrieving metadata, limit support and so on.

    Looking at ADODB, it looks like it has a PDO driver (adodb/drivers/adodb-pdo.inc.php).

  21. #46
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Eregi is the best way to do it.
    This is slower than preg_match( .. ) which I've noted from these forums over the last couple of years.

    Just thought I'd mention it

  22. #47
    Massimiliano Bruno Giordano sid egg's Avatar
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    1,280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    This is slower than preg_match( .. ) which I've noted from these forums over the last couple of years.

    Just thought I'd mention it
    Ooooh? I guess I shouldn't've said something as definitive as "best way".
    GamesLib.com - the slickest, most complete and
    easily navigatible flash games site on the web.

  23. #48
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool

    The classes I use:-
    1) DB Abstraction Class - lifted of from internet, modified a bit by me
    2) Input Validation Class - my own
    3) eMail Class(for HTML/Text formatted emails with attachments) - lifted of from internet, modified a bit by me
    4) encryption/decryption class - lifted partly from internet, shaped by me


    Quote Originally Posted by tabula
    Can someone show some of their input validation classes. These would be interesting to look at. Not necessarily the code to the class, but show the code for using it.
    I built a validation class myself as I didn't find all things that I needed in 1 single validation class from those available online for free.
    Its pretty simple to use
    PHP Code:
    $obVal = new MyValidate();
    $valEmail $obVal->email('me@example.com'); //validate an email address, return true if valid
    $valVar $obVal->isBlank('som text'); //check if a variable is empty or not, returns true if it is empty, I know there's the empty() function, but I didn't know about it then
    $valAlpha $obVal->alpha('12aa'); //check if the input is only alphabets, no whitespaces
    $valAlphaWS $obVal->alphaWS('aass aa'); //check if the input is only alphabets white spaces allowed
    $valAlphaNum $obVal->alphanum('aa11'); //only alpha-numeric characters allowed, without whitespaces
    $valAlphaNumWS $obVal->alphanumWS('aaa aa'); //only alpha numeric characters allowed along with whitespaces
    $valUsername $obVal->username('username'510); //only alpha-num & some spl. characters(_-) allowed in the character length of 5-10. 
    For now these does the work for me, & I re-use it in all my projects. Maybe as the need will arise, I'll expand it. But it uses eregi for all validation, can't help it.


    Quote Originally Posted by tabula
    Also, could someone tell me what they find so useful about user classes?
    you mean why we create classes & use them? They are better than a bunch of functions thrown half here & half there. The functions of a class work together in a much efficient way than a bunch of functions in a library. Sure, I've got loads of functions thrown in a library but they can't be put in a class, I can't justify it, they are better being seperate as none complements other. besides I love the syntax of using object properties in PHP the hyphen-arrow way.
    PHP Code:
    $object->method(); //this is great, gives descriptive meaning to someone looking at it
    obJect.method(); //this is crappy & boring, the C style. 

    Quote Originally Posted by sid egg
    Mine just validates based on "rules" (reg-exps). Eregi is the best way to do it.
    eregi is easy but not the best way. Perl RegEx are less resource intensive than regular RegEx.
    But I guess its ok to use normal RegEx if you don't know Perl-RegEx, like me!!
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  24. #49
    SitePoint Addict Tim_Rogovets's Avatar
    Join Date
    Aug 2003
    Location
    Odessa, Ukraine
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Quote Originally Posted by pfitz
    I might also start a web page called "When wikis go wrong" the first entry will be http://wact.sourceforge.net/index.ph...rprisePatterns
    Omg... Unbelievable. They'd better get rid of all that asap.. Otherwise we'll stop posting links to wact at sitepoint.
    CEO of Grandiz! - a team based in Odessa, Ukraine.
    Designing and developing sophisticated web apps on CodeIgniter!

  25. #50
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    http://wact.sourceforge.net/index.php/FormValidation

    I started fixing this page, who wants to help me go through the pages and clean them up?
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us


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
  •