How to include other php files in templates

Tutorials for <a href="http://www.phpbbstyles.com/viewtopic.php?t=356">eXtreme Styles mod</a> for phpBB 2.0.

Moderator: Moderators

Postby Kiss News on Sun Nov 21, 2004 10:43 am

you mean the Birthday.php file script?
It works as an Iframe.
But Iframes are not variable in height, so I would like to include it somehow else...
Kiss News
Registered User
Registered User
 
Posts: 10
Joined: Fri Nov 19, 2004 1:27 pm

Postby PostBot on Sun Nov 21, 2004 10:47 am

If it works in iframe it doesn't mean it can be included. It has its own initialization that is probably conflicts with phpBB initialization, its own variables, etc...

Try getting normal birthday mod instead of that junk. Normal mod should modify index.php, not be included in iframe.
Do NOT pm me, I don't visit this forum anymore, don't own it, don't provide any support and don't moderate.
User avatar
PostBot
Moderator
Moderator
 
Posts: 10659
Joined: Sat Aug 02, 2003 3:52 pm
Location: Mars

Postby Kiss News on Sun Nov 21, 2004 10:50 am

When I do this, the index-page takes 14 seconds to load instead of 3 seconds. It's all because of the birthday mod. When I include the Birthday as an Iframe, the index-page shows up in 3 seconds and the Birthdays show up 11 seconds later in the "who is online" box. That's why I made an Iframe...
Kiss News
Registered User
Registered User
 
Posts: 10
Joined: Fri Nov 19, 2004 1:27 pm

Postby PostBot on Sun Nov 21, 2004 10:53 am

If you will try to include it with xs mod then it will take even more than 14 seconds because it will do same as normal birthday mod does plus it will include its own sessions management, database, etc...

So its ether use normal mod that modifies index.php or use iframe.
Do NOT pm me, I don't visit this forum anymore, don't own it, don't provide any support and don't moderate.
User avatar
PostBot
Moderator
Moderator
 
Posts: 10659
Joined: Sat Aug 02, 2003 3:52 pm
Location: Mars

Postby Kiss News on Sun Nov 21, 2004 10:57 am

Isee. i wasn't sure. I wanted to test it out.
Thanks for the info!
Kiss News
Registered User
Registered User
 
Posts: 10
Joined: Fri Nov 19, 2004 1:27 pm

Postby shorty114 on Fri Dec 24, 2004 1:40 am

[quote user="CyberAlien" post="7628"]Try <div src="http://kissfanshop.ki.funpic.de/phpbb2/Birthday.php" />[/quote]

whoa...i never knew you could use <div src="foo.net/foobar.php">...cool!

what's the support like in browsers of that attribute?
shorty114
Registered User
Registered User
 
Posts: 99
Joined: Wed Dec 15, 2004 10:45 pm
Location: Lost...

Postby PostBot on Fri Dec 24, 2004 2:57 am

Its xhtml 2, so it isn't supported yet by browsers and when I posted it for some weird reason I thought its xhtml 1.
Do NOT pm me, I don't visit this forum anymore, don't own it, don't provide any support and don't moderate.
User avatar
PostBot
Moderator
Moderator
 
Posts: 10659
Joined: Sat Aug 02, 2003 3:52 pm
Location: Mars

Hi guys Could u tell me !!!

Postby King_niral on Sat Aug 20, 2005 10:15 am

Hi everyone,

I am starting a Phpbb2 Forum and would like to add the friends birthday feature and All the faetures I saw on http://www.kissforum.de/phpbb2/index.php And if not all most of them coz 1st i was going in for the trial version of IPB but when i saw this page i was very happy I would love to add this mod Plz tell me from where can i get it and how to do the modification !!! I even wanted to change the theme From subsilver to another Theme i found long ago dont rember where i had installed it on my previous forum but no one liked it COz the Option of Quick reply was not available !!! Like in SUBSILVER theme !!! Plz help me !!!



Thanx in advance !!!!
King_niral
Registered User
Registered User
 
Posts: 1
Joined: Sat Aug 20, 2005 10:08 am

template variables

Postby dooballoh on Sun Nov 20, 2005 6:35 pm

Hello,

I need help on variables. I have asked in phpbb.com and someone reffer me to here.
I am trying to inclues TPL file (not a php file) in another TPL file.

1. If I created NEW TPL file called news.tpl and placed in ../templates/template_name/HERE

2. I asume I must add something like these either;
'NEWS' => $lang ['news'],
OR
'NEWS' => include(news.tpl))

What is correct variables in this case? because IT is a .tpl file to includes (not a text) I am really confused here.
Where (in which file) to add this variables?

3. I understand that I can call it (includes) by using {NEWS} in anywhere of other .tpl files. Am I right?

Please help in step by step.
Thank you in advance
dooballoh
Registered User
Registered User
 
Posts: 3
Joined: Sun Nov 20, 2005 6:18 pm

Postby DooBDee on Sun Nov 20, 2005 6:38 pm

Greetings,

If yuo want to include another TPL file in another then simply use

Code: Select all
<?php include('news.tpl'); ?>


And type that in your TPL file where you want the file to be included.
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby dooballoh on Sun Nov 20, 2005 6:54 pm

Hi,

Thank you very much for the quick response.

Oh, That's what I was really confused about.

Let say, If I want include 'news.tpl' in somewhere of index_body.tpl,
shouldn't I used {NEWS}???
Example; in posting_body.tpl, there is place include {POLLBOX} somewhere in
<tr><td>{POLLBOX}</td></tr>

So, you mean I can use;
<tr><td><?php include('news.tpl'); ?> </td></tr>?
Instead of;
<tr><td>{NEWS}</td></tr>???

In this news.tpl has html codes and links, and I named 'news.tpl'

Please help.
Thank you in advance.
dooballoh
Registered User
Registered User
 
Posts: 3
Joined: Sun Nov 20, 2005 6:18 pm

Postby UseLess on Sun Nov 20, 2005 6:57 pm

Greetings,

There are a few ways to do this;

1. as Doobde suggested (but this would require eXtreme Styles Mod as it's using PHP in template files, see downloads on index for link)

2. You can use this;

Code: Select all
<!-- INCLUDE template_name.tpl -->


which also requires XS Mod

3. This way, using a seperate php file you setup the template file to use;

Code: Select all
$template->set_filenames(array('news' => 'news_template.tpl'));


assign the vars/loops like you normally would then use the following, instead of '$template->pparse('<handle name>');'

Code: Select all
$template->assign_var_from_handle('MY_NEWS', 'news');


you then use '{MY_NEWS}' in the main template file such as 'index_body.tpl'
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK

Postby DooBDee on Sun Nov 20, 2005 7:01 pm

{NEWS} is a template variable. These are assigned from PHP files.

For example,

Code: Select all
$template->set_filenames(array( 
       'body' => 'index_body.tpl')
); 
$template->assign_vars(array('VARNAME1' => $phpstringval1, 
                             'TEMPLATE_VAR_ONE' => $php_var_one, 
                             'TEMPLATE_VAR_TWO' => $php_var_two) 
);
$template->pparse('body');


The above code would assign $phpstringval1, $php_var_one, $php_var_two to its matching template variables, VARNAME1, TEMPLATE_VAR_ONE, TEMPLATE_VAR_TWO to file index_body.tpl.

The php variables, $php_var_one etc... can be language entries, just about anything you want. more information can be found here - viewtopic.php?t=8604

For what you want to do, you can simply use <?php include('news.tpl'); ?> and this would work fine.
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby dooballoh on Sun Nov 20, 2005 7:22 pm

Hi,

Thank you very much to all for great help!!! :lol:

It is works.
I was using XS MOD and includes with;
<!-- INCLUDE template_name.tpl -->

I will try otherways you two recomanded.

Thank you again.
You are the greatest. :lol:
dooballoh
Registered User
Registered User
 
Posts: 3
Joined: Sun Nov 20, 2005 6:18 pm

Previous

Return to eXtreme Styles mod tutorials

Who is online

Users browsing this forum: No registered users and 1 guest