Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating General Discussion
Author Message
testy1
Involved
Involved



Joined: Apr 06, 2008
Posts: 484

PostPosted: Thu Jan 15, 2009 11:21 pm Reply with quote

soooooooooooooooo Smile

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>';
}
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Jan 15, 2009 11:45 pm Reply with quote

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.
 
View user's profile Send private message
testy1







PostPosted: Fri Jan 16, 2009 12:21 am Reply with quote

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







PostPosted: Fri Jan 16, 2009 12:27 am Reply with quote

Absolutely. We are/were trying different methodologies and we are still in the process of formalizing a lot of things/stuff Wink. 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 Shocked Confused - stop; reverse that - so much to do and so little time killing me
 
testy1







PostPosted: Fri Jan 16, 2009 12:32 am Reply with quote

lol I here ya all to well m8 Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating General Discussion

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©