Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Article Manager 2:
PHP INCLUDES / Retaining Include Code in Published Articles

 

 


PositiveMedia
Novice

Dec 19, 2008, 7:49 AM

Post #1 of 7 (4042 views)
Shortcut
PHP INCLUDES / Retaining Include Code in Published Articles Can't Post

Hello !

NEW EDIT - SEE BOTTOM POST FOR SOLUTION !

How do I retain PHP Include code in published AM2 Articles?
(that do not execute when the Article is published, but execute when the publised Article page is viewed/called)

I have a Navigation Menu and text/graphics Snippets that change frequently on our site.
In our static, non AM2 pages, the PHP Include is executed when someone views/calls each page (SSI).

I have read several posts on how to insert PHP Includes into Templates, but it seems they all execute the PHP Include upon publishing the Article.
I need a PHP Include that stays "in-tact" when an Article is publised so that our Navigation Menu and Snippets are executed when each page is viewed/called.
We do not use Authors on our site (internal staff updates), so we are not worried about the security of allowing Authors to post code.

Is there a way to include a block of code in the Article Templates so that we can accomplish this?
I have tried the following:
1) Set the "Dynamic SSI Parsing" to "Server Resolved - supports SSIs and server side code" and set "Temporary File Extension" to "PHP".
2) Added a new Field in my Article Database named "include" (textfield).
3) Added a "TemplateIf" statement in the Article Template to call the "include" if not blank.

TEST: Here is the code I used in the Article Template:
<!-- templateIf: $article.include$ ne "" -->
$article.include$
<!-- /templateIf -->

RESULTS: Publishing the Article disables the PHP Include.
" Warning: include() [function.include]: URL file-access is disabled... "

I have tried using both a "textfield" and a "text box", both did not work.
I even tried to use a PHP Include that called another PHP Include to see if the code would be inserted... but that got stripped too!

Any help would be greatly appreciated...
Thanks, Greg S.
positivemedia.com

(This post was edited by PositiveMedia on Mar 31, 2009, 8:15 AM)


Donna
Staff / Moderator


Dec 22, 2008, 3:42 PM

Post #2 of 7 (4009 views)
Shortcut
Re: [PositiveMedia] PHP INCLUDES / Retaining Include Code in Published Articles [In reply to] Can't Post

Hi there,

By default, Article Manager will strip out any extraneous code as it can cause a security issue -- but, if you're absolutely positive that nobody that isn't trusted is going to be updating your site, go into Admin > General Settings -> Security Settings and uncheck the "Remove Code Blocks" option. :)

Let me know if that works for you!

Donna

--
support@interactivetools.com


PositiveMedia
Novice

Dec 29, 2008, 8:05 AM

Post #3 of 7 (3851 views)
Shortcut
Re: [Donna] PHP INCLUDES / Retaining Include Code in Published Articles [In reply to] Can't Post

Donna-
Thanks for the response!

I tried the solution you posted before I posted my problem.
When I uncheck the "Remove Code Blocks" option, the AM2 system still strips my PHP Include code blocks.

I have tried inserting my PHP Includes both as a direct line of code in the Article Template AND by adding the block via a database field entry... both ways still get the code block stripped when I post the article.
Are there any other reasons the system would be stripping the code blocks? Thanks !
Thanks, Greg S.
positivemedia.com


Donna
Staff / Moderator


Jan 2, 2009, 4:45 PM

Post #4 of 7 (3684 views)
Shortcut
Re: [PositiveMedia] PHP INCLUDES / Retaining Include Code in Published Articles [In reply to] Can't Post

Hi there,

Hmm, I think I'd have to take a look at that -- can you send us a support request, and include a sample of what you're adding and where? If I can poke around a bit, I can probably track down what's going on here. :)

Donna

--
support@interactivetools.com


gwiley
User

Jan 10, 2009, 5:30 PM

Post #5 of 7 (3487 views)
Shortcut
Re: [Donna] PHP INCLUDES / Retaining Include Code in Published Articles [In reply to] Can't Post

I'm having the same problem adding Ad Banner code (php code) to the articles. I have PHP code working in the templates and other parts of the site (the htm/html pages are parsed correctly). When I publish the article the PHP code is remarked out (i.e. <!--- <php?code --> ) even with the "Remove PHP & ASP code block tags from user input" unchecked.


Donna
Staff / Moderator


Jan 12, 2009, 12:59 PM

Post #6 of 7 (3441 views)
Shortcut
Re: [gwiley] PHP INCLUDES / Retaining Include Code in Published Articles [In reply to] Can't Post

Hi there,

Drop me a support ticket here:

https://www.interactivetools.com/support/email_support.cgi

We can take a look at that for you. : )

Donna

--
support@interactivetools.com


PositiveMedia
Novice

Mar 31, 2009, 8:14 AM

Post #7 of 7 (2517 views)
Shortcut
Re: [Donna] PHP INCLUDES / Retaining Include Code in Published Articles [In reply to] Can't Post

Just wanted to thank Donna for her help and assistance !!!

With her help, I discovered the following works on my server... and it may work on yours.

SOLUTION TO POST PHP INCLUDE CODE IN YOUR ARTICLES:

1) Enable "Code Blocks" under Admin > General Settings

2) You must use "server root paths" to the file you want to include in your PHP Include code statement.

PATH EXAMPLE:
"/root/ACCOUNT_NAME/public_html/FOLDER-NAME/FILE-NAME.php"


NOTICE - As IT recommends, you should only allow code blocks in articles if you are not concerned with the security of your authors and the code they may place in articles... thanks IT !

Hope this helps !
Thanks, Greg S.
positivemedia.com

(This post was edited by PositiveMedia on Mar 31, 2009, 8:16 AM)