How insert php code in to a template?

I want to add the following php code to my /skins/your_skin/customer/meta.tpl


<?php<br />
	include_once $_SERVER[ 'DOCUMENT_ROOT' ].'/statistics/api/LogRequest.php';<br />
	statLogRequest();<br />
?>
```<br />
<br />
I tried using as below..... <br />
<br />
```php
{literal}<br />
<?php<br />
	include_once $_SERVER[ 'DOCUMENT_ROOT' ].'/statistics/api/LogRequest.php';<br />
	statLogRequest();<br />
?><br />
{/literal}
```<br />
But it doesn't work... Please help me friends...<br />
Thanks,

[URL]Search Results for "docsv2" | Smarty

Thanks, that worked! Great

Sorry I’m not a programmer, but I use php include function to build static webpages and it works great.

A sample will be,





I'd like to be able to do the same in a static page like the "about us" page.

how can I use the same include tag inside the cs-cart html editor to call content from an outside static php file?

Thanks in advance for any help.

[URL]Search Results for "docsv2" | Smarty

[quote name=‘Triplets’][URL]Search Results for "docsv2" | Smarty



Thanks for your prompt reply. So suppose I have a file called sample.php



```php

text text text text


text text text


```

So all I have to do is open the "about us" page and insert this in the html editor:

```php {include_php file='/trusted_dir/sample.php'} ```

But, what will be the trusted dir? where should I store the "sample.php" file?

Sorry for this dumb question, I am kind of lost dealing with Smarty.

You can put it anywhere just point to it correctly.



I’ve always had to use the full path:



include (“/home/account/public_html/anydirectory/yourfile.php”);

Thanks you guys, but I couldn’t make it work. I’m not a programmer.

Maybe is just the html editor doesn’t allow you to write php calling funtions, just html tags.

The tags for PHP are {php} {/php} Your PHP code (without the ) go within the tags.



But you should take a serious look at why you’re doing PHP in the user-interface. You can probably use a “controller” and assign variables that would then be accessible in the template files without having to use php tags in the UI.

[quote name=‘tbirnseth’]The tags for PHP are {php} {/php} Your PHP code (without the ) go within the tags.[/QUOTE]



I insert this in the “about us” page and doesn’t work:



```php {php} include (‘/home/account/public_html/sample.php’); {/php} ```



I’ll try to learn what you are suggesting, thanks for your advice.

Most likely you are pointing to the wrong directory for the file. Also, remove the space between

“include” and the “(”, this shouldn’t matter but in php there is typically not a space.

[quote name=‘adodric’]Most likely you are pointing to the wrong directory for the file. Also, remove the space between

“include” and the “(”, this shouldn’t matter but in php there is typically not a space.[/QUOTE]



Thanks for your advice. I tried all, but the {php} tag doesn’t work. Whenever you have the time, I’ll be grateful if you provide a tested example, via PM if is better for you. Best regards.

You can’t use template variable or tags in the text boxes in the admin interface. You can only use HTML. If that’s what you meant by the template editor, then I missunderstood what you were wanting to do.



Note that after almost any change to templates, you should clear your cache for the changes to take affect.