如何将自定义 js 代码放入 PhalconPHP 2.x?

How to put custom js code in PhalconPHP 2.x?

开门见山。 我想在包含 jquery.

后将我的 javascript 代码放在页面底部

我有布局:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Phalcon PHP Framework</title>
     {{ assets.outputCss('css-head') }}
</head>
<body>
    <div class="container">
        {{ content() }}
    </div>
    {{ assets.outputJs('js-footer') }}

    {% block footer %}
    {% endblock %}
</body>
</html>

我的观点是行动:

    {{ form('/post/edit/' ~ id, 'method': 'post', 'enctype': 'multipart/form-data') }}
    {{ hidden_field('id') }}
    {{ hidden_field('users_id') }}
    <div class="form-group">
    <label for="post-title">Title</label>
    {{ text_field('title', 'class': 'form-control', 'id': 'post-title', 'placeholder': "Title") }}
  <p class="help-block">Example block-level help text here.</p>
</div>
<div class="form-group">
  <label for="post-content">Content</label>
  {{ text_area('content', 'class': 'form-control' , 'id': 'post-content', 'rows': 3) }}
  <p class="help-block">Example block-level help text here.</p>
</div>
<div class="form-group">
  <label class="">Image Upload</label>
  <div class="">
   <div class="fileinput fileinput-new" data-provides="fileinput">
   <div class="fileinput-new thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;">
      <img src="/img/no-img.png" data-src="img/no-img.png" alt="">
    </div>
    <div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;"></div>
    <div>
      <span class="btn btn-default btn-file">
      <span class="fileinput-new">Select image</span>
      <span class="fileinput-exists">Change</span>
      {{ file_field('poster', 'class': 'file-input') }}
      </span>
      <a href="#" class="btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
    </div>
  </div>
</div>
</div>
<h3>SEO fields</h3>
<div class="form-group">
  <label for="post-title">Slug</label>
  {{ text_field('slug', 'class': 'form-control', 'id': 'post-slug', 'placeholder': "Slug") }}
  <p class="help-block">Example block-level help text here.</p>
</div>
{{ submit_button('Save', 'class': 'btn btn-default') }}
{{ end_form() }}

{% block footer %}
    <script type="text/javascript">
      $( document ).ready(function() {
          console.log( "ready!" );
      });
    </script>
{% endblock %}

但是我的代码插入到页面中间。 我做错了什么以及如何解决?

我尝试使用扩展,但是当我这样做时,页面中的内容重复了。

使用区块。你需要使用 extends.

You can see here.