vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Project Tools (https://vborg.vbsupport.ru/forumdisplay.php?f=266)
-   -   How to Insert Version Number in Footer (https://vborg.vbsupport.ru/showthread.php?t=250030)

mokonzi 09-06-2010 08:08 AM

How to Insert Version Number in Footer
 
I'm looking into using the version number from one of my projects in the footer. I can cope with phrasing, and know how to edit the template to add what I need, but I'm stuck on how to extract the number from PT that I need.

How can I collect the latest version number, and then add it as a variable to the template?

Thanks for any help in advance... :)

PitchouneN64ngc 09-10-2010 09:05 AM

You need to use a query like:

Code:

SELECT version FROM product WHERE productid = 'vbprojecttools';

mokonzi 09-11-2010 07:02 AM

Thanks for the help. So far, I've been able to get this query to work:

Code:

$version = $db->query_first("
  SELECT 'versioname'
  FROM mytable_pt_projectversion
  WHERE projectid = 2 AND projectversiongroupid = 1 AND displayorder = 10;
");

vB_Template::preRegister('footer',array('txuversion' => $version));

But all that displays when I include the variable is array.

Am I missing something obvious?

Thanks again for the help, I'm a total noobie when it comes to programming... :)

Mosh 09-11-2010 07:43 AM

Quote:

Originally Posted by mokonzi (Post 2096580)
Thanks for the help. So far, I've been able to get this query to work:

Code:

$version = $db->query_first("
  SELECT 'versioname'
  FROM mytable_pt_projectversion
  WHERE projectid = 2 AND projectversiongroupid = 1 AND displayorder = 10;
");

vB_Template::preRegister('footer',array('txuversion' => $version));

But all that displays when I include the variable is array.

Am I missing something obvious?

Thanks again for the help, I'm a total noobie when it comes to programming... :)

It is because it is an array of fields (in this case 1 field) you are getting back from your query.... you need to register the field, not the array, so your register line should probably look something like this:
Code:

vB_Template::preRegister('footer',array('txuversion' => $version['versioname']));

mokonzi 09-11-2010 10:13 AM

I got it working by doing this:

Code:

$version = $db->query_first("
  SELECT versionname
  FROM mytable_pt_projectversion
  WHERE projectid = 2 AND projectversiongroupid = 1 AND displayorder = 10;
");

vB_Template::preRegister('footer',array('version' => $version['versionname']));

I'd made one mistake, that is adding 'versioname' in ' and then versionname was spelt with one n... :)

Now just to select the right row... :D

PS, thanks for the help :)


All times are GMT. The time now is 09:13 PM.

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.01038 seconds
  • Memory Usage 1,724KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_quote_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