PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  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
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Thu Mar 25, 2010 12:00 pm Reply with quote Back to top

what is a better way to write code for ravennuke:

example
Code:
$code = "modules/Submit_News/uploads/$random_number/";

or
Code:
$code = 'modules/Submit_News/uploads/'.$random_number.'/';


i assume second example , but i would like to hear it from more experienced coder(s)
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Palbin
Site Admin


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

PostPosted: Thu Mar 25, 2010 1:53 pm Reply with quote Back to top

The second one.
View user's profile Send private message
fkelly
Moderator


Joined: Aug 30, 2005
Posts: 3186
Location: near Albany NY

PostPosted: Thu Mar 25, 2010 2:39 pm Reply with quote Back to top

Put yourself in place of the PHP parser. In the first example it has to parse every character looking for, say, variables and then substituting values in where it finds one. In the second case it can simply proceed from the first single quote to the second interpreting the characters literally and not testing any of them to see if they refer to a variable. That's a lot of tests skipped in a big program and it's one reason why the single quote, string concatenation method is used throughout Ravennuke and why the RN team spent a lot of time a couple of years ago going through the code to do that.
View user's profile Send private message Visit poster's website
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Thu Mar 25, 2010 3:05 pm Reply with quote Back to top

i understand , thank you for your explenation.... so
Code:
   if($notify) {
      $notify_message = "$notify_message\n\n\n========================================================\n$subject\n\n\n$story\n\n$storyext\n\n$name";
      /*
       * TegoNuke Mailer added by montego for 2.20.00
       */
      $mailsuccess = false;
      if (defined('TNML_IS_ACTIVE') and validate_mail($notify_from) !== false) {
         $mailsuccess = tnml_fMailer($notify_email, $notify_subject, $notify_message, $notify_from, $sitename);
      } else {
         $mailsuccess = mail($notify_email, $notify_subject, $notify_message, "From: $sitename <$notify_from>\nX-Mailer: PHP/" . phpversion());
      }
      /*
       * end of TegoNuke Mailer add
       */
   }
needs revisiting?
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
fkelly
Moderator


Joined: Aug 30, 2005
Posts: 3186
Location: near Albany NY

PostPosted: Thu Mar 25, 2010 3:23 pm Reply with quote Back to top

"Needs" is subject to interpretation. While "efficiency" is important so is the workload of the RN team. We did not necessarily convert EVERY line in Ravennuke to the single quotes, string concatenation method. And certain things are more difficult to convert than others and you really have to thoroughly test everything you convert. Especially where we used Open Source code from other sources besides the core *Nuke we did not always have the time to go through it thoroughly to do these conversions.
View user's profile Send private message Visit poster's website
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Sat Mar 27, 2010 11:32 am Reply with quote Back to top

fkelly is exactly right. I wouldn't change these lines personally (because I coded them this one in the first place). What is the point? The "\n" (line feed) character MUST be inside double quotes or use some other way to generate that special character in the output.
View user's profile Send private message Visit poster's website
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