PDA

View Full Version : How to Insert Version Number in Footer


mokonzi
09-06-2010, 08:08 AM
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:

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:

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

vB_Template::preRegister('footer',array('txuversio n' => $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
Thanks for the help. So far, I've been able to get this query to work:

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

vB_Template::preRegister('footer',array('txuversio n' => $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:
vB_Template::preRegister('footer',array('txuversio n' => $version['versioname']));

mokonzi
09-11-2010, 10:13 AM
I got it working by doing this:

$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 :)