PHP and TPL?

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
stingone
Posts: 25
Joined: Tue Jun 21, 2011 11:31 am

PHP and TPL?

Post by stingone »

Hi all,

I try to add a link to the left menu. But it will only pop-up if the users login with my login script. How can i add the script, so the links wil be vissable and when people click on the links it wil appair in the main content.

<?php
if (isset($_SESSION['user_id'])) {?>
<div class="myaccount">
<p><strong>My Account</strong></p>
<a href="myaccount.php">Mijn account</a><br>
<br>
<a href="mysettings.php">Instellingen</a><br>
<br>
<a href="logout.php">Uitloggen</a></div>
<?php }
if (checkAdmin()) {
?>
<p> <a href="admin.php">Admin CP </a></p>
<?php } ?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
<td width="732" valign="top"><p>&nbsp;</p>
<h3 class="titlehdr">Welkom<?php echo $_SESSION['user_name'];?></h3>
<?php
if (isset($_GET['msg'])) {
echo "<div class=\"error\">$_GET[msg]</div>";
}

?>
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: PHP and TPL?

Post by Thorsten »

Hi,

this won't work, try this: http://faq.phpmyfaq.de/content/11/9/en/ ... ework.html

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
stingone
Posts: 25
Joined: Tue Jun 21, 2011 11:31 am

Re: PHP and TPL?

Post by stingone »

Ok but where is the inc/constants.php?? i dont have it in v2.3
stingone
Posts: 25
Joined: Tue Jun 21, 2011 11:31 am

Re: PHP and TPL?

Post by stingone »

Found it, it was in the config.
stingone
Posts: 25
Joined: Tue Jun 21, 2011 11:31 am

Re: PHP and TPL?

Post by stingone »

Still have some problems,

I now have the following:

<?php
include 'dbc.php';
page_protect();
?>
<?php
$testTitle = 'My first PMF page';

ob_start();
include( '/home/user/public_html/faq/myaccount.php' );
$testContent = ob_get_contents();
ob_end_clean();


$tpl->processTemplate ('writeContent', array(
'testTitle' => $testTitle,
'testContent' => $testContent
)
);
$tpl->includeTemplate('writeContent', 'index');
?>

But it gives me a white page instead of what i want to see...
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: PHP and TPL?

Post by Thorsten »

Hi,

a white page is a PHP fatal error. Please check the error log of your webserver.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply