gpt4 book ai didi

javascript - 如何在 PhalconPHP 2.x 中放置自定义 js 代码?

转载 作者:行者123 更新时间:2023-11-28 06:33:09 27 4
gpt4 key购买 nike

开门见山。我想在包含 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 %}

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

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

最佳答案

使用 block 。您需要使用扩展。

You can see here.

关于javascript - 如何在 PhalconPHP 2.x 中放置自定义 js 代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34520514/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com