Include PHP Code

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
os4me
Posts: 18
Joined: Fri Jul 28, 2006 8:27 pm

Include PHP Code

Post by os4me »

I want to do a PHP include for some of the articles I have written. I turned on the parser but my PHP code is just displaying without running. Is there a trick to get this to work.

My Code:
<code>print "Test";</code>

Output to screen:
<?php print "Test";?>

Thanks
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Re: Include PHP Code

Post by matteo »

Hi,
os4me wrote:I want to do a PHP include for some of the articles I have written. I turned on the parser but my PHP code is just displaying without running. Is there a trick to get this to work.

My Code:
<code>print "Test";</code>
you need to insert PHP code with its own tags, do not use <code>:

Code: Select all

<?php print "Test";?>
Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
os4me
Posts: 18
Joined: Fri Jul 28, 2006 8:27 pm

Post by os4me »

When I add the following:
<? include("/articles/includes/dns.html") ?>

it gets changed to:
<!--nclude("/articles/includes/dns.html")-->

My include never gets displayed.
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

please use <?php and not <?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
os4me
Posts: 18
Joined: Fri Jul 28, 2006 8:27 pm

Post by os4me »

Now I have:
<?php Include("/articles/includes/dns.html")?>

turns into:
<!--p Include("/articles/includes/dns.html"-->
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

what do you want to do exactly? Post some lines of code or do you need it to be esecuted?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
os4me
Posts: 18
Joined: Fri Jul 28, 2006 8:27 pm

Post by os4me »

All I want to do is a simple include.

<?php Include("/articles/includes/dns.html")?>
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

do you want this in a FAQ record? If yes, that won't work.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
os4me
Posts: 18
Joined: Fri Jul 28, 2006 8:27 pm

Post by os4me »

Yes I want the include in the faq. Is there another way to do this? I have a handfull of articles that an include would be nice.
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

no, there's no other way.... why not set a link on that page?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
os4me
Posts: 18
Joined: Fri Jul 28, 2006 8:27 pm

Post by os4me »

it just looks nicer to display the info without the extra click.
Dukewh
Posts: 31
Joined: Sun Aug 29, 2004 1:03 am
Contact:

Post by Dukewh »

Thorsten wrote: no, there's no other way....
doch, es geht über iFarme:
(auszuführender Code in Test.php)

<iframe src="path/test.php" name="iFrame" width="100%" height="400" align="default" id="iFrame">
</iframe>
M.f.G.u.b.d.T.
Duke
os4me
Posts: 18
Joined: Fri Jul 28, 2006 8:27 pm

Post by os4me »

The frame code gets stripped out when I save.
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,
os4me wrote:The frame code gets stripped out when I save.
correct, that's because of security reasons.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Dukewh
Posts: 31
Joined: Sun Aug 29, 2004 1:03 am
Contact:

Post by Dukewh »

tschuldigung, hab ich vergessen zu schreiben.

Geht natürlich nur für den Admin wenn er in der DB direkt schreibt (phpmyAdmin), also in Db - faqdata - content
M.f.G.u.b.d.T.
Duke
Post Reply