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 .

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 04:16:29
Script start
Timing: Jan 31 2025 04:16:29
Module start 'layout'
Timing: Jan 31 2025 04:16:29
Module start 'content'
Timing: Jan 31 2025 04:16:31
Module end 'content'
Timing: Jan 31 2025 04:16:31
Script end

Main resources:

Total runtime1.4325 sec
Peak memory usage4,096.0000 KB
Database Queries81

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.0078151.1953
Module start 'layout' 0.00470.0023 739.203136.6172
Module start 'content' 0.00701.4246 775.82031,035.2266
Module end 'content' 1.43170.0008 1,811.046919.8828
Script end 1.4325  1,830.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2248160.0002
Check MTime0.00130.0882160.0001
Mysql Total
Database connection0.00060.040310.0006
Mysqli_queries1.355294.6052810.0167
Looping result0.00070.0478790.0000
Template Total1.401297.820.7006
Template load0.00200.140720.0010
Template processing1.399197.669820.6996
Template load and register function0.00140.097410.0014
states
state_id_array0.00190.135410.0019
state_identifier_array0.00220.153020.0011
Override
Cache load0.00190.1306770.0000
Sytem overhead
Fetch class attribute can translate value0.00080.058220.0004
Fetch class attribute name0.00180.1241120.0001
XML
Image XML parsing0.00060.042920.0003
class_abstraction
Instantiating content class attribute0.00000.0019150.0000
General
dbfile0.00280.1926180.0002
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
11content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
21content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 48
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs