PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

PostPosted: Mon Aug 15, 2011 3:04 pm Reply with quote Back to top

Hi Guys!

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.

The block

Code:
global $db, $content, $prefix;

//$content .= '<link rel="StyleSheet" href="blocks/wsnavlinks/dtree.css" type="text/css" />';
//$content .= '<script type="text/javascript" src="blocks/wsnavlinks/dtree.js"></script>';

$content .= '<link rel="StyleSheet" href="blocks/bbnavlinks/dtree.css" type="text/css" />';
$content .= '<script type="text/javascript" src="blocks/bbnavlinks/dtree.js"></script>';


$content .="<div class=\"dtree\">

   <script type=\"text/javascript\">
      <!--

      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){
      
for($t =0; $t <$num2; $t++){
$y = $t+1;
$u = $num+$y;
$row2 = $db->sql_fetchrow($result2);
$content .="d.add(".$u.",".$k.",'".$row2['link_name']."','".$row2['link_url']."', '".$row2['link_desc']."');";

}

}

}
$content .="document.write(d);

      //-->
   </script>

</div>";



Like this is not working and I don't know why.

I tried to convert it begining like this.

I create a file head-Navigation.php

in folder includes/addon/


Code:
<?php

if (stristr(htmlentities($_SERVER['PHP_SELF']), 'head-Navigation.php')) {
   Header('Location: ../../index.php');
   die();
}
   addCSSToHead('blocks/bbnavlinks/dtree.css', 'file');
   addJSToHead('blocks/bbnavlinks/dtree.js', 'file');

?>



I commented out

Code:
//$content .= '<link rel="StyleSheet" href="blocks/bbnavlinks/dtree.css" type="text/css" />';
//$content .= '<script type="text/javascript" src="blocks/bbnavlinks/dtree.js"></script>';


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


Joined: Aug 13, 2009
Posts: 432

PostPosted: Tue Aug 16, 2011 1:44 am Reply with quote Back to top

Oh my god!, 23 people viewed this post and nobody answered yet. bump Shocked

Sad
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1364
Location: Texas, USA

PostPosted: Tue Aug 16, 2011 9:25 am Reply with quote Back to top

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


Joined: Aug 13, 2009
Posts: 432

PostPosted: Wed Aug 17, 2011 4:22 pm Reply with quote Back to top

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){
      
for($t =0; $t <$num2; $t++){
$y = $t+1;
$u = $num+$y;
$row2 = $db->sql_fetchrow($result2);
$content .="d.add(".$u.",".$k.",'".$row2['link_name']."','".$row2['link_url']."', '".$row2['link_desc']."');";

}

}

}
$content .="document.write(d);

      //-->
View user's profile Send private message
killing-hours
RavenNuke(tm) Development Team


Joined: Oct 01, 2010
Posts: 415
Location: Houston, Tx

PostPosted: Wed Aug 17, 2011 8:09 pm Reply with quote Back to top

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


Joined: Aug 13, 2009
Posts: 432

PostPosted: Thu Aug 18, 2011 5:37 am Reply with quote Back to top

This is the original navigation menu. it is working fine with phpnuke but with Ravennuke doesnt work.
Only registered users can see links on this board!
Get registered or login to the forums!


What I have is an addon wich get connected with data base add links from admin control.
View user's profile Send private message
killing-hours
RavenNuke(tm) Development Team


Joined: Oct 01, 2010
Posts: 415
Location: Houston, Tx

PostPosted: Thu Aug 18, 2011 7:42 am Reply with quote Back to top

Knock yourself out. Here is the example file they had on their site, slightly modified to work with Ravennuke.

*** I modified the "dtree.js" file to fix image linking.


Screenshot of proof:
Image

Download:
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message
unicornio
Involved
Involved


Joined: Aug 13, 2009
Posts: 432

PostPosted: Thu Aug 18, 2011 4:04 pm Reply with quote Back to top

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..
View user's profile Send private message
killing-hours
RavenNuke(tm) Development Team


Joined: Oct 01, 2010
Posts: 415
Location: Houston, Tx

PostPosted: Thu Aug 18, 2011 8:15 pm Reply with quote Back to top

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 user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum