DBIx-CGITables

 view release on metacpan or  search on metacpan

CGITables.pm  view on Meta::CPAN

 + -      ...... value with multiple fields
 * -      ...... Operator for DB column key

 $ - misc options to Recordset and CGITables.

 = - execute commands to Recordset

 ? - extra output (typically ?id and ?count)

 ; - If you need extra parameters for containing state, start the
     variable name with one of those "comment" signs to avoid possible
     clashes.


=head2 Supported and future parameters

Supported parameters:

!!Filename - defaults to $ENV{PATH_TRANSLATED}

!!ParamFileDir - Default directory for finding ParamFile

!!ParamFile - See below for default.  Ignores ParamFileDir.

!!QueryClass - defaults to 'CGI', but I'm intending to head for CGI::Fast

!!Query - defaults to new !!QueryClass

!TemplateClass - defaults to 'HTML::Template'

!RecordsetClass - defaults to 'DBIx::Recordset'

!DoNothing

!SearchForm specifies that a search form should be printed. No
	searching is done, and the default loop is returned with one
	empty element.  This is typically useful when viewing the data
	in a looped form, then this one will create an empty form.


The parameters starting with '!!' must be set before the query and
parameter file is parsed.

!Mod2 should give an output variable ?mod2 which indicates whether the
row count is an odd or not.  This is a very popular feature demand,
though not possible to implement in a nice way in this scheme.  I
don't think it belongs to the template engine, but it would be quite
ugly putting it elsewhere, I think.  I've putted a hack into the sub
faenskopiering which really shouldn't be called in the first place.
This hack ignores !Mod2 and inserts ?mod2 into the tables.

$substring_search=column[,column..] will enable substring search for
the selected attribute.  This means *column will be set to " LIKE "
and the value will be set to "%value%" in searches.  This should be
used with care, as it might strain on most databases.  Anyway, mysql
handles it well. Case sensitivity might be an issue, searches in mysql
are always case insensitive.

Possible future parameters:
!IncludeParamfile
!ParamMacro
!Ooups
!OtherTemplate
!SetSelected

For !Links:
$fetch_always (default)
$fetch_when_found_one 
$fetch_when_found_more
$fetch_when_found_none


Unfortunately I don't have the time writing more docs due to
deadlines.

=head2 Output to the templates

Unfortunately I don't have the time writing more docs due to
deadlines.

    ?count (at the top level)
        The number of elements returned.  Nice to use in constructs
        like 
           <TMPL_UNLESS name="?count">Sorry, didn't find
           anything</TMPL_UNLESS>

    ?mod2 (in all recordset loops)
        0 for even, 1 for odd (0 beeing "odd")    

    any parameter key (at the top level) will give the corresponding
    value.

    a loop called cgi_query with the variables key and value will give
    the query - nice for forwarding a query in hidden input tags.

    Each database query have a loop with _only_ the database values
    (except ?mod2 which really is a hack).  It would have helped a lot
    to have access to the outer scope variables in the inner loop, but
    it seems like the author of the template engine in use disagrees.

=head1 TEMPLATE NAMING CONVENTIONS

The templates should have an extention matching /\.(\w+)$/ - typically
sth like mydatabase.CGITables or mydatabase.db or mydatabase.db_html.
The script will then search for the param file mydatabase.param.$1,
i.e. mydatabase.param.db.  It might also use another template if
found, mydatabase.$status.$1, where $status might be one of (in
prioritied order):

    error
    update_ok
    delete_ok
    add_ok    
    found_$n
    found_more

(this is not completely implemented yet)

=head1 TODO

Probably a lot of important features are missing.  It might also be



( run in 0.815 second using v1.01-cache-2.11-cpan-524268b4103 )