X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Inserting some PHP Code.. Which file? (https://forum.x-cart.com/showthread.php?t=12676)

Jeremy.Freeman 03-08-2005 11:29 AM

Inserting some PHP Code.. Which file?
 
I need to reference a variable, that the variable is set dynamically by some php code.. to exaggerate on the matter...

I need to set "$isie" based upon a php if statement, and then echo $isie within the smarty template.

I realize to reference a php set variable in smarty, its {$isie}.. but which file should i put this PHP code in to be parsed before head.tpl? Thanks!

Jon 03-08-2005 02:24 PM

Put it a file that's called on each php page like include/check_useraccount.php

You can put it in auth.php but realize that admin/customer/partner have different auth files.

crazytees 03-09-2005 11:52 AM

I need to do something similar with PHP. I need the following PHP to run on my home.php page. Where should I add it for it to be included on the home.php?

Code:

if($_GET['a_aid'] != '')
 print "[img]http://www.crazytees.com/affiliate/scripts/t2.php?a_aid=".$_GET[[/img]";


shan 03-10-2005 02:31 AM

Quote:

Originally Posted by crazytees
I need to do something similar with PHP. I need the following PHP to run on my home.php page. Where should I add it for it to be included on the home.php?

Code:

if($_GET['a_aid'] != '')
 print "[img]http://www.crazytees.com/affiliate/scripts/t2.php?a_aid=".$_GET[[/img]";



you could require this in home.php the same as categories.php is or just do the same thing using smarty code in the templates. use things like

Code:

$smarty.get.a_aid ne ""

crazytees 03-10-2005 06:27 AM

Quote:

Originally Posted by shan
you could require this in home.php the same as categories.php is or just do the same thing using smarty code in the templates. use things like

Code:

$smarty.get.a_aid ne ""


I tried requiring it in home.php like this:
Code:

# $Id: home.php,v 1.1.2.4 2004/11/03 12:07:34 mclap Exp $
#
require "./auth.php";
require "./affiliateid.php";


and then adding the php code I need into an affiliateid.php file but it doesn't display the code. I tried calling affiliate.php as an include but that only displays the code as is without parsing the variables.

Not sure if I could use the smarty tag because it needs to call the t2.php file mentioned above to pass along the variables.

instinctual 03-10-2005 06:33 AM

Have you tried putting your php code into home.tpl surrounded with {php} and {/php}?


This works for me...


Instinctual
Colorado
X-Cart Versions 3.5.x - 4.0.12

crazytees 03-10-2005 06:38 AM

Nevermind.. I found the problem.

Helps when you aren't editing one file and uploading another... DOH!

Jon 03-10-2005 11:10 AM

It's best to avoid using {php} tags in smarty whenever possible and keep the php in the .php file and the smarty code in the smarty templates.


All times are GMT -8. The time now is 09:39 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.