Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 05-11-2009, 06:30 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll repeat... Please use the html/php tags. It is very difficult to read code when you don't use those. They are right here in the Quick Reply box - very easy to use. I don't care about your original code, I just want to see the code in your plugin. And, again, I'll repeat that you should be putting the *variable* name into a template. You CANNOT use php in a template, which means you CANNOT do an echo statement. You need to simply put the variable in there - and I would NOT name it php (I don't know that that variable named is reserved, but it sounds like it should be).
Reply With Quote
  #12  
Old 05-12-2009, 02:00 AM
visitangeles visitangeles is offline
 
Join Date: Feb 2009
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I'll repeat... Please use the html/php tags. It is very difficult to read code when you don't use those. They are right here in the Quick Reply box - very easy to use. I don't care about your original code, I just want to see the code in your plugin. And, again, I'll repeat that you should be putting the *variable* name into a template. You CANNOT use php in a template, which means you CANNOT do an echo statement. You need to simply put the variable in there - and I would NOT name it php (I don't know that that variable named is reserved, but it sounds like it should be).
i dont understand. i dont use any html or php tags in the plugin. $php is taken from the yahoo site that i scrape the financial data.

i thought you were not suppose to use php or html in the plugins?. again, i simply use vb 3.8.1 and set up a plugin called currency using vbulletin and global_start as the hook i guess and inserted this code below only:

PHP Code:
$today date('Y-m-d');
$con mysql_connect('localhost''username''passwd1');
if (!
$con)
{
die(
'Could not connect: ' mysql_error());
}
mysql_select_db("dbname_currency"$con);
$query "SELECT cur_rate FROM currency WHERE cur_date = '$today' AND cur_code = 'PHP'";
$result mysql_query($query)
or die(
mysql_error());
$row mysql_fetch_array($result);
$php $row['cur_rate']; 
then in the header template, i used the variable

HTML Code:
    <td align="$stylevar[right]" id="header_right_cell">
		<if condition="$ad_location['ad_header_logo']">$ad_location[ad_header_logo]<else />&nbsp;</if>
	</td>
    <td>

<center>

1 USD = PHP $php

</center>

  </tr>
</table>
</fieldset>
to produce the philippine peso rate to show on the page. it worked, but then after you refresh the page, it goes away. i just thought it was because of using global_start as the hook and maybe there is a better hook to use? or what is the problem? is this the info u needed?

--------------- Added [DATE]1242104548[/DATE] at [TIME]1242104548[/TIME] ---------------

its working now. lol. not sure what was wrong before but in the future, is there a better hook to use than global_start or does it matter?

or should you create your own hook? how hard is that?
Reply With Quote
  #13  
Old 05-12-2009, 04:05 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I was talking about the php/html tags, I'm talking about the tags on this site (that you used to surround your code in your last post). Thank you - it's much easier to read.

This is the line I think you may want to rename your variable in:
PHP Code:
$php $row['cur_rate']; 
And then this is going to cause problems because it is invalid html:
HTML Code:
    <td>

<center>

1 USD = PHP $php

</center>

  </tr>
</table>
You need an </td> in there before the </tr>.

Are you only trying to show this on the forumhome (index.php) page? I would pick a plugin that is just on that page, if so - forumhome_start maybe.
Reply With Quote
  #14  
Old 05-12-2009, 02:11 PM
Cryo Cryo is offline
 
Join Date: Dec 2003
Location: Buffalo, NY
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should rename $php to something like $currency_php or similar. As Lynne suggested, $php is confusing because PHP is also the language you're coding in.

As far as hook location goes, I'd go with forumhome_start (as Lynne also suggested) or if you need it on every page, global_complete.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:17 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03468 seconds
  • Memory Usage 2,197KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_html
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete