Jump to content

How to add php code to stores.tpl


PurpleEdge

Recommended Posts

I want to POST some data to the stores.tpl page by using a form on the home page of a site. So users can enter a post code (zip code) in a form on the home page, click a submit button and it will open the stores page with the search value pre-filled and then execute the search.

 

I want to add some code such as this...

 

$postcodeToSearch='';

if (isset($_POST['passedPostcode'])) {

$postcodeToSearch = $_POST['passedPostcode'];

}

?>

<script type="text/javascript" src="demo1.js"></script>

<script language='javascript'>

window.onload=initForm(document.forms[0], 'addressInput', '<?php echo $passedPostcode; ?>');

</script>

Can someone give me a clue how to add php to the stores.tpl?

Link to comment
Share on other sites

Best way to do this would be with a module.

 

I am sorry it's not much of help but FYI

 

For You PHP

 

http://www.smarty.ne...include.php.tpl

 

{include_php file='/path/to/load_nav.php'}

 

 

For You JavaScript

 

http://www.smarty.net/docsv2/en/language.function.literal.tpl

 

{literal}
<script type="text/javascript">
<!--
 function isblank(field) {
   if (field.value == '')
  { return false; }
   else
  {
  document.loginform.submit();
  return true;
   }
 }
// -->
</script>
{/literal}

Edited by HA!*!*Y (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...