I've been searching here how to convert a block to make it work for Ravennuke but unfortunatly I coudn't find anything but I see examples how actually you can load javascript and css with rn2.40.01. Those examples helped me with the first part but not at all. I don't get it work yet. I am a little bit lost.
From the original block but I can not make it work. Please I will be appriciate if someone can give some details how to create a block to work properly in RavenNuke. Thanks in advance.
Last edited by unicornio on Wed Aug 17, 2011 4:41 pm; edited 1 time in total
Joined: Dec 02, 2006 Posts: 1364 Location: Texas, USA
Posted:
Tue Aug 16, 2011 9:25 am
you were right to load css within a head-xxxx.php file, as you cannot load css from within a block.. Loading the JS file there is fine too, or you could try adding it to the bodyJS array (some JS scripts require being in the head of the document, others do not)
This would work within a block if the JS script supports loading in the body.
Code:
addJSToBody('blocks/bbnavlinks/dtree.js', 'file');
$inlineJS = '<script type="text/javascript">
your script here
</script>';
addJSToBody($inlineJS, 'inline');
A little hard to see what is exactly going on with the JS you are creating. I would first verify you are getting proper results from your db queries. If you look at the html source generated does it look correct? If not, try removing the JS from the block and just displaying the results and get that working first...
Thanks for at least answer this post. I think this is difficult to understand. It should be a good video tutorial o more examples how to use the new feauture from Ravennuke. I am completely lost with this.
This is the javascript. How can I convert it since it has $content already as a block. Explain with more details please. thanks.
Code:
<!--
d = new dTree('d');";
$content .="d.add(0,-1,'Main Menu');";
$sql = sprintf("SELECT * FROM %s_bb_nav_links WHERE sub <1 ORDER BY main_order ASC",
$prefix);
$result = $db->sql_query($sql);
$num = $db->sql_numrows($result);
for($r =0; $r <$num; $r++){
$row = $db->sql_fetchrow($result);
$k = $r+1;
if($row['link_url'] !=''){
$content .="d.add(".$k.",0,'".$row['link_name']."', '".$row['link_url']."', '".$row['link_desc']."');";
}else{
$content .="d.add(".$k.",0,'".$row['link_name']."', '', '".$row['link_desc']."');";
}
$sql2 = sprintf("SELECT link_desc, link_name, link_url FROM %s_bb_nav_links WHERE sub='%d' ORDER BY sub_order ASC",
$prefix, $row['lid']);
$result2 = $db->sql_query($sql2);
$num2 = $db->sql_numrows($result2);
if($num2 >0){
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Wed Aug 17, 2011 8:09 pm
unicornio wrote:
I think this is difficult to understand.
Quite the understatement. Where did this block come from and where can I see it in action as it was intended? To me... it looks extremely sloppy and very hard to understand what the intentions are behind the coding.
If this is nothing more than a navigation menu... seems it would be better done differently IMO.
Thanks for taking the time but I guess It is better I sent the whole block to u so u can see what is happening. Actually my block is working with database and u can control it from admin control panel. I will see what I can do..
Joined: Oct 01, 2010 Posts: 415 Location: Houston, Tx
Posted:
Thu Aug 18, 2011 8:15 pm
That's quite alright. I honestly don't have the time to write your block for you. (currently re-writing my entire daily website & still need to get back to working on my media gallery)
Use that block as an example of how to get this to work... from there all you have to do is code your database functions and pass the variables to your tree structure the way you want it to show. That example is about 70% of the battle. All you should have to do is make it behave the way you want it to.
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