I have created the file "query_parse.php" in the customer directory. Inside that file is the following:
Code:
<?PHP
$arg_value = explode("=", $_SERVER['QUERY_STRING']);
$smarty = new Smarty;
$smarty->assign("argval", $arg_value[1]); // value of the URL argument
?>
I am trying to display certain tabs at the top of my site by using the category of the product being displayed using the following code in head.tpl:
Code:
{ include_php file="../customer/query_parse.php" }
{ if $argval eq "" }
{ include file="topnavtabs/top_nav_tabs_01.tpl" }
{ elseif $argval eq "3" }
{ include file="topnavtabs/top_nav_tabs_02.tpl" }
{/if}
Every time I now try to load my site I always receive the error "Fatal error: Call to a member function on a non-object in query_parse.php on line 3".
The variable churns out the correct number each time if I remove the "smarty->assign" line and replace that with a "print($arg_value)", so I know that I am getting the information I need. I just can't get it into the template I am using.
I have going over and over documentation of PHP and Smarty for the last 4 hours and am at my wits end to explain why I can't pass this variable. I am new to both PHP and Smarty so please bare with me.
Thanks,
Joshua
NOTE: I moved this post from the board "Program Logic" today, this was originally posted on January 4th.