Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Inserting some PHP Code.. Which file?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-08-2005, 11:29 AM
 
Jeremy.Freeman Jeremy.Freeman is offline
 

Advanced Member
  
Join Date: Mar 2005
Posts: 79
 

Default 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!
__________________
Jeremy Freeman
EZWatch Store
X-Cart v4.1.5
Reply With Quote
  #2  
Old 03-08-2005, 02:24 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

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.
Reply With Quote
  #3  
Old 03-09-2005, 11:52 AM
  crazytees's Avatar 
crazytees crazytees is offline
 

Advanced Member
  
Join Date: Nov 2004
Location: Oklahoma
Posts: 31
 

Default

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]";
__________________
Version 4.4.1
Reply With Quote
  #4  
Old 03-10-2005, 02:31 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

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 ""
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #5  
Old 03-10-2005, 06:27 AM
  crazytees's Avatar 
crazytees crazytees is offline
 

Advanced Member
  
Join Date: Nov 2004
Location: Oklahoma
Posts: 31
 

Default

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.
__________________
Version 4.4.1
Reply With Quote
  #6  
Old 03-10-2005, 06:33 AM
 
instinctual instinctual is offline
 

eXpert
  
Join Date: Nov 2003
Posts: 247
 

Default

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
Reply With Quote
  #7  
Old 03-10-2005, 06:38 AM
  crazytees's Avatar 
crazytees crazytees is offline
 

Advanced Member
  
Join Date: Nov 2004
Location: Oklahoma
Posts: 31
 

Default

Nevermind.. I found the problem.

Helps when you aren't editing one file and uploading another... DOH!
__________________
Version 4.4.1
Reply With Quote
  #8  
Old 03-10-2005, 11:10 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

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.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:35 AM.

   

 
X-Cart forums © 2001-2020