PDA

View Full Version : Adding variables to phptemplate theme


speedway
02-27-2006, 05:03 PM
Hi all

I am in template design phase and am struggling a bit on where to put the vB variables into my phptemplate engine based theme. I would assume they would be declared and initialised in template.php somewhere, but that somewhere is what I am not sure of. I have had a look at the defaultvb theme for ideas and did think of putting them in the page.tpl.php or node.tpl.php files, but as template.php controls things it would probably be better in there somewhere.

Any help would be appreciated.

Cheers
Bruce

myetalk
03-05-2006, 04:18 PM
You just have to find the PHP File that declares all the variables for the theme. Then check the sticky in this forum for help ;)

speedway
03-07-2006, 04:30 AM
Thanks, I think I have it sussed. When I am sure I will let others know as well :)

Cheers
Bruce

myetalk
03-07-2006, 08:29 AM
Thanks, I think I have it sussed. When I am sure I will let others know as well :)

Cheers
Bruce
cool, glad you liked it ;)

Caerydd
04-11-2006, 07:08 AM
I'm trying to do this, as I want to use phptemplate themes, but also include the vbulletin navbar and footer bar. I can get the theme looking 'sort of' okay, but I already have a phptemplate theme that looks just about right, and I would prefer to add things like the vbulletin navbar in there.

I also wanted the navbar to be the same on both (so I won't have to do dual edits to the header template and the phptemplate) is it possible to create a new navbar template which holds this particular code variables, and then have the phptemplate and the header template call it,as the template.php of my phptemplate would have the required variables in (I think)

Is that possible, or am I barking up the wrong tree?

I get this error:
Parse error: parse error, unexpected $ in /homepages/22/d144209558/htdocs/alleria/aliares/themes/box_alleria/template.php on line 19

when I put this in my template.php for my particular theme

function defaultvb_breadcrumb($breadcrumb) {
return implode($breadcrumb, ' » ');
}

function defaultvb_page($content) {
global $user, $stylevar, $vbphrase, $vboptions, $style, $bbuserinfo, $session, $pmbox, $show, $spacer_open, $spacer_close, $admincpdir, $modcpdir, $quickchooserbits, $languagechooserbits, $_phpinclude_output, $sessionurl;

$language = $GLOBALS['locale'];
$title = drupal_get_title();
if ($vboptions['convert_to_utf'] && function_exists('undo_utf')) {
$title = undo_utf($title);
$bbuserinfo['username'] = undo_utf($bbuserinfo['username']);
}

I'm wondering if perhaps I should put that in the theme engine, rather than in the template?

myetalk
04-11-2006, 09:09 AM
You need to put this in the theme engine (the php file) where they call in the variables.

Caerydd
04-11-2006, 11:42 AM
I did, and it caused the same error. I'll try again in a bit, I'm just setting up site hierarchy now :)
edit: I'm a dumbass :D I've put it in phptemplate.engine , and realised I missed out a curly bracket >_< gah :D It all loads now, and I'm just going to test out a custom vb nav bar to see how it goes.

myetalk
04-12-2006, 09:32 AM
I did, and it caused the same error. I'll try again in a bit, I'm just setting up site hierarchy now :)
edit: I'm a dumbass :D I've put it in phptemplate.engine , and realised I missed out a curly bracket >_< gah :D It all loads now, and I'm just going to test out a custom vb nav bar to see how it goes.
Great, let us know how it goes ;)

Caerydd
04-16-2006, 11:54 AM
nope, no joy on getting the vb bar to work >< all it does is make the page load slower. BUUUT my users want it, so I guess I'll have to persevere