Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
PHP in templates
Goto page Previous  1, 2, 3
 
Reply to topic    Forum Index » Additional Downloads View previous topic
View next topic
PHP in templates
Author Message
snatch518



Joined: 07 Jun 2008
Posts: 8

Post Still won't work Reply with quote
After enabling the script, my template still will not display PHP.

Here's the code I'm using:

Code:
<?php include("/home/wrestl76/public_html/news/latest_news.php"); ?>


Any idea as to why this won't display?
Mon Jun 23, 2008 6:02 pm View user's profile Send private message
Guest








Please login to hide the ads.

daves



Joined: 03 Sep 2008
Posts: 1

Post Php in Templates Reply with quote
Hi

Does this plugin work with the latest version of Cutenews.RU cos I cannot get it to call a php function using

<php functionname(); ?>

Thanks for any help
Wed Sep 03, 2008 8:58 am View user's profile Send private message
flesh



Joined: 04 Mar 2006
Posts: 89
Location: Poland

Post Reply with quote
I am trying to use this code ...

Code:


<?php
if ({phpbbname}=="Anonymous"){
?>
<iframe src="login.php" name="iframe" frameborder="0" scrolling="auto" width="100%" height="270px"></iframe>

<?php
   return;
}
?>

why isn't it working ...
Fri Sep 19, 2008 9:03 am View user's profile Send private message
flesh



Joined: 04 Mar 2006
Posts: 89
Location: Poland

Post Reply with quote
or this :

Code:

<?
if ({phpbbact}>0)
{
echo 'Comment form';
}
else
{
echo 'Login form';

}

?>

I've added this {phpbbact} and it is 1 when the user is active and 0 when it is not active ... but why is it not working ...
when I test it it shows
Code:
0) { echo 'comment form'; } else { echo 'login form'; } ?>

Fri Sep 19, 2008 9:28 am View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2736
Location: Germany

Post Reply with quote
A quotation from the first page:
Quote:
Make sure you use the full PHP tags: <?php echo 'blahblah'; ?>

This won't work: <? echo 'blahblah'; ?>

Thu Sep 25, 2008 5:52 pm View user's profile Send private message
flesh



Joined: 04 Mar 2006
Posts: 89
Location: Poland

Post Reply with quote
FI-DD wrote:
A quotation from the first page:
Quote:
Make sure you use the full PHP tags: <?php echo 'blahblah'; ?>

This won't work: <? echo 'blahblah'; ?>

I actually did it this way:
Code:

<?php
if ({phpbbact}==1)
{
echo "comment form";
}
else
{
echo "login form";

}

?>

it shows nothing ...
Fri Sep 26, 2008 12:14 pm View user's profile Send private message
flesh



Joined: 04 Mar 2006
Posts: 89
Location: Poland

Post Reply with quote
Do I have to do all this stuff http://www.xs4all.nl/~cvdtak/phpintemplates_1.2.htm
with replacing and adding code or I just have to add the php-in-templates.php file in the plugins folder and to activate it ?

for me is not working even
Code:
<?PHP echo "login form"; ?>

Fri Sep 26, 2008 12:34 pm View user's profile Send private message
flesh



Joined: 04 Mar 2006
Posts: 89
Location: Poland

Post Reply with quote
Ok I did it this way
copy in inc/show.commentform.php:

$output = preg_replace_callback('/<\\?php(.*?)\\?>/is', 'phpTemplateEval', $output);

and now it is working ... sorry for bothering
Fri Sep 26, 2008 1:20 pm View user's profile Send private message
flesh



Joined: 04 Mar 2006
Posts: 89
Location: Poland

Post Reply with quote
OK now I can use PHP in the templates but it is not working this code:

Code:
<?PHP
if ({phpbbact}==1)
{ echo '<input type="hidden" id="name" type="text" size="20" name="name" tabindex="1" value="{phpbbname}" /><br /><label for="mail"><input type="hidden" id="mail" type="text" size="20" name="mail" tabindex="2" value="{phpbbavatar}" /></label><br />{smilies}<br /><textarea cols="50" rows="8" name="comments" tabindex="3"></textarea><br /><input class="input" type="submit" tabindex="4" name="submit" value="Leave a comment" /><br/>';}
else
{
echo '<form action="login2.php" method="post" style="margin: 0px;"><input type="hidden" name="redirect" value="indexsite" /><input type="hidden" name="redirect" value="../r.html" /><table border="0" style="font-size:12px;" width="130" cellspacing="0" cellpadding="0"><tr><td class="left" height="25"><b>User:</b></td></tr><tr>
<td class="left" height="25">
<input type="text" name="username" size="10" maxlength="25">
</td>
</tr>
<tr>
<td class="left" height="25">
<b>Password:</b>
</td>
</tr>
<tr>
<td class="left" height="25">
<input type="password" name="password" size="10" maxlength="25">
</td>
</tr>
<tr>
<td class="left" height="35">
<input type="submit" name="login" value="Login">
</td>
</tr>
</table>
</form>
';} ?>


When I change the first echo with something else (for example echo "lala"Wink it works ... so the problem I have is in the first echo ...
The first echo is with the comment form ... it is like this:
Code:
<input type="hidden" id="name" type="text" size="20" name="name" tabindex="1" value="{phpbbname}" /><br /><label for="mail"><input type="hidden" id="mail" type="text" size="20" name="mail" tabindex="2" value="{phpbbavatar}" /></label><br />{smilies}<br /><textarea cols="50" rows="8" name="comments" tabindex="3"></textarea><br /><input class="input" type="submit" tabindex="4" name="submit" value="Leave a comment" /><br/>


it sows me this error:
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in /php-in-templates.php(2Cool : eval()'d code on line 2

what is wrong with this comment form code ... do I have to add <form> tag and if I have to ... what to write in it ...
I don't have an idea Sad
Sat Sep 27, 2008 8:53 am View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2736
Location: Germany

Post Reply with quote
flesh wrote:
When I change the first echo with something else (for example echo "lala"Wink it works ... so the problem I have is in the first echo ...

Then add your echo code word by word and check the result after each word. That way you will find out what's causing the error.
Fri Oct 03, 2008 9:24 am View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » Additional Downloads All times are GMT + 1 Hour
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.