Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    App::ZofCMS::Plugin::DBI 0.0402

    Download button

    No screenshots available
    Downloads: 276  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Zoffix Znet | More programs
    Perl Artistic License / FREE
    May 28th, 2012, 13:12 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    App::ZofCMS::Plugin::DBI description

    DBI access from ZofCMS templates

    App::ZofCMS::Plugin::DBI is a App::ZofCMS plugin which provides means to retrieve and push data to/from SQL databases using DBI module.

    Current functionality is limited. More will be added as the need arrises, let me know if you need something extra.

    This documentation assumes you've read App::ZofCMS, App::ZofCMS::Config and App::ZofCMS::Template

    SYNOPSIS

    In your main config file or ZofCMS template:

     dbi = > {
     dsn = > "DBI:mysql:database=test;host=localhost",
     user = > 'test', # user,
     pass = > 'test', # pass
     opt = > { RaiseError = > 1, AutoCommit = > 0 },
     },

    In your ZofCMS template:

     dbi = > {
     dbi_get = > {
     layout = > [ qw/name pass/ ],
     sql = > [ 'SELECT * FROM test' ],
     },
     dbi_set = > sub {
     my $query = shift;
     if ( defined $query- >{user} and defined $query- >{pass} ) {
     return [
     [ 'DELETE FROM test WHERE name = ?;', undef, $query- >{user} ],
     [ 'INSERT INTO test VALUES(?,?);', undef, @$query{qw/user pass/} ],
     ];
     }
     elsif ( defined $query- >{delete} and defined $query- >{user_to_delete} ) {
     return [ 'DELETE FROM test WHERE name =?;', undef, $query- >{user_to_delete} ];
     }
     return;
     },
     },

    In your HTML::Template template:

     < form action="" method="POST" >
     < div >
     < label for="name" >Name: < /label >
     < input id="name" type="text" name="user" value="< tmpl_var name="query_user" >" >< br >
     < label for="pass" >Pass: < /label >
     < input id="pass" type="text" name="pass" value="< tmpl_var name="query_pass" >" >< br >
     < input type="submit" value="Add" >
     < /div >
     < /form >
     
     < table >
     < tmpl_loop name="dbi_var" >
     < tr >
     < td >< tmpl_var name="name" >< /td >
     < td >< tmpl_var name="pass" >< /td >
     < td >
     < form action="" method="POST" >
     < div >
     < input type="hidden" name="user_to_delete" value="< tmpl_var name="name" >" >
     < input type="submit" name="delete" value="Delete" >
     < /div >
     < /form >
     < /td >
     < /tr >
     < /tmpl_loop >
     < /table >



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    SQL database | App::ZofCMS plugin | Perl module | App::ZofCMS | SQL | database

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM