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 Other
Author Message
rustus
New Member
New Member



Joined: Sep 26, 2010
Posts: 15

PostPosted: Sun Sep 26, 2010 12:23 pm Reply with quote

OK, so I dedcided to try out RavenNuke... Now 2/3 of my favorite modules dont work and a couple addons that I like and use with Nuke I can't get the JS code to insert.

By reading around, I gather that I need to add the files to some include file in this manner:

addJSToHead('includes/XXX.JS', 'file')

After that I'm stuck. Where and how do I then insert the <script></script> code the proper way that RavenNuke doesnt strip it out?
 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sun Sep 26, 2010 12:31 pm Reply with quote

What modules are you having problems with? What ever method they use to load JS should still be supported.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
rustus







PostPosted: Sun Sep 26, 2010 12:43 pm Reply with quote

Well, lets start with FancyBox. I integrated it into my PHP-NUKE installation because it doesnt have a light box, and FancyBox is way better than standard LightBox or the one that is integrated into RavenNuke.

ANYWAY..

In PHP-Nuke, I just have to make a php file (say fb.php) and include it in my header.php. in fp.php I have the standard html:
Code:


   <script type="text/javascript" src="fancybox/jquery-1.4.2.min.js"></script>
   <script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.2.pack.js"></script>
   <script type="text/javascript" src="fancybox/jquery.fancybox-1.3.1.js"></script>
   <link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.1.css" media="screen" />
   <script type="text/javascript">
      $(document).ready(function() {
         /*
         *   Examples - images
         */

         $("a#example1").fancybox({
            'titleShow'      : false
         });

         $("a#example2").fancybox({
            'titleShow'      : false,
            'transitionIn'   : 'elastic',
            'transitionOut'   : 'elastic'
         });

         $("a#example3").fancybox({
            'titleShow'      : false,
            'transitionIn'   : 'none',
            'transitionOut'   : 'none'
         });

         $("a#example4").fancybox();

         $("a#example5").fancybox({
            'titlePosition'   : 'inside'
         });

         $("a#example6").fancybox({
            'titlePosition'   : 'over'
         });

         $("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'      : 'none',
            'titlePosition'    : 'over',
            'titleFormat'      : function(title, currentArray, currentIndex, currentOpts) {
               return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
            }
         });

         /*
         *   Examples - various
         */

         $("#various1").fancybox({
            'titlePosition'      : 'inside',
            'transitionIn'      : 'none',
            'transitionOut'      : 'none'
         });

         $("#various2").fancybox();

         $("#various3").fancybox({
            'width'            : '75%',
            'height'         : '75%',
            'autoScale'         : false,
            'transitionIn'      : 'none',
            'transitionOut'      : 'none',
            'type'            : 'iframe'
         });

         $("#various4").fancybox({
            'padding'         : 0,
            'autoScale'         : false,
            'transitionIn'      : 'none',
            'transitionOut'      : 'none'
         });
      });
   </script>




Ravennuke seems so strip all this out.
 
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6433

PostPosted: Sun Sep 26, 2010 12:43 pm Reply with quote

Palbin is correct - although RN supports a new method for loading JS and CSS that simplifies installation and upgrades, it also supports older methods.

Which modules and addons aren't you able to get working?

Finally, if you use addJSToHead, RN will automatically insert the script tags. I'm not sure what you meant by RN stripping it out.

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
rustus







PostPosted: Sun Sep 26, 2010 12:51 pm Reply with quote

OK, lets keep this as simlpe as possible, and dont get defensive on me. lets forget about the 'the other modules' for now an focus on this example.

1. Your saying that by using the method I just describled, that it sould work without a problem, an that I dont need to use the addJSToHead() or the $inlineJS .= at all?

2. How would it possibly automatically insert the script heads when it only points to the .js file? Where would one put the <script></scipt code if using assJSToHead()
 
rustus







PostPosted: Sun Sep 26, 2010 2:40 pm Reply with quote

Well, I figured it out and got Fancybox working in place of colorbox..thanks for your help. If you had answered my first question instead of getting defensive about the mods, it would have saved me an hour.

So far, I like RN... Its a little bloated, but thats ok. I like that it is XHTML strict compliant, thats a big step. I like that Nuke Sentinal and NSN Groups are already installed, and the RSS stuff is nice.

You really should think about it before commenting stuff like this out in the mainfile:
@require_once(INCLUDE_PATH.'includes/sql_layer.php');
$dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);

I know its old, but it doesnt hurt anything to leave it, and solviing that issue with an old block took and hour out of my life.
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Sep 26, 2010 3:12 pm Reply with quote

rustus, I can honestly tell you that they were not being defensive. I have read their replies over several times and I don't find anything even suggesting defensiveness. They were simply trying to get a handle on whether your problem was a loaf of bread or a bakery Wink.

Hopefully you read the Wiki documentation before starting, but at least as soon as you encountered errors Smile, as you would /should have found your answers more quickly. In an effort to keep others from experiencing the same kind of frustration that you have experienced, please respond to the following 2 questions. Thanks!

Did you read the Wiki Documentation entitled Dynamically Loading CSS and JS available from the Wiki home page?

And concerning your closing remarks in your last posting:
rustus wrote:
You really should think about it before commenting stuff like this out in the mainfile:
Code:
@require_once(INCLUDE_PATH.'includes/sql_layer.php');

$dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);


I know its old, but it doesnt hurt anything to leave it, and solviing that issue with an old block took and hour out of my life.


Again, from the Wiki home page, did you read the section Troubleshooting/FAQs, specifically Some blocks/themes/modules no longer work with v2.30.00?

I always find it helpful when installing any new software to read, at a minimum, the Troubleshooting and FAQ sections if they are provided. That way I at least have a head's up as to what I may encounter Wink
 
View user's profile Send private message
kguske







PostPosted: Sun Sep 26, 2010 3:25 pm Reply with quote

I'm happy you were able to resolve the issues (it looks like our previous posts overelapped). Here are some links that might have saved you some time:

Loading CSS and JS, note the comments in RN 2.4 steps 5 and 9

Release notes for RN 2.4.0 - please see the section titles: Old SQL Layer Deprecated but Retained under Upgrade/Compatibility Concerns for an explanation of why the code was commented out.

Discussion of Lightbox scripts including Fancybox, ShadowBox (my favorite) and Colorbox. Colorbox was selected because it has several benefits over the others for use with a CMS. But you can use multiple modal / lightbox scripts at the same time, and removing Colorbox will cause problems for the nukeNAV popup boxes and for nukeSEO DH.

Our responses were simply trying to get enough information to provide helpful responses to general statements. More specific information about what isn't working would have saved time for those trying to assist. For example, if you had described the $dbi function wasn't working, we could have immediately explained why. We should consider adding a reference in the installation notes (http://rnwiki.ravennuke.com/wiki/RavenNuke2:Upgrades_and_Migrations) about this.

We not only want to assist, but also to improve RN and its documentation. So it would be helpful to know what you consider bloat (there is a separate thread on that, but answering here is fine). We are considering a modular installation approach that might address some of this, but feedback is always appreciated.

Glad to hear your thoughts on XHTML compliance (montego, Guardian2003, fkelly and others spent MUCH time on that), NukeSentinel, NSN Groups, and feeds (did you mean inbound in blocks, outbound via the Feeds module, or both?). We definitely appreciate feedback on future changes and improvements, and usually have discussions about various changes in the forums making changes. Feel free to participate, and you'll see the benefits of a real open source community.
 
rustus







PostPosted: Sun Sep 26, 2010 4:37 pm Reply with quote

Im sorry if I sounded harsh, I wasnt really tying to be. Its just that I had a specific question about the addJSToHead() function, and I even posted twice, and the only answers I got back where about what mods were not working.. I should have just left that part of the statement off.

I understand that You have to start somewhere, an you have no idea of a posters user level, but I get frustated too, because I never post, but when I do I don't want to start in GENESIS with my particular problem.

To answer your questions:

Quote:

Again, from the Wiki home page, did you read the section Troubleshooting/FAQs, specifically Some blocks/themes/modules no longer work with v2.30.00?


Yes I have read a little on that, and I will work out the problems I am having with a couple modules on my own, but it doesnt apply to the question I was aking here.

Quote:

Did you read the Wiki Documentation entitled Dynamically Loading CSS and JS available from the Wiki home page?


No I didn't see that one, as a matter of fact I was looking high and low for this information and somehow never found it... It would have been a good link to give me at the beginning. Google also was tuning up vey little on "RavenNuke Jquery" searches. I figured it out by looking at some includes files you had in RN... Turned out to be pretty simple.

I suppose that I could have read the entire FAQ before posting a question, but lets be realistic... we are MEN! we don't need instructions!

KGUSKE

If you re-read my initial question, I don't know how much more specific I could get... (I still havent got an answer to the second post). The $dbi was not even part of the topic, I threw it in as an afterthought to my comments, I never needed nor asked for help on that.

I have left the colorbox functionality, but just call Fancybox for my uses, although I dont use the nukenav and such... but it is still there. Thanks for the link.. I will read that thread.

Mainly for me the XHTML compliance is the biggest issue of why I am trying out RN. I have always used PhP-Nuke and hacked it up all to hell, but am tired of rehashing adding crap that should be in there in the first place... Every update that Nuke has..its the same old thing, no real improvemnts to its core, making it compliant and such, as well as modernizing its modules to reflect new approaches and/or standards in web designing. Its too bad really, cuz its a decent CMS.

I know everyone is different, but for me I don't need a bunch of preloaded mods.. I can install those as I need them. IMHO if you stick to core functionality, security and compliance you will satisfy my needs in Nuke.

BLOAT for me woul be:
Project Tracking
GCalendar
Legal
HTML Newsletter
nukeSEO

And thats all so far, I really havnt had time to look at it all.. But its NOT BAD as I said. Some versions of Nuke pack it so full of crap its unreal.

I will check out the thread on feedback and definately give my input as I use RN more. For now though I really like it so far. The setup was nice (I never use the installer, but thought I'd give it a try).
 
kguske







PostPosted: Sun Sep 26, 2010 5:18 pm Reply with quote

Sorry, it seemed that your issues were all resolved. I'm not sure why it didn't work in your header.php, but I suspect it is because it was placed before any HTML was output (the first references to CSS and JS are loading an array that get's output later). If you look at that file, you'll see comments that tie directly to the CSS and JS wiki post steps, which should make it easier to understand.

You should be able to add this in includes/javascript.php or a custom_head.php in an ECHO statement (don't forget to escape properly):
Code:
 <script type="text/javascript" src="fancybox/jquery-1.4.2.min.js"></script>

   <script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.2.pack.js"></script>
   <script type="text/javascript" src="fancybox/jquery.fancybox-1.3.1.js"></script>
   <link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.1.css" media="screen" />
   <script type="text/javascript">
      $(document).ready(function() {
         /*
         *   Examples - images
         */

         $("a#example1").fancybox({
            'titleShow'      : false
         });

         $("a#example2").fancybox({
            'titleShow'      : false,
            'transitionIn'   : 'elastic',
            'transitionOut'   : 'elastic'
         });

         $("a#example3").fancybox({
            'titleShow'      : false,
            'transitionIn'   : 'none',
            'transitionOut'   : 'none'
         });

         $("a#example4").fancybox();

         $("a#example5").fancybox({
            'titlePosition'   : 'inside'
         });

         $("a#example6").fancybox({
            'titlePosition'   : 'over'
         });

         $("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'      : 'none',
            'titlePosition'    : 'over',
            'titleFormat'      : function(title, currentArray, currentIndex, currentOpts) {
               return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
            }
         });

         /*
         *   Examples - various
         */

         $("#various1").fancybox({
            'titlePosition'      : 'inside',
            'transitionIn'      : 'none',
            'transitionOut'      : 'none'
         });

         $("#various2").fancybox();

         $("#various3").fancybox({
            'width'            : '75%',
            'height'         : '75%',
            'autoScale'         : false,
            'transitionIn'      : 'none',
            'transitionOut'      : 'none',
            'type'            : 'iframe'
         });

         $("#various4").fancybox({
            'padding'         : 0,
            'autoScale'         : false,
            'transitionIn'      : 'none',
            'transitionOut'      : 'none'
         });
      });
   </script>

Even better, you could add a file in includes/addons called head-FB.php that contains the following:
Code:
<?php


if (stristr(htmlentities($_SERVER['PHP_SELF']), 'head-FB.php')) {
   Header('Location: ../../index.php');
   die();
}
$FBcss = '<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.1.css" media="screen" />';
$FBinit = '
   <script type="text/javascript">
      $(document).ready(function() {
         /*
         *   Examples - images
         */

         $("a#example1").fancybox({
            \'titleShow\'      : false
         });

         $("a#example2").fancybox({
            \'titleShow\'      : false,
            \'transitionIn\'   : \'elastic\',
            \'transitionOut\'   : \'elastic\'
         });

         $("a#example3").fancybox({
            \'titleShow\'      : false,
            \'transitionIn\'   : \'none\',
            \'transitionOut\'   : \'none\'
         });

         $("a#example4").fancybox();

         $("a#example5").fancybox({
            \'titlePosition\'   : \'inside\'
         });

         $("a#example6").fancybox({
            \'titlePosition\'   : \'over\'
         });

         $("a[rel=example_group]").fancybox({
            \'transitionIn\'      : \'none\',
            \'transitionOut\'      : \'none\',
            \'titlePosition\'    : \'over\',
            \'titleFormat\'      : function(title, currentArray, currentIndex, currentOpts) {
               return \'<span id="fancybox-title-over">Image \' + (currentIndex + 1) + \' / \' + currentArray.length + (title.length ? \' &nbsp; \' + title : \'\') + \'</span>\';
            }
         });

         /*
         *   Examples - various
         */

         $("#various1").fancybox({
            \'titlePosition\'      : \'inside\',
            \'transitionIn\'      : \'none\',
            \'transitionOut\'      : \'none\'
         });

         $("#various2").fancybox();

         $("#various3").fancybox({
            \'width\'            : \'75%\',
            \'height\'         : \'75%\',
            \'autoScale\'         : false,
            \'transitionIn\'      : \'none\',
            \'transitionOut\'      : \'none\',
            \'type\'            : \'iframe\'
         });

         $("#various4").fancybox({
            \'padding\'         : 0,
            \'autoScale\'         : false,
            \'transitionIn\'      : \'none\',
            \'transitionOut\'      : \'none\'
         });
      });
   </script>
';

addCSSToHead($FBcss, 'inline');
// jQuery will already be loaded
addJSToHead('includes/fancybox/mousewheel-3.0.2.pack.js', 'file');
addJSToHead('includes/fancybox/jquery.fancybox-1.3.1.js', 'file');
addJSToHead($FBinit, 'inline');
?>


Note: I used the inline load for the CSS as it doesn't specify media="screen" (which is something we might want to add in a future release). Also, this assumes that your fancybox folder is in the /includes folder.

Why is it better to use the latter approach? Because you can upgrade to future versions of RN without reapplying your customization to the header.php or javascript.php.

Thanks for your feedback on bloat. I agree, for the most part, though I would argue that all sites should have Legal, and nukeSEO (presumably you meant nukeSEO DH) is used to generate title and META tags, so I wouldn't want to remove that either. nukeNAV isn't required, but it's easy enough to leave that out of your theme.
 
kguske







PostPosted: Sun Sep 26, 2010 5:31 pm Reply with quote

What would make this clearer? (for the benefit of others who might see this in the future)
rustus wrote:
OK, so I dedcided to try out RavenNuke... Now 2/3 of my favorite modules dont work and a couple addons that I like and use with Nuke I can't get the JS code to insert.

By reading around, I gather that I need to add the files to some include file in this manner:

addJSToHead('includes/XXX.JS', 'file')

After that I'm stuck. Where and how do I then insert the <script></script> code the proper way that RavenNuke doesnt strip it out?


How about this:
- module XXX and YYY and block ZZZ don't work because they get an error that $dbi isn't defined
- I added this JS to header.php like this, and the JS was displayed before the opening HTML tag

If that's too much to ask, then this would have also saved time:
- module XXX and YYY and block ZZZ don't work
- I added this JS to header.php like this, but it was stripped out

Why? Because using addJSToHead should have worked. The function itself takes care of properly formatting the script tags (and also makes it easier to change that function if necessary without having to touch all the places that load JS). Without seeing what you really did, it's much more difficult to diagnose.
 
rustus







PostPosted: Sun Sep 26, 2010 5:45 pm Reply with quote

Ok dude, your focusing on the comment about the modules. The modules had NOTHING to do with my question. As I said I should have just left that part out.

Notice the AND in the statement.. AND A COUPLE OF ADDONS... this is now where we begin.

The specific question was (simplified):
I got the addJSToHead('includes/XXX.JS', 'file') "now what do I do"...


The answer turned out to be this (for future people who need this information)...

You need to now add an inline statement in this manner and then add it to the head:

$inlineJS = '<script type="text/javascript">$(document).ready(function(){$("a#example1").fancybox({"titleShow":false});});</script>'."\n";

addJSToHead($inlineJS,'inline');


I'm sure there are other ways, but thats what worked for me.


Last edited by rustus on Sun Sep 26, 2010 6:31 pm; edited 1 time in total 
kguske







PostPosted: Sun Sep 26, 2010 6:20 pm Reply with quote

Again you are correct - they were not defensive. Smile Hopefully, they were instructive for others who, like Palbin and I, weren't clear on your request.

Again, I'm glad you got it working, and thank you for identifying some areas for improvement in the documentation.
 
rustus







PostPosted: Sun Sep 26, 2010 6:32 pm Reply with quote

I have to give it to you.. you guys are nothing if not professional. Very Happy Kudos.

Oh and BTW, yes, I think I initially added the code to far up in the header. I like your js function approach better anyway. As you say, It will save a lot of headaches in the future!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Other

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 ©