| Author |
Message |
testy1 Involved


Joined: Apr 06, 2008 Posts: 483
|
Posted:
Thu Jan 15, 2009 11:21 pm |
|
soooooooooooooooo
This question is specific to ravennuke 2.3 really
I have some jquery I want to add that is used in a block.It will also have a switch via the database to turn it on and off.next there is some options (css) that I would like to set via the administraion area for the block.
My question is what is the best method for doing this, Hopefully the code below will help fill in the gaps
In the header (or a file associated with the header) i need the following, but to allow the database switch's I also need to include the function to get the values.I dont want to clutter up the jquery.php file so should I put this in a file on its own and call it from the header.......
Could I have some opinions on how you would do it please......
| Code: |
/*************************************/
/* Grab The Settings START */
/*************************************/
$dfw_getsets = array();
$dfw_getsets = dfw_getblockcfg();
function dfw_getblockcfg()
{
global $prefix, $db;
$getcfg = array();
$sql = 'SELECT * FROM `' . $prefix . '_dfw_cfg`';
$result = $db->sql_query($sql);
if (!$result) {
echo '' . _DBCALLERROR . '';
} else {
while (list($cfg_nm, $cfg_val) = $db->sql_fetchrow($result)) {
$getcfg[$cfg_nm] = $cfg_val;
}
return $getcfg;
}
}
/*************************************/
/* Grab The Settings END */
/*************************************/
if ($dfw_getsets['tooltip'] == 1) {
// Define some variables
$BdrThickness = (!empty($dfw_getsets['border_thickness']) ? 'intval($dfw_getsets['border_thickness'])' : '0');
$BdrType = (!empty($dfw_getsets['border_type']) ? 'intval($dfw_getsets['border_type'])' : 'none');
$BdrColor = ((strlen($dfw_getsets['border_type']) == 7) ? $dfw_getsets['border_type'] : '#FFFFFF');
echo '<script type="text/javascript" src="includes/jquery/jquery.js"></script>';
echo '<script type="text/javascript" src="includes/jquery/jquery.tooltip.js"></script>';
echo '<link rel="stylesheet" type="text/css" href="includes/jquery/css/jquery.tooltip.css" />';
echo '<style type="text/css">
#tooltip.DFWClass {
font-family: Arial;
border: ' . $BdrThickness . 'px ' . $BdrType . ' ' . $BdrColor . ';
padding:20px;
opacity: 0.8;
}
</style>';
echo '<script type="text/javascript">
$(function() {
$(\'#DFWSite a\').tooltip({
/* Do Something */
/* Do Some more */
/* automatically fix yourself */
});
});
</script>';
}
|
|
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16976 Location: Kansas
|
Posted:
Thu Jan 15, 2009 11:45 pm |
|
If you look at header.php you will see that we have an include_once 'includes/jquery/jquery.php'; for a specific use in Your_Account module. You should be able to do the same kind of call for your specific use. |
|
|
|
 |
testy1 Involved


Joined: Apr 06, 2008 Posts: 483
|
Posted:
Fri Jan 16, 2009 12:21 am |
|
ok, will there be some way of standardizing how we include jquery in future releases as there could be a lot of double, triple, quad (you get the point) includes
EDIT: or is there a way to check if a block is loaded easily like we can modules |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16976 Location: Kansas
|
Posted:
Fri Jan 16, 2009 12:27 am |
|
Absolutely. We are/were trying different methodologies and we are still in the process of formalizing a lot of things/stuff . However, we are trying to balance releases with documentation, standards, etc. and as you yourself know all too well, so little to do and so much time - stop; reverse that - so much to do and so little time  |
|
|
|
 |
testy1 Involved


Joined: Apr 06, 2008 Posts: 483
|
Posted:
Fri Jan 16, 2009 12:32 am |
|
lol I here ya all to well m8  |
|
|
|
 |
|
|
|
|