Forums / Developer / php in template

php in template

Author Message

jb bianchi

Tuesday 23 August 2005 8:18:36 am

Hi,

I read this page:

http://ez.no/products/ez_publish_...lopment/extensions/template_operator

and no result. Can I have help please?

jb bianchi

Wednesday 24 August 2005 2:27:41 am

hi,

Nobody know how can I include php function in templates?
It's important and I don't achieve alone.

thank's.

Marko Žmak

Thursday 25 August 2005 12:14:54 am

Read this:

http://ez.no/products/ez_publish_cms/documentation/customization/tips_tricks/how_can_i_use_my_own_php_script_inside_ezp
http://ez.no/products/ez_publish_cms/documentation/customization/tips_tricks/including_php_files_in_templates

and lso search the forum for keywords relevant to your question. There were many posts about this topic.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

jb bianchi

Thursday 25 August 2005 2:23:34 am

thank's I have tried but I don't achieve to do php.

jb bianchi

Thursday 25 August 2005 5:43:50 am

hi,

in http://ez.no/products/ez_publish_...cks/including_php_files_in_templates*

My web is on my local server. how can do it because in the page it is writing :

{"http://www.mydomain.com/myfile.php"|marksPHPinsert}

The path to the file you wish to include must be a url ( http://www.mydomain.com/myfile.php) instead of a local path (e.g. /local/path/to/file.php), because the local file will not be parsed. It will just show unparsed php code (of course).

thank's

Marko Žmak

Thursday 25 August 2005 5:59:00 am

Do something like this:

{"http://localhost/path/to/script/script.php"|marksPHPinsert}

If script.php is in the same dir as eZ installation you might want to edit the .htacces file.

P.S. And please don't copy-paste just the text of the link in the froum, because the text is shortened with "..." so the link becomes unusable. Copy link location instead.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

jb bianchi

Thursday 25 August 2005 6:11:35 am

thank's

for example,

In ez publish directory I have bin, cronjobs, design.... and I have created a directory files where I paste all my php 's files. Can I do this:

{"http://localhost/path/to/script/files/script.php"|marksPHPinsert}

And why might I want to edit htacces?

Marko Žmak

Thursday 25 August 2005 6:35:15 am

BEcause you might have something like this in the .htacces file:

<FilesMatch ".">
order allow,deny
deny from all
</FilesMatch>

<FilesMatch "(index\.php|\.(gif|jpe?g|png|css|js|html))$">
order allow,deny
allow from all
</FilesMatch>

If that's the case (and these lines are not commented) your web server won't let you acces .php files (except index.php) under the directory structure where this .htacces file is located.

There are 2 sollutions:

1. Comment these lines (insecure and not recomended, only for testing)

2. put a .htaccess file with this content:

</code> <FilesMatch "\.php$">
order allow,deny
allow from all
</FilesMatch>
</code>

in the "files" directory.

Hope it works for you.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

jb bianchi

Thursday 25 August 2005 7:12:50 am

In a template I have wrote this :

{"http://localhost/path/to/script/files/essai.php"|marksPHPinsert}
and in the directory "files" I have a .htaccess and a file "essai.php" and in this php 's files there is this code:

<?
echo 'hello';
?>

When I try to open the template there is a warning:

Fatal error: MAximun execution time of 30 seconde exceeded in C:\ezpublish\lib\ezutlis\classes\ezdebug.php on line 1799

Fatal error:ez Publish did not finish its request

the execution of eZ P was abruptly ended, the debug output is present below.

Marko Žmak

Thursday 25 August 2005 11:10:35 am

Well this could be a problem in the extension, so you should probably ask the author or someone who knows how it works about this. You could try:

<?PHP
echo 'hello';
?>

but I don't think that's the problem. Also try to see what happens when you try to open a regular HTML page (say essai.html) without PHP code in this way.

Yes, also check the permissions on file essai.php.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

jb bianchi

Friday 26 August 2005 2:36:44 am

hi,

thank's for your answer. I have tried with a html files and the result is the same.
on the other hand there is maybe a problem with the permission because I have no change them. But I use ezP on win XP and I am admin.
I used to code with linux but my boss obliged me to use win XP and Idon't know very well XP cause I prefer Linux so I don't know how change permissions with winXP but I will look this now .