PDA

View Full Version : How to put PHP code into "image_template" ?


Dr.Ozdi
06-03-2007, 08:23 PM
I would like put into classic "image_template.html" few rows of PHP code. I have idea put there something like <EXTERNAL_PHP_CODE> and code insert in admin part...but Iīm not specialist for PHP.

Thanks this addon will be able put into clasic HTML template AdSence, shop offer or whatever.

Thanks for your suggestions
Dr.

dakwegmo
06-04-2007, 01:51 AM
The way that PP is designed doesn't allow for inserting PHP code directly into the templates. In order to have something show up in a template, you have to create an addon that produces the output you want, then use tags to replace the PHP output in the template.

PP comes with a sample addon, Current Date Time, that will serve you well in figuring out how to get the code into your site.

Dr.Ozdi
06-04-2007, 03:40 PM
Thanks
I had some similar ideas, but PHP is not my cup of tee....HTML or server solutions are not acceptable.

Is here someone who can write/rewrite this addon?

Thanks in advance
Dr.

Dr.Ozdi
03-07-2008, 04:11 PM
I would like ask if here is anybody who can write addon/or somethink I mentioned. I used "Text Addon" but it doesnīt work with PHP code...

Thanks for suggestions in advance
Dr.

fredxeric
03-07-2008, 04:30 PM
just create an addons the name you want and enable it


create files called: external_php_code.php

<?php
$addon_version = "0.0.1";
$addon_name= "EXTERNAL_PHP_CODE";
$addon_description = '&lt;"EXTERNAL_PHP_CODE&gt;';


$external_php_code = '';

$external_php_code .= 'your code here';


$tpl = ereg_replace("<EXTERNAL_PHP_CODE>",$external_php_code,$tpl);
?>

Dr.Ozdi
03-07-2008, 08:05 PM
I used it, it looks great, but in the first row of my page is message from server, file is not in the same place or doesnt have atributs 666. I use long PHP code in the rows, like Adsence, if itīs important.
Thanks for your help
Dr.

austriaka
03-08-2008, 07:31 AM
sounds as if there is a problem in the PHP code you inserted?

Dr.Ozdi
03-08-2008, 09:36 AM
Yes!
It wasnīt message from server, but from my external code, sorry my fault!
But anyway, in the first row of page (above "head" tag) is output of the test "external_php_code.php"...on the left side, below links is "your code here" from fred-eric addon...may be I didnīt understand instruction.
Dr.

Dr.Ozdi
03-08-2008, 09:59 AM
Iīm sure I do something wrong, can you write instruction step by step, please?
Thanks
Dr.

austriaka
03-08-2008, 12:33 PM
you have to REPLACE "your code here" with your own code, not write it somewhere else!
Since I don't know what kind of code you want to place here it is hard to tell.
If the code produces some Output, set the output into a variable (replace echo if there is echo) and put the variable of the output into "$external_php_code".

If you have not the minimum PHP knowledge this is not so easy, I know.
If everything fails, post the PHP code you want to use

Dr.Ozdi
03-08-2008, 01:12 PM
Ya, itīs not easy.
I want to use PHP code of links exchange system. Script has aditional *.dat file in root and load links from exchange server.
Code I want to put into my image_template.html is here http://drozdi-foti.prodam-chalupu.cz/external_php_code.txt
Dr.

Dr.Ozdi
03-22-2008, 09:23 PM
Well, I tried solve it by myself, but its up to my knowledge.
Do you have any advice how to put php code via my older post into fredxericīs addon? Thanks
Dr.

fredxeric
03-23-2008, 02:16 AM
Well, I tried solve it by myself, but its up to my knowledge.
Do you have any advice how to put php code via my older post into fredxericīs addon? Thanks
Dr.

PM me with more info on what you would like to have

Dr.Ozdi
03-27-2008, 01:00 PM
fredxeric, I sent you my plans via forum messenger, Iīm not sure if it worked well...
Dr.