PDA

View Full Version : How to use a variable from one template in another template?


Illthis
03-04-2009, 07:37 AM
Hello,
i tried to use the Picture ($blocks[profile_picture]) from the MEMBERINFO template in the template NAVBAR. Unfortunately the picture will only be included if i am on the site MEMBERINFO.
I have this problem with several other templates/variables

How can i use such variables globally and not only in one template?

thanks alot

Marco van Herwaarden
03-04-2009, 08:00 AM
Variables are defined in a php-script (or plugin) and used in templates. You can only use variable that are defined in the script that calls the template.

Illthis
03-04-2009, 05:34 PM
Thanks,
where can i find the scripts which call the templates?
or in my case, where can i find the script that calls the navbar template

if there is a tutorial for this a link would be sufficient. unfortunately i didnt find an answer to that in the documentation

thanks again

--------------- Added 1236197534 at 1236197534 ---------------

well ok its the script shown in my browser adressbar i assume :-)

but now im stuck with defining the variable for the profile_picture

i did find the array list in my member.php
$globaltemplates = array(
'MEMBERINFO',

and so on



but where is the declaration?

which parts of the code do i have to implement in my index.php to be able to use the profilepicture in my index.php respectively all the other scripts i want to be able to see the user picture

Dismounted
03-05-2009, 05:02 AM
So what you want to do is to display a user's profile picture in the navbar?

Illthis
03-09-2009, 09:00 AM
yes