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 .

eZ debug

Timing: Jan 31 2025 00:37:22
Script start
Timing: Jan 31 2025 00:37:22
Module start 'content'
Timing: Jan 31 2025 00:37:22
Module end 'content'
Timing: Jan 31 2025 00:37:22
Script end

Main resources:

Total runtime0.2068 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 587.8047370.3125
Module start 'content' 0.00670.0157 958.11721,013.5938
Module end 'content' 0.02240.1843 1,971.71093,901.3750
Script end 0.2067  5,873.0859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00462.2380200.0002
Check MTime0.00150.7027200.0001
Mysql Total
Database connection0.00060.305510.0006
Mysqli_queries0.114955.57011410.0008
Looping result0.00130.62801390.0000
Template Total0.183988.910.1839
Template load0.00070.325510.0007
Template processing0.183288.603010.1832
Override
Cache load0.00040.217610.0004
Sytem overhead
Fetch class attribute can translate value0.00170.841410.0017
XML
Image XML parsing0.00020.116010.0002
General
dbfile0.00924.4311200.0005
String conversion0.00000.002330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs