![]() |
How to add php code?
i want to add som php code to home_main.tpl, how to do?
|
Re: How to add php code?
You can't add php code to templates, you need to add it to the php files - what exactly are you trying to do?
|
Re: How to add php code?
You can add php code to the .tpl files using {php}{/php} but for simplicity you should be adding it to a .php file outside of the /skin1/ directory tree.
|
Re: How to add php code?
Sorry, I should have said 'It is not good practice to add php to the templates'
|
Re: How to add php code?
for example, i want to add the following php code to x-cart:
Code:
<?php how to do? tks. |
Re: How to add php code?
Just so you know, it probably won't work.
If Wordpress has any php functions with the same names as in X-cart (which is likely) then you'll have errors. You will probably have session problems as well. As for how, I believe you'll need to put that into init.php You will also need to assign the php variables as smarty variables to call via {$variable} in your template. |
Re: How to add php code?
how to do, pls?
|
Re: How to add php code?
anybody can share his skills?
tks. |
Re: How to add php code?
Your wanting to use non-xcart and non-smarty code in an xcart and smarty environment. Not to mention wordpress is huge...
You should talk to qualiteam, bcse etc. if you really want it done. |
Re: How to add php code?
To avoid conflicts with X-Cart you should pull the Wordpress posts using an RSS feed. I created a Smarty plugin to do this. Create a file include/templater/plugins/function.sr_wpfeed.php with this code:
PHP Code:
The sample usage comments in the code shows what you can drop into your desired .tpl file to display the posts. |
All times are GMT -8. The time now is 09:55 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.