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 » Fri Aug 11, 2006 8:59 pm

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 » Sat Aug 12, 2006 2:56 pm

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 » Mon Aug 14, 2006 3:14 pm

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: 15090
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Mon Aug 14, 2006 3:15 pm

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 » Mon Aug 14, 2006 4:20 pm

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

turns into:
<!--p Include("/articles/includes/dns.html"-->

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

Post by Thorsten » Mon Aug 14, 2006 4:25 pm

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 » Mon Aug 14, 2006 4:31 pm

All I want to do is a simple include.

<?php Include("/articles/includes/dns.html")?>

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

Post by Thorsten » Mon Aug 14, 2006 4:34 pm

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 » Mon Aug 14, 2006 4:43 pm

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: 15090
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Mon Aug 14, 2006 4:45 pm

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 » Mon Aug 14, 2006 4:55 pm

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 » Tue Aug 15, 2006 12:08 pm

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 » Tue Aug 15, 2006 4:02 pm

The frame code gets stripped out when I save.

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

Post by Thorsten » Tue Aug 15, 2006 4:07 pm

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 » Tue Aug 15, 2006 4:23 pm

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