php include

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
ueland
Posts: 4
Joined: Wed May 07, 2003 4:22 pm

php include

Post by ueland »

Hello

how can i get php includes to work in the templates files, the server is set up to parse php code i html files so that is not a problem, but it is not working. :-(
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

just put an variable in the template file, e.g. something like that

Code: Select all

{myPHPinclude}
Then edit the file index.php and put this new variable in the array:

Code: Select all

$tpl->processTemplate ("index", array(
				"writeTitle" => $title,
				"metaDescription" => $metaDescription,
				"metaKeywords" => $metaKeywords,
				"metaPublisher" => $metaPublisher,
....
                                "myPHPinclude" => include("yourpage.php"),
.....
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ueland
Posts: 4
Joined: Wed May 07, 2003 4:22 pm

Post by ueland »

i also added a include command in index.php in top and bottom of the files to get includet a file in the top and bottom before i read that. :)
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

this works, too. :)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ueland
Posts: 4
Joined: Wed May 07, 2003 4:22 pm

Post by ueland »

hmm..now all includes gets paresed first :s before the rest of the page
http://www.programmer.no/faq/index.php

"toppinclude" => @include "$DOCUMENT_ROOT/themes/2003/topp.php",
"menyh1" => include ("../themes/2003/meny_h1.php"),
"menyh2" => include ("../themes/2003/meny_h2.php"),
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

I will test this!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ueland
Posts: 4
Joined: Wed May 07, 2003 4:22 pm

Post by ueland »

Think that it got something to do with the feature of PHP, maybe you shold for the next release make php include possible in the template files and "skip" them in the index.php files. :)
Pädu

php-include in the header..?!?

Post by Pädu »

When I replace the include by a {phpmyinclude} and try to replace them as you recommended it, the included file appears on top of the page and not at the former {phpmyinclude} ;-(

http://www.studisurf.ch/services/phpmyfaq/index_kk.php

What could be wrong? Thx for support!
Post Reply