| layingback wrote: |
| Then do that.... |
OK.
Attached is the latest version, with a few key amendments.
I've split the classes into separate files so if you only want one of the features you only need include the appropriate file. So, to use AJAX comments for example, you would include
CORE_PATH.'classes/jcmmt.php' and declare an instance with
$var = new jcmmt();.
There's no need for
$jQ->header() as the class(es) now all use additional global variables I've added to
cmsinit.inc (modified version included in the package).
In fact I've modified 3 core files :-
includes/cmsinit.inc
header.php
footer.php
I've declared several new global variables as follows :-
$modlib
An array containing a list of additonal javascript libraries to be added to the [head] section of the website.
Note: you only need specify a library name, not the path to it, as it's assumed all libraries are in
includes/javascript/jquery/, so if a file is included like so :-
| PHP: |
$modlib[] = 'mylibrary.js';
|
it would become :-
includes/javascript/jquery/mylibrary.js
$modcss
An array containing a list of stylesheets to be added to the [head] section of the website. For example :-
| PHP: |
$modcss[] = 'mystylesheet.css';
|
Note: Stylesheets for jQuery scripts should go in
themes/THEMENAME/ rather than
themes/THEMENAME/style/ because jQuery's own CSS framework (included) uses image references of the form
url(images/image.png) rather than
url(../images/image.png). The code assumes this.
$modscript
A string containing javascript code to be added to the [head] section of the website. Any code added to this variable will be wrapped in the appropriate code to execute it on DOM ready, like so :-
| Code:: |
[script type="text/javascript"]
$(function() {
// $modscript goes here
});
[/script]
|
$modfooter
A string the contents of which will be added to the bottom of the HTML after the page footer (credits etc.), useful for hidden elements used in scripts and / or scripts that need to go in [body] rather than [head].
The jQuery classes themselves have been split into separate classes (all of which extend the jQuery class). The files are :-
Comments
In your module include this file and declare an instance of the class :-
| PHP: |
require_once(CORE_PATH.'classes/jcmmt.php'); $jcmmt = new jcmmt( array('KEY' => $VALUE) );
|
Parameters are passed as an array of key => value pairs, like so :-
| PHP: |
$jcmmt = new jcmmt(array( 'CMMT_QUOTE' => true, 'CMMT_REPLY' => true, 'CMMT_SPACER' => 3, 'CMMT_MAXNEST' => 20 ));
|
To add a comment box to your module you must first create a link to your module like so :-
| PHP: |
$jcmmt->link($mod, $link, $page, $key1, $key2);
|
To then display a comment box in your module :-
To delete all comments associated with the linked module record
To count comments associated with the linked module record
To retrieve the total comments associated with the linked module
Date Time Picker
In your module include this file and declare an instance of the class :-
| PHP: |
require_once(CORE_PATH.'classes/jdate.php'); $jdate = new jdate(true, true, true, 15);
|
Note: You must do this before including "header.php" in your code.
To add a date / time picker to your form :-
| PHP: |
$jdate->field($fieldname, $value);
|
To retrieve the date entered by the user :-
| PHP: |
$jdate->input($fieldname);
|
There are some additional functions provided :-
returns the current GMT date / time (same as gmtime() if you're using timestamps)
| PHP: |
$jdate->toLocal($gmtdatetime);
|
converts a GMT date/time to the user's local timezone
| PHP: |
$jdate->toGMT($localdatetime);
|
converts a date in the user's local timezone to GMT
| PHP: |
$jdate->display($datetime, $format);
|
displays a GMT date / time to the user in their local timezone, and formats it according to $format if suppplied (or the date format specified in their website account if not)
Tabs
In your module include this file and declare an instance of the class :-
| PHP: |
require_once(CORE_PATH.'classes/jtabs.php'); $jtabs = new jtabs($tabname, $selected);
|
Note: You must do this before including "header.php" in your code.
To add a tab :-
| PHP: |
$jtabs->add($id, $label, $url);
|
To display the tabs once they've all been specified :-
Text Editor
In your module include this file and declare an instance of the class :-
| PHP: |
require_once(CORE_PATH.'classes/jtext.php'); $jtext = new jtext($html, $toolbar, $skin);
|
Note: You must do this before including "header.php" in your code.
To add an editor to a form :-
| PHP: |
$jtext->field($id, $text, $form, $cols, $rows);
|
To display text :-
| PHP: |
$jtext->display($text);
|
Tooltips
In your module include this file and declare an instance of the class :-
| PHP: |
require_once(CORE_PATH.'classes/jtips.php'); $jtips = new jtips($width);
|
Note: You must do this before including "header.php" in your code.
To add a tooltip :-
| PHP: |
$jtips->display($title, $url, $label);
|
Note: functions have been renamed for clarity and consistency compared to the previous version (not that I expect anyone has done much with this so far).
edit: Can't attach the package, it's too big, so please download it here :-
www.cmsdreams.co.uk/in...s&id=7