1) { print ''; print '
'; } $theserecipes=array(); $totsize=0; while ($recipedata=data_fetch_array($reciperes,__FILE__,__LINE__)) { $linelen=55; if ($cnt>($page*$no_per_page)){ } elseif ($cnt<=(($page-1)*$no_per_page)){ } else { $lines=1; $text = explode('
',nl2br($recipedata['text'])); foreach($text as $textbit){ $textbit=trim($textbit); if (strlen($textbit) < $linelen ){ $lines++; } else { $lines+=(ceil(strlen($textbit)/$linelen)); } } $theserecipes[]=array('recipe'=>$recipedata,'cnt'=>$cnt,'lines'=>$lines); $totsize+=$lines; } $cnt++; } $splitsize=0; $split=FALSE; $splpos=floor(($totsize/2)-(($totsize/$no_per_page)*.6)); print '
'; print '
'; foreach ($theserecipes as $thisrecipe){ one_recipe($thisrecipe['recipe'],$myRecipes); $splitsize+=$thisrecipe['lines']; print '
'; if (($splitsize>$splpos)&&($split==FALSE)) { print '
'; print '
'; $split=TRUE; } } print '
'; print "
"; print '
'; print "
"; } function one_recipe($recipedata,$myRecipes) { if (in_array($recipedata['recipe_number'],$myRecipes)){ $mine=TRUE; } else { $mine=FALSE; } print '
'; print '
'.$recipedata['name'].'
'; print '
'.nl2br($recipedata['text']).'
'; print ''; print '
'; } function show_tabs($catres,$this_cat,$page,$path,$query) { print '
'; } $cat_type=$catdata['cat_type']; print '
  • '.$cat_type.'
  • '; print '
  • My Recipes
  • '; //print '
  • Print View
  • '; print '
    '; } data_connect("",__FILE__,__LINE__); $path=''; $query=''; $doccall = $_SERVER['REQUEST_URI']; if (array_key_exists('ix',$_REQUEST)){ $ix = $_REQUEST['ix']; } else { $ix = ''; } if (array_key_exists('stext',$_REQUEST)){ $stext = stripslashes($_REQUEST['stext']); } else { $stext = ''; } if (array_key_exists('scat',$_REQUEST)){ $scat = stripslashes($_REQUEST['scat']); } else { $scat = ''; } if (array_key_exists('ingredient',$_REQUEST)){ $ingredient = stripslashes($_REQUEST['ingredient']); } else { $ingredient = '--'; } if (array_key_exists('page',$_REQUEST)){ $page = stripslashes($_REQUEST['page']); } else { $page = 1; } if (array_key_exists('prenzelRecipes',$_REQUEST)){ $myRecipes = split(',',$_REQUEST['prenzelRecipes']); } else { $myRecipes=array(); } $path_arr=explode("?",$doccall); $doccall=$path_arr[0]; $path_arr=explode("/",$doccall); $page_type="index"; if (count($path_arr) > 2) { $orig_cat =$path_arr["2"]; $this_cat=str_replace("_"," ",(strtolower($path_arr["2"]))); if ($this_cat=='mine') { $page_type="mine"; $this_cat='none'; } else { $catsql = 'select * from category where lcase(category) = "'.$this_cat.'"'; $catres = data_query($catsql,__FILE__,__LINE__); if (!($catdata=data_fetch_array($catres,__FILE__,__LINE__))) { $this_cat="none"; } else { $this_cat= $catdata["category"]." "; $page_type="category"; } } } else { $this_cat="none"; } if (($ingredient!="--")||($stext!="")) { $page_type="search"; if ($scat!=""){$this_cat=strtolower($scat);} } $ingname = ""; $ingsql = "select * from ingredient order by displayname"; $ingres = data_query($ingsql,__FILE__,__LINE__); $ingsel = ''; $pagetype="recipe"; ?> Prenzel Recipes
    Search For Ingredient '; print $ingsel; print ' or Text '; print ''; if (($this_cat!="")&&($this_cat!="none")) { print ''; print 'in '.$this_cat.''; } print ' '; print '
    '; $catsql = "select * from category order by cat_type,category"; $catres = data_query($catsql,__FILE__,__LINE__); if (isset($ingredient)) { if ($ingredient=="--") { unset($ingredient); } } print '
    '; switch($page_type) { case "index"; print "

    Index

    "; show_tabs($catres,$this_cat,'','',''); print '
    '; print '
    '; print '

    Lucky Dip Recipe

    '; $recipesql = 'select * from recipe order by rand()'; $reciperes = data_query($recipesql,__FILE__,__LINE__); $recipedata=data_fetch_array($reciperes,__FILE__,__LINE__); one_recipe($recipedata,$myRecipes); print '
    '; print '
    '; print '
    '; print <<These recipes are provided to help stimulate your imagination in using Prenzel products.

    Browse through the categories or search for a recipe using specific ingredients.

    My Recipes

    You may click the link at the bottom of each recipe to add it to you own stored recipebox.

    You will need to be able to accept cookies from our site to use this. Your recipe list will be stored in a cookie on your computer for 6 months.

    Printing

    This site is printer-friendly. Print these pages and you'll get just the recipes. Use "My Recipes" and greate your own prenzel recipe collection. eot; /* The "Print view" link on each page opens just the recipe page you are currently viewing in a window by itself. This page is "Printer-friendly". Use this in conjunction with "My Recipes" to greate your own prenzel recipe collection. eot; */ print "
    "; print "
    "; break; case "search"; $recipesql = 'select * from recipe '; $and=" where "; if (isset($ingredient)) { $recipesql .= $and.' (name like "%'.$ingredient.'%" '; $recipesql .= ' or text like "%'.$ingredient.'%") '; $and=" and "; } if ($stext!="") { $recipesql .= $and.' (name like "%'.addslashes($stext).'%" '; $recipesql .= ' or text like "%'.addslashes($stext).'%") '; $and=" and "; } if ($scat!="") { $recipesql .= $and.' (category = "'.$scat.'") '; } $recipesql .= 'order by name'; $reciperes = data_query($recipesql,__FILE__,__LINE__); print '

    '; if ($scat!='') { print $scat; } else { print 'Recipes'; } if (isset($ingredient)) { print ' containing '.$ingname; } print "

    "; if ($stext!="") { print '

    '; print 'Matching '.$stext.'

    '; } show_tabs($catres,$this_cat,$page,$path,$query); break; case "category"; $recipesql='select * from recipe where category="'.$this_cat.'" order by name'; $reciperes = data_query($recipesql,__FILE__,__LINE__); print '

    '.$this_cat."

    "; show_tabs($catres,$this_cat,$page,$path,$query); break; case "mine"; $sellist = join(' or recipe_number=',$myRecipes); if ($sellist!='') { $sellist = 'where recipe_number='.$sellist; } $recipesql='select * from recipe '.$sellist.' order by name'; $reciperes = data_query($recipesql,__FILE__,__LINE__); print '

    My Recipe Box

    '; show_tabs($catres,$this_cat,$page,$path,$query); break; } if (($page_type=="search")||($page_type=="category")||($page_type=="mine")) { if (mysql_num_rows($reciperes)==0) { print "Sorry no recipes found"; } else { if (($page_type=="mine")) { if (count($myRecipes)==0){ print "Sorry no recipes found"; } else { display_recipes($reciperes,$page,$path,$query,$myRecipes); } } else { if (isset($this_cat)){ $path='./'.str_replace(' ','_',trim(strtolower($this_cat))); } else { $path='./recipes'; } $query=''; if ($page_type=="search"){ if (!isset($ingredient)) {$ingredient='';}; $query = '?ingredient='.$ingredient; $query .= '&stext='.$stext; $query .= '&scat='.$scat; } display_recipes($reciperes,$page,$path,$query,$myRecipes); } } } ?>