[英]Working with div tags and php include
This is probably a basic question on something I didn't learn in my self-taught html. 这可能是我在自学的html中没有学到的一些基本问题。 In my index.html I have a div calling a php file like so: 在我的index.html中,我有一个div像这样调用php文件:
<div id="portafolio" />
<p class="first">Portafolio</p>
<p class="second">Estos son algunos de nuestros proyectos.</p>
<?php include 'portafolio.html'; ?>
<!-end #portafolio ->
</div>
Inside the php file, there is some javascript and more div tags like so: 在php文件中,有一些javascript和更多div标签,例如:
<script type='text/javascript'>
$(document).ready(function(){
$("img.a").hover(
function() {
$(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
$(this).stop().animate({"opacity": "1"}, "slow");
});
});
</script>
<div class="fadehover">
<img src="images/motmotcoffee/motmotcoffee_1BW.jpg" alt="" class="a" />
<img src="images/motmotcoffee/motmotcoffee_1.jpg" alt="" class="b" />
</div>
I expect the printed html from the php file to be included inside which has top and bottom borders defined in the CSS, but it doesn't. 我希望php文件中包含的已打印html包含在其中,并且CSS中定义了顶部和底部边框,但事实并非如此。 What am I doing wrong? 我究竟做错了什么?
Change the extension of your files to .php
, modify your include statement accordingly and that should work. 将文件的扩展名更改为.php
,相应地修改您的include语句,这应该可以工作。 Your server is probably not configured to process .html
files as php files. 您的服务器可能未配置为将.html
文件作为php文件处理。
Update: 更新:
Your <div id="portafolio" />
tag is self-closing, so there won't be anything inside it... Change it to <div id="portafolio">
您的<div id="portafolio" />
标签是自动关闭的,因此其中没有任何内容...将其更改为<div id="portafolio">
For what is may be worth, I am unable to include: 对于可能值得的东西,我无法提供:
[other html markup] [其他html标记]
in an include.php file. 在一个include.php文件中。 The content including and inside of div tags does not get rendered by any browser I test in. 我测试过的任何浏览器都不会呈现div标签中及其内部的内容。
This has just become a problem because I have to copy a fubar navigation array that forces me to use two divs inside of an ul to get the floated li's to arrange themselves. 这只是一个问题,因为我必须复制一个fubar导航数组,该数组迫使我在ul内部使用两个div来使浮动的li自己排列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.