include file & php script

Discuss PivotX 2.0.x here. Non-PivotX related discussions go in The Drain.

include file & php script

Postby docman » Tue Jun 02, 2009 6:32 pm

Hi, I have a php script in file.php. I included this file as

[[include file="skinny/file.php"]]

The script does not seem to get executed.

Hence, my question. Can one excute a php script this way?

With Pivot I did not seem to have this problem.

Thanks.
docman
 
Posts: 33
Joined: Sun Apr 13, 2008 12:11 pm

Re: include file & php script

Postby Schop » Tue Jun 02, 2009 8:21 pm

This question has been answered before on the support forum. You should really use the search function of the forum before asking these questions, because after a while, people will just ignore the questions I believe.

Anyway, to get your PHP script working, first "allow_php_in_templates" to 1 in the config.

After that, include your PHP file between [[php]] and [[/php]] tags, like this:

[[ php ]]include("templates/whatever_your_filename_is.php");[[ /php ]]
User avatar
Schop
Contributor
 
Posts: 485
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Re: include file & php script

Postby docman » Tue Jun 02, 2009 9:00 pm

Thanks for your help.
docman
 
Posts: 33
Joined: Sun Apr 13, 2008 12:11 pm

Re: include file & php script

Postby docman » Tue Jun 02, 2009 9:05 pm

Hi Kevin, May I follow up with this. I went to Advanced Config, but could not find the parameter "allow_php_in_templates". I went ahead, and added it and set to 1. I suppose this is what I meant to do, for it works.

Thanks.
docman
 
Posts: 33
Joined: Sun Apr 13, 2008 12:11 pm

Re: include file & php script

Postby docman » Wed Jun 03, 2009 10:04 pm

Hi, I am still tackling this issue.

I want to use a contact form php-scipt.

I inserted it in a directory within pivotx, and I execute it from a page like

[[php]]include("contact/contact.php");[[/php]]

The form does not get rendered, hence nothing happens, however, if I execute it directly via the browser pointing to the particular file, it seems to work just fine.

I assume the the [[php]]include("contact/contact.php");[[/php]] tag reagrds pivotx as its root.

Thanks for your adwise.
docman
 
Posts: 33
Joined: Sun Apr 13, 2008 12:11 pm

Re: include file & php script

Postby rabbeltje » Thu Jun 04, 2009 6:34 am

if i am not mistaken (so correct me here anyone if i am wrong) the 'default' folder is the templates-folder.
User avatar
rabbeltje
 
Posts: 358
Joined: Mon Aug 25, 2008 11:54 am
Location: Neerbeek, The Netherlands

Re: include file & php script

Postby docman » Thu Jun 04, 2009 7:21 am

I guess, not.

The default folder differes for the two version of the "include" tag.

For "include file=" it is "templates". for "[[php]](include"..." it is pivotx.
docman
 
Posts: 33
Joined: Sun Apr 13, 2008 12:11 pm

Re: include file & php script

Postby rabbeltje » Thu Jun 04, 2009 8:18 am

right!

so, if you are using a contactform, why not use this one: viewtopic.php?f=9&t=451
User avatar
rabbeltje
 
Posts: 358
Joined: Mon Aug 25, 2008 11:54 am
Location: Neerbeek, The Netherlands

Re: include file & php script

Postby docman » Thu Jun 04, 2009 5:14 pm

Thank for this excellent suggestion!

I installed it and included on a page. My PivotX installation is still local, so I cannot tell is it does the full job (emailing the info, that it does not, yet). I suppose it will do in a live installation.

However, what do you think about this comment, the last in the thread you directed me to:

"Hello Thijs,

I'm not sure if I can help you, but first of all a question: do you use PHP to set up a contact form? 'Cause the new Pivot is using a template engine, PHP won't be parsed correctly if you use it in your templates. I used php to include some files, but this lead to wrong results. I was unable to set up an in-Pivot contact form and made therefore a 'stand alone'

I'm curious... :)

Greetings,

Pieter"
docman
 
Posts: 33
Joined: Sun Apr 13, 2008 12:11 pm

Re: include file & php script

Postby rabbeltje » Fri Jun 05, 2009 6:43 am

all i can say is i followed the directions and it's working perfectly fine for me!

(that, by the way, wasn't the last message: there's another page ;))
User avatar
rabbeltje
 
Posts: 358
Joined: Mon Aug 25, 2008 11:54 am
Location: Neerbeek, The Netherlands


Return to 2.x Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron