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

Data passing between template and PHP file

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 12-19-2008, 10:15 AM
 
AMMoyer AMMoyer is offline
 

Senior Member
  
Join Date: Nov 2008
Posts: 150
 

Default Re: Data passing between template and PHP file

I've tried the suggestions and it still responds the same. These are the two versions of the line I tried in the PHP file:

$smarty->assign ("main", "newname");
and
$smarty->assign ("main", $newname);

but neither seemed to do the trick. I also added the elseif statement to the file mentioned. Could there be another file that I need to use the elseif statement in or is this the only one?

Thanks again.
Adam
__________________
Adam
X-Cart Gold 4.4.5 - Live
X-Cart Gold 4.1.11 - Retired
X-Payments 1.0.4
CDSEO Pro
EWD Hosting
Reply With Quote
  #12  
Old 12-19-2008, 10:35 AM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Default Re: Data passing between template and PHP file

What you added in the common_templetes.tpl .Can you post it here.So i can able to identify where the problem is.
Quote:
Originally Posted by AMMoyer
I've tried the suggestions and it still responds the same. These are the two versions of the line I tried in the PHP file:

$smarty->assign ("main", "newname");
and
$smarty->assign ("main", $newname);

but neither seemed to do the trick. I also added the elseif statement to the file mentioned. Could there be another file that I need to use the elseif statement in or is this the only one?

Thanks again.
Adam
Reply With Quote
  #13  
Old 12-19-2008, 10:46 AM
 
AMMoyer AMMoyer is offline
 

Senior Member
  
Join Date: Nov 2008
Posts: 150
 

Default Re: Data passing between template and PHP file

Here's what I added to common_templates.tpl:

Code:
{* $Id: common_templates.tpl,v 1.46.2.7 2007/03/28 12:48:59 twice Exp $ *} {if $main eq "last_admin"} {include file="main/error_last_admin.tpl"} {elseif $main eq "iesearch"} {include file="mmy.tpl"} {elseif $main eq "product_disabled"} {include file="main/error_product_disabled.tpl"} ........

And the line I currently have in my PHP file is

$smarty->assign("main", $iesearch);

My tpl file is in the skin1 folder while the php file is in the root xcart folder. Is this the issue? I really do appreciate the help

Adam
__________________
Adam
X-Cart Gold 4.4.5 - Live
X-Cart Gold 4.1.11 - Retired
X-Payments 1.0.4
CDSEO Pro
EWD Hosting
Reply With Quote
  #14  
Old 12-19-2008, 10:50 AM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Default Re: Data passing between template and PHP file

Add this instead of yours in the php file.
$smarty->assign("main", "iesearch");
This line is used to say, what tpl need to be used for this particular php file.
check it now.

Quote:
Originally Posted by AMMoyer
Here's what I added to common_templates.tpl:

Code:
{* $Id: common_templates.tpl,v 1.46.2.7 2007/03/28 12:48:59 twice Exp $ *} {if $main eq "last_admin"} {include file="main/error_last_admin.tpl"} {elseif $main eq "iesearch"} {include file="mmy.tpl"} {elseif $main eq "product_disabled"} {include file="main/error_product_disabled.tpl"} ........

And the line I currently have in my PHP file is

$smarty->assign("main", $iesearch);

My tpl file is in the skin1 folder while the php file is in the root xcart folder. Is this the issue? I really do appreciate the help

Adam
Reply With Quote
  #15  
Old 12-19-2008, 12:20 PM
 
AMMoyer AMMoyer is offline
 

Senior Member
  
Join Date: Nov 2008
Posts: 150
 

Default Re: Data passing between template and PHP file

This is the php file as it is now. The page still goes white and stays at ...xcart/mmy.php Is there some sort of conflict between the two $smarty->assign statements at the end? I am trying to pass the array from $rowMake into smarty and the back to mmy.tpl Thanks again.

Adam

Code:
<?php require "./auth.php"; $year = $_POST['year2']; ///////////////////////////////////////////////// make query for dropdown $query = sprintf("SELECT DISTINCT makeid, makename FROM iemmy WHERE yearid='$year'"); $result = @mysql_query($query); $rowMake = mysql_fetch_array($result); ///////////////////////////////////////////////// //do { //echo $rowMake['makeid']; //echo $rowMake['makename']."<br>"; //}while ($rowMake = mysql_fetch_array($result)); if (mysql_num_rows ($result) >= 1) { $makeid = array(); while ($rows = mysql_fetch_array ($result, MYSQL_ASSOC)) array_push ($makeid, $rows); $smarty->assign("makeid", $makeid); } $smarty->assign("main", "iesearch"); ?>
__________________
Adam
X-Cart Gold 4.4.5 - Live
X-Cart Gold 4.1.11 - Retired
X-Payments 1.0.4
CDSEO Pro
EWD Hosting
Reply With Quote
  #16  
Old 12-19-2008, 07:54 PM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Default Re: Data passing between template and PHP file

Hi ,
I forgot to tell you one thing .
Add this two lines at the end of the mmy.php page (before the closing php tags.)
$smarty->assign("location", $location);
func_display("customer/home.tpl",$smarty);

Quote:
Originally Posted by AMMoyer
This is the php file as it is now. The page still goes white and stays at ...xcart/mmy.php Is there some sort of conflict between the two $smarty->assign statements at the end? I am trying to pass the array from $rowMake into smarty and the back to mmy.tpl Thanks again.

Adam

Code:
<?php require "./auth.php"; $year = $_POST['year2']; ///////////////////////////////////////////////// make query for dropdown $query = sprintf("SELECT DISTINCT makeid, makename FROM iemmy WHERE yearid='$year'"); $result = @mysql_query($query); $rowMake = mysql_fetch_array($result); ///////////////////////////////////////////////// //do { //echo $rowMake['makeid']; //echo $rowMake['makename']."<br>"; //}while ($rowMake = mysql_fetch_array($result)); if (mysql_num_rows ($result) >= 1) { $makeid = array(); while ($rows = mysql_fetch_array ($result, MYSQL_ASSOC)) array_push ($makeid, $rows); $smarty->assign("makeid", $makeid); } $smarty->assign("main", "iesearch"); ?>
Reply With Quote
  #17  
Old 12-22-2008, 01:52 PM
 
AMMoyer AMMoyer is offline
 

Senior Member
  
Join Date: Nov 2008
Posts: 150
 

Default Re: Data passing between template and PHP file

Ok, now I get back to the initial page, sort of. I end up at mmy.php when I'd like to be back at home.php but I'm not too concerned with this at this time. I'm not getting the data from query back to my second dropdown box. Not sure what I've done. The query does work, I can echo it back out in the php file, just can't get the transfer complete.

tpl:
Code:
{* $Id: mmy.tpl,v 1.0.0.0 2008/12/12 07:58:28 amm Exp $ *} {capture name=menu} <form method="post" action="mmy.php" name="mmysearchform"> <select name="year2" style="width: 80%;"onchange="javascript:document.mmysearchform.submit ();"> <option value="" selected="selected">Select Year</option> <option value="2009">2009 <option value="2008">2008 <option value="2007">2007 <option value="2006">2006 <option value="2005">2005 <option value="2004">2004 </select><br> <select name="make" style="width: 80%;"onchange="javascript:document.mmysearchform.submit ();"> <option value"" selected="selected">Select Make</option> {foreach item=row from=$row} <option value="{$row.makeid}">{$row.makename}</option> {/foreach} </select><br> <select name="model" style="width: 80%;"onchange="javascript:document.mmysearchform.submit ();"> <option value="" selected="selected">Select Model</option> </select> </form> <font class="CategoriesList"><a href="home.php?cat=" class="VertMenuItems"></a></font><br /> <font class="CategoriesList"><a href="home.php?cat=" class="VertMenuItems"></a></font><br /> {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_mmy_search menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}

php:
Code:
<?php require "./auth.php"; $year = $_POST['year2']; ///////////////////////////////////////////////// make query for dropdown $query = sprintf("SELECT DISTINCT makeid, makename FROM iemmy WHERE yearid='$year'"); $result = @mysql_query($query); $rowMake = mysql_fetch_array($result); ///////////////////////////////////////////////// //do { //echo $rowMake['makeid']; //echo $rowMake['makename']."<br>"; //}while ($rowMake = mysql_fetch_array($result)); if (mysql_num_rows ($result) >= 1) { $makeid = array(); while ($rows = mysql_fetch_array ($result, MYSQL_ASSOC)) array_push ($makeid, $rows); $smarty->assign("makeid", $makeid); } $smarty->assign("main", "iesearch"); $smarty->assign("location", $location); func_display("customer/home.tpl",$smarty); ?>

Thanks again for the help.

Adam
__________________
Adam
X-Cart Gold 4.4.5 - Live
X-Cart Gold 4.1.11 - Retired
X-Payments 1.0.4
CDSEO Pro
EWD Hosting
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 01:18 PM.

   

 
X-Cart forums © 2001-2020