Jump to content
  • 0

Kalkulator kalorii


Angrywolfstudio

Question

Witam. 

Mam pytanie i zarazem problem. Chcę wgrać na stronę kalkulator kalorii który znalazłem w internecie , oczywiście zapytanie o prawa autorskie już poszło i czekam na odpowiedz.

Dokładnie to opisując chodzi o to iż kiedy dodaję ten kod do utworzonej strony w pliku kalkulator.tpl,wyskakuje mi w trybie debugowania następujący błąd :

 

 

SmartyCompilerException in smarty_internal_templatecompilerbase.php line 24:
Syntax error in template "/profiles/c/cr/cri/crisbandit/dontcook.cz/themes/childtheme-example/templates/cms/kalkulator.tpl" on line 63 "<p>Your <a href="https://en.wikipedia.org/wiki/Basal_metabolic_rate" target="_blank">BMR</a> = [spam-filter]bmr () | number:0[spam-filter]</p>" unknown function "bmr"
in smarty_internal_templatecompilerbase.php line 24
at Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown function "bmr"') in smarty_internal_templateparser.php line 4155
at Smarty_Internal_Templateparser->yy_r154() in smarty_internal_templateparser.php line 4392
at Smarty_Internal_Templateparser->yy_reduce('154') in smarty_internal_templateparser.php line 4493
at Smarty_Internal_Templateparser->doParse('30', ' ') in smarty_internal_smartytemplatecompiler.php line 118
at Smarty_Internal_SmartyTemplateCompiler->doCompile('{private_child_block name='content' file='/profiles/c/cr/cri/crisbandit/dontcook.cz/themes/childtheme-example/templates/page.tpl' type='file' resource='cms/kalkulator.tpl' uid='b9d5612df39f802dece1fc09c184d7c4e4af09c0' line=27} <section id="main"> {private_child_block name='page_header_container' file='/profiles/c/cr/cri/crisbandit/dontcook.cz/themes/childtheme-example/templates/page.tpl' type='file' resource='cms/kalkulator.tpl' uid='b9d5612df39f802dece1fc09c184d7c4e4af09c0' line=31} {/private_child_block} {private_child_block name='page_content_container' file='/profiles/c/cr/cri/crisbandit/dontcook.cz/themes/childtheme-example/templates/cms/kalkulator.tpl' type='file' resource='cms/kalkulator.tpl' uid='0ad1cb0127a1e290015e8a14b8f7dc789576b3ac' line=48} <p id="explanation">Just something that I've found useful when training and the sites I've seen just don't quite hit the mark for me.</p> <div id="title"> <h3>Angular Calorie Calculator</h3> <p>Using the <a href="https://en.wikipedia.org/wiki/Harris%E2%80%93Benedict_equation" target="_blank">Harris–Benedict equation</a> as revised by Mifflin and St Jeor in 1990</p> </div> <div id="maincontainer" ng-app="app" ng-controller="mainController"> <div id="calulatorContainer"> <div id="resultsSection"> <h3>Results (in kJ)</h3> <div id="results"> <p>Your <a href="https://en.wikipedia.org/wiki/Basal_metabolic_rate" target="_blank">BMR</a> = [spam-filter]bmr () | number:0[spam-filter]</p> <p>Required daily cals = [spam-filter]cals () | number:0 [spam-filter] </p> <p>Daily Protein cals = [spam-filter]proteinCals () | number:0[spam-filter] </p> <p>Daily Carbs cals = [spam-filter]carbsCals ()| number:0[spam-filter]</p> <p>Daily Fat cals = [spam-filter]fatCals ()| number:0[spam-filter]</p> </div> <!--closing div for results--> </div> <!--closing div for results section--> <div class="form-group"> <div class="form"> <input type="number" class="form-control" placeholder="Weight in Kgs" ng-model="weight"> </div> <div class="form"> <input type="number" class="form-control" placeholder="Age" ng-model="age"> </div> <div class="form"> <input type="number" class="form-control" placeholder="Height in cm" ng-model="height"> </div> <div id="activity"> <!--the as in ng-options selects the current value in the dropdown and allows it to be stored in ng-model--> <select class="form-control" ng-options="x as x.name for x in activities" ng-model="selectedActivity"> <option value="">Select activity level...</option> </select> </div> <!--closing div for activity dropdown--> <div id="goal"> <select class="form-control" ng-options="x as x.name for x in goals" ng-model="selectedGoal"> <option value="">Select your goal...</option> </select> </div> <!--closing div for goal--> <div id="gender"> <label class="radio-inline"><input type="radio" name="optradio" ng-model="gender" value="male">Male</label> <label class="radio-inline"><input type="radio" name="optradio" ng-model="gender" value="female">Female</label> </div> <!--closing div for radio gender--> </div> </div> <!--closing div for calculator container--> <div id="mealContainer"> <h3>Meal Plan (in grams)</h3> <p id="explainMeals">Follow Monday to Friday, just don't take the mick at the weekends and gorge on chocolate etc <i class="fa fa-smile-o" aria-hidden="true"></i> unless you want to lose weight, then follow religiously!</p> <div class="meal"><h5>Breakfast</h5> <p>Protein: [spam-filter]breakfast[0].value() |number:0[spam-filter]</p> <p>Carbs: [spam-filter]breakfast[1].value()|number:0[spam-filter]</p> <p>Fat: [spam-filter]breakfast[2].value()|number:0[spam-filter]</p> </div> <div class="meal"><h5>Snack</h5> <p>Protein: [spam-filter]snack[0].value()|number:0[spam-filter]</p> <p>Carbs: [spam-filter]snack[1].value()|number:0[spam-filter]</p> <p>Fat: [spam-filter]snack[2].value()|number:0[spam-filter]</p> </div> <div class="meal"><h5>Lunch</h5> <p>Protein: [spam-filter]mainMeal[0].value()|number:0[spam-filter]</p> <p>Carbs: [spam-filter]mainMeal[1].value()|number:0[spam-filter]</p> <p>Fat: [spam-filter]mainMeal[2].value()|number:0[spam-filter]</p> </div> <div class="meal"><h5>Snack</h5> <p>Protein: [spam-filter]snack[0].value()|number:0[spam-filter]</p> <p>Carbs: [spam-filter]snack[1].value()|number:0[spam-filter]</p> <p>Fat: [spam-filter]snack[2].value()|number:0[spam-filter]</p> </div> <div class="meal"><h5>Snack</h5> <p>Protein: [spam-filter]snack[0].value()|number:0[spam-filter]</p> <p>Carbs: [spam-filter]snack[1].value()|number:0[spam-filter]</p> <p>Fat: [spam-filter]snack[2].value()|number:0[spam-filter]</p> </div> <div class="meal"><h5>Dinner</h5> <p>Protein: [spam-filter]mainMeal[0].value()|number:0[spam-filter]</p> <p>Carbs: [spam-filter]mainMeal[1].value()|number:0[spam-filter]</p> <p>Fat: [spam-filter]mainMeal[2].value()|number:0[spam-filter]</p> </div> <div><p>incorprate meal suggestions somewhere around here?</p></div> </div> <!--closing div for meal container--> <div id="exerciseContainer"> some sort of exercise plan? </div> <!--closing div for exercise container--> </div> <!--closing div for main container--> <div id="footer"> <p>do something with footer, not required but still do something</p> </div> <script src="/js/kcal.js"></script> {/private_child_block} {private_child_block name='page_footer_container' file='/profiles/c/cr/cri/crisbandit/dontcook.cz/themes/childtheme-example/templates/page.tpl' type='file' resource='cms/kalkulator.tpl' uid='b9d5612df39f802dece1fc09c184d7c4e4af09c0' line=48} <footer class="page-footer"> {private_child_block name='page_footer' file='/profiles/c/cr/cri/crisbandit/dontcook.cz/themes/childtheme-example/templates/page.tpl' type='file' resource='cms/kalkulator.tpl' uid='b9d5612df39f802dece1fc09c184d7c4e4af09c0' line=50} <!-- Footer content --> {/private_child_block} </footer> {/private_child_block} </section> {/private_child_block}') in smarty_internal_templatecompilerbase.php line 283
at Smarty_Internal_TemplateCompilerBase->compileTemplate(object(Smarty_Internal_Template), false) in smarty_internal_compile_block.php line 179
at Smarty_Internal_Compile_Block::compileChildBlock(object(Smarty_Internal_SmartyTemplateCompiler), 'content') in smarty_internal_compile_block.php line 326
at Smarty_Internal_Compile_Blockclose->compile(array(), object(Smarty_Internal_SmartyTemplateCompiler), array(), null, null) in smarty_internal_templatecompilerbase.php line 580
at Smarty_Internal_TemplateCompilerBase->callTagCompiler('blockclose', array(), array()) in smarty_internal_templatecompilerbase.php line 349
at Smarty_Internal_TemplateCompilerBase->compileTag('blockclose', array()) in smarty_internal_templateparser.php line 3684
at Smarty_Internal_Templateparser->yy_r59() in smarty_internal_templateparser.php line 4392
at Smarty_Internal_Templateparser->yy_reduce('59') in smarty_internal_templateparser.php line 4493
at Smarty_Internal_Templateparser->doParse('3', '}') in smarty_internal_smartytemplatecompiler.php line 118
at Smarty_Internal_SmartyTemplateCompiler->doCompile('{** * 2007-2017 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License 3.0 (AFL-3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/AFL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <contact@prestashop.com> * @copyright 2007-2017 PrestaShop SA * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * International Registered Trademark & Property of PrestaShop SA *} <!doctype html> <html lang="{$language.iso_code}"> <head> {block name='head'} {include file='_partials/head.tpl'} {/block} </head> <body id="{$page.page_name}" class="{$page.body_classes|classnames}"> {block name='hook_after_body_opening_tag'} {hook h='displayAfterBodyOpeningTag'} {/block} <main> {block name='product_activation'} {include file='catalog/_partials/product-activation.tpl'} {/block} <header id="header"> {block name='header'} {include file='_partials/header.tpl'} {/block} </header> {block name='notifications'} {include file='_partials/notifications.tpl'} {/block} <section id="wrapper"> {hook h="displayWrapperTop"} <div class="container"> {block name='breadcrumb'} {include file='_partials/breadcrumb.tpl'} {/block} {block name="left_column"} <div id="left-column" class="col-xs-12 col-sm-4 col-md-3"> {if $page.page_name == 'product'} {hook h='displayLeftColumnProduct'} {else} {hook h="displayLeftColumn"} {/if} </div> {/block} {block name="content_wrapper"} <div id="content-wrapper" class="left-column right-column col-sm-4 col-md-6"> {hook h="displayContentWrapperTop"} {block name="content"} <p>Hello world! This is HTML5 Boilerplate.</p> {/block} {hook h="displayContentWrapperBottom"} </div> {/block} {block name="right_column"} <div id="right-column" class="col-xs-12 col-sm-4 col-md-3"> {if $page.page_name == 'product'} {hook h='displayRightColumnProduct'} {else} {hook h="displayRightColumn"} {/if} </div> {/block} </div> {hook h="displayWrapperBottom"} </section> <footer id="footer"> {block name="footer"} {include file="_partials/footer.tpl"} {/block} </footer> </main> {block name='javascript_bottom'} {include file="_partials/javascript.tpl" javascript=$javascript.bottom} {/block} {block name='hook_before_body_closing_tag'} {hook h='displayBeforeBodyClosingTag'} {/block} </body> </html> ') in smarty_internal_templatecompilerbase.php line 283
at Smarty_Internal_TemplateCompilerBase->compileTemplate(object(Smarty_Dev_Template)) in smarty_internal_template.php line 197
at Smarty_Internal_Template->compileTemplateSource() in smarty_internal_templatebase.php line 155
at Smarty_Internal_TemplateBase->fetch('cms/kalkulator.tpl', null, 'layouts/layout-full-width.tpl', null, false, true, false) in SmartyDev.php line 41
at SmartyDev->fetch('cms/kalkulator.tpl', null, 'layouts/layout-full-width.tpl') in FrontController.php line 671
at FrontControllerCore->smartyOutputContent('cms/kalkulator.tpl') in FrontController.php line 655
at FrontControllerCore->display() in Controller.php line 225
at ControllerCore->run() in Dispatcher.php line 379
at DispatcherCore->dispatch() in index.php line 28

 

To kod który chciał bym wstawić. Jest on oczywiście bezpośrednio wstawiony z CODEPEN i po otrzymaniu odpowiedzi chce go przerobić , ale już na samym początku mam problem

{**
 * 2007-2017 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2017 PrestaShop SA
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *}




{extends file='page.tpl'}



{block name='page_content_container'}
 
<p id="explanation">Just something that I've found useful when training and the sites I've seen just don't quite hit the mark for me.</p>

<div id="title">
  <h3>Angular Calorie Calculator</h3>
  <p>Using the <a href="https://en.wikipedia.org/wiki/Harris%E2%80%93Benedict_equation" target="_blank">Harris–Benedict equation</a> as revised by Mifflin and St Jeor in 1990</p>
</div>

<div id="maincontainer" ng-app="app" ng-controller="mainController">  
  
  <div id="calulatorContainer">
    <div id="resultsSection">
      <h3>Results (in kJ)</h3>
      <div id="results">
        <p>Your <a href="https://en.wikipedia.org/wiki/Basal_metabolic_rate" target="_blank">BMR</a> = [spam-filter]bmr () | number:0[spam-filter]</p>
        <p>Required daily cals = [spam-filter]cals () | number:0 [spam-filter] </p>
        <p>Daily Protein cals = [spam-filter]proteinCals () | number:0[spam-filter] </p>
        <p>Daily Carbs cals = [spam-filter]carbsCals ()| number:0[spam-filter]</p>
        <p>Daily Fat cals = [spam-filter]fatCals ()| number:0[spam-filter]</p>
      </div>
      <!--closing div for results-->
    </div>
    <!--closing div for results section-->
      <div class="form-group">
      <div class="form">
        <input type="number" class="form-control" placeholder="Weight in Kgs" ng-model="weight">
      </div>
      <div class="form">
        <input type="number" class="form-control" placeholder="Age" ng-model="age">
      </div>
      <div class="form">
        <input type="number" class="form-control" placeholder="Height in cm" ng-model="height">
      </div>
      <div id="activity">
        <!--the as in ng-options selects the current value in the dropdown and allows it to be stored in ng-model-->
        <select class="form-control" ng-options="x as x.name for x in activities" ng-model="selectedActivity">
          <option value="">Select activity level...</option>
        </select>
      </div>
      <!--closing div for activity dropdown-->
      <div id="goal">
        <select class="form-control" ng-options="x as x.name for x in goals" ng-model="selectedGoal">
          <option value="">Select your goal...</option>
        </select>
      </div>
      <!--closing div for goal-->
      <div id="gender">
        <label class="radio-inline"><input type="radio" name="optradio" ng-model="gender" value="male">Male</label>
        <label class="radio-inline"><input type="radio" name="optradio" ng-model="gender" value="female">Female</label>
      </div>
      <!--closing div for radio gender-->
    </div>
  </div>
  <!--closing div for calculator container-->
  
  <div id="mealContainer">
    <h3>Meal Plan (in grams)</h3>
    <p id="explainMeals">Follow Monday to Friday, just don't take the mick at the weekends and gorge on chocolate etc <i class="fa fa-smile-o" aria-hidden="true"></i> unless you want to lose weight, then follow religiously!</p>
    <div class="meal"><h5>Breakfast</h5>
        <p>Protein: [spam-filter]breakfast[0].value() |number:0[spam-filter]</p>
        <p>Carbs: [spam-filter]breakfast[1].value()|number:0[spam-filter]</p>
        <p>Fat: [spam-filter]breakfast[2].value()|number:0[spam-filter]</p>
      </div>
    <div class="meal"><h5>Snack</h5> 
          <p>Protein: [spam-filter]snack[0].value()|number:0[spam-filter]</p>
        <p>Carbs: [spam-filter]snack[1].value()|number:0[spam-filter]</p>
        <p>Fat: [spam-filter]snack[2].value()|number:0[spam-filter]</p>
      </div>
    <div class="meal"><h5>Lunch</h5>
        <p>Protein: [spam-filter]mainMeal[0].value()|number:0[spam-filter]</p>
        <p>Carbs: [spam-filter]mainMeal[1].value()|number:0[spam-filter]</p>
        <p>Fat: [spam-filter]mainMeal[2].value()|number:0[spam-filter]</p>
      </div>
    <div class="meal"><h5>Snack</h5>
        <p>Protein: [spam-filter]snack[0].value()|number:0[spam-filter]</p>
        <p>Carbs: [spam-filter]snack[1].value()|number:0[spam-filter]</p>
        <p>Fat: [spam-filter]snack[2].value()|number:0[spam-filter]</p>
    </div>
    <div class="meal"><h5>Snack</h5>
        <p>Protein: [spam-filter]snack[0].value()|number:0[spam-filter]</p>
        <p>Carbs: [spam-filter]snack[1].value()|number:0[spam-filter]</p>
        <p>Fat: [spam-filter]snack[2].value()|number:0[spam-filter]</p>
    </div>
    <div class="meal"><h5>Dinner</h5> 
      <p>Protein: [spam-filter]mainMeal[0].value()|number:0[spam-filter]</p>
      <p>Carbs: [spam-filter]mainMeal[1].value()|number:0[spam-filter]</p>
      <p>Fat: [spam-filter]mainMeal[2].value()|number:0[spam-filter]</p>
    </div>
    <div><p>incorprate meal suggestions somewhere around here?</p></div>
  </div>
  <!--closing div for meal container-->
  
  <div id="exerciseContainer">
    some sort of exercise plan?
  </div>
  <!--closing div for exercise container-->
  </div>
<!--closing div for main container-->

<div id="footer">
  <p>do something with footer, not required but still do something</p>
</div>
<script src="/js/kcal.js"></script>

{/block}

 

Dodam iż jestem początkującym i chciał bym zrozumieć co robię źle. Wydaje mi się że wina leży po stronie kodu kalkulatora kalorii.

Pozdrawiam

Edited by Angrywolfstudio (see edit history)
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...