FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


{$variablel} on phpbb





Philip
uhm, how to assign a variable like this {$variable} ?
so we can used it on html ?

Like

<html>
<body>
<$content>
</body>
</html>

thanks,
Philip
LukeakaDanish
I think the {U_USERNAME} type variables are defined in the .cfg file in your template folder.

Note: There are NO $ signs in front of them as far as i remember...
deedee
Check your privmsg.php file. Look at line 2069 (can be different, search for "Dump vars to template" as that is where it starts).
Now check templates/subSilver(example)/privmsgs_body.tpl.
You'll see same vars:
Code:
//privmsg.php

$template->assign_vars(array(
   'BOX_NAME' => $l_box_name,
   'INBOX_IMG' => $inbox_img,
   'SENTBOX_IMG' => $sentbox_img,
   'OUTBOX_IMG' => $outbox_img,
   'SAVEBOX_IMG' => $savebox_img,
   'INBOX' => $inbox_url,
   'SENTBOX' => $sentbox_url,
   'OUTBOX' => $outbox_url,
   'SAVEBOX' => $savebox_url,

//privmsgs_body.tpl

<table height="40" cellspacing="2" cellpadding="2" border="0">
      <tr valign="middle">
        <td>{INBOX_IMG}</td>
        <td><span class="cattitle">{INBOX} &nbsp;</span></td>
        <td>{SENTBOX_IMG}</td>
        <td><span class="cattitle">{SENTBOX} &nbsp;</span></td>
        <td>{OUTBOX_IMG}</td>
        <td><span class="cattitle">{OUTBOX} &nbsp;</span></td>
        <td>{SAVEBOX_IMG}</td>
        <td><span class="cattitle">{SAVEBOX} &nbsp;</span></td>
      </tr>
     </table>

Just copied and pasted some parts.

You'll see that, as an example, that the defined variable $inbox_url is assigned to a var called INBOX. In the template file, {INBOX} is used for the url to the inbox.

Get it? Just look at phpBB's source file's, and you'll figure it out yourself!
Philip
Quote:
Note: There are NO $ signs in front of them as far as i remember...

Ah, i'm wrong Razz
thanks,
then, how can i create own {variable} that work on phpBB ?
i am still confuses, how phpBB design work ? is it like this

For index forum
Code:
index.php --contain--> template --contain--> preview

is it like this ?

For profile forum
Code:
profile.php --contain--> template --contain--> preview

is it like this ?

thanks Smile
n0obie4life
http://www.phpbb.com/kb/article.php?article_id=200

That knowledge base article will help you.
Philip
thanks very much, that was helped me., at least i know how to create {variable} know.


but a little more question please..
Code:
$template->assign_var('VARIABLE' , $value );

this is for assign a variable like usually

Code:
$template->assign_vars(array( 'VARNAME1' => $phpstringval1,
                              'VARNAME2' => $phpstringval2,
                              'VARNAME3' => $phpstringval3,
                              ... etc ..
                              'VARNAMEn' => $phpstringvaln
                            )
                       );

this is for assign a variable more than one.

Code:
 $template->assign_block_vars('switch_user_logged_in',array() );

this is for what ?

Code:

 $template->assign_var_from_handle('POLL_DISPLAY', 'pollbox');


this is for what also ?

thanks,
Philip
LukeakaDanish
The first variable is for a variable used in a <!--SWITCH--> statement in the document - this is sort-of like an if conditional in PHP. Read more about switch statements in phpBB's styles forum.

As i have never mande any original templates for phpBB myself im not entirely sure about the second one, however it looks like its the one which controls whether the user sees the POLL or the POLL results.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.