vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP help? (https://vborg.vbsupport.ru/showthread.php?t=184192)

Team_RCRR 07-02-2008 04:11 PM

PHP help?
 
Okay I have been reading over W3 schools.com for about 1day 1/2. I have developed a script (I think it will work) and I wonder how would you "export" it to use for VB?
Here's the script:
PHP Code:

<?php
$m
=month("M");
if (
$m=="January")
  echo 
"MacWorld 2009 is going to be BIG!"
else
  echo 
"MacWorld 2009 here we come!"
?>

Now this is a stupid useless code I know that but it would be my first line I have ever done.

noppid 07-02-2008 04:24 PM

Put this in a hook that is called before the template you want this to display in is eval'd.

PHP Code:


if(month("M") == "January")
    
$templatevar "MacWorld 2009 is going to be BIG!"
else
    
$templatevar "MacWorld 2009 here we come!"

Put $templatevar in the template where you want the words to display.

Good work. Nice to see people apply themselves instead of just asking for a gimmie.

Oh yeah, set your editor to 4 space tab too. ;)

Team_RCRR 07-02-2008 04:35 PM

Ohh that makes a lot of sense! Thanks for the help!

noppid 07-02-2008 05:42 PM

Glad to help. Take a look at existing hacks to get clues on how to make it a product. Or make a product in the acp and add hooks to it and export it.

Dismounted 07-03-2008 06:42 AM

Nice, clean code is also good (since you're learning). One thing to do is to avoid using too generic variables, as other modifications may "take over" your variable.
PHP Code:

if (month('M') == 'January')
{
    
$macworld 'MacWorld 2009 is going to be BIG!';
}
else
{
    
$macworld 'MacWorld 2009 here we come!';




All times are GMT. The time now is 02:10 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01062 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete