任何人都可以解释如何我可以构造我的CF 组件/输出页面以动态地使用Bootstrap模态 显示? 下面的代码工作,但我需要模式窗口到 只显示与'cat_ID'有关的输出,在 显示所有或某些结果的时刻,但从未 只与那些与 'cat_ID的特定迭代有关的输出“ 提前感谢...动态输出Bootstrap模式
<!---invoke services.cfc --->
<cfinvoke component="components.services" method="getServices" returnvariable="services">
</cfinvoke>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Bootstrap core CSS -->
<link href="dist/css/bootstrap.css" rel="stylesheet">
<http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Services</title>
</head>
<body>
<div class="container">
<!-- Example thumbnail + text -->
<cfoutput query="services" group="cat_ID" groupcasesensitive="no">
<div class="col-md-3">
<div class="thumbnail">
<img src="images/some.jpg">
<div class="caption">
<h4>#cat_ID#</h4>
<p>#type_en#</p>
<p><button class="btn btn-default" data-
toggle="modal" data-target="###cat_ID#">View Details »</button></p>
</div>
</div>
</div>
</cfoutput>
<!-- Modal -->
<cfoutput query="services">
<div class="modal fade" id="#cat_ID#" tabindex="-1" role="dialog" aria-labelledby="One" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-
dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">#title_en#</h4>
</div>
<cfoutput>
<div class="modal-body">
#company# <br />
#title_en#
#Replace(desc_en, chr(13), '<br>','ALL')#<br />
</div>
</cfoutput>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</cfoutput>
</div>
<!-- Bootstrap core JavaScript
==================================================
-->
<!-- Placed at the end of the document so the pages
load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="dist/js/bootstrap.min.js"></script>
</body>
</html>
的 'services.cfc' 组件:
<cfcomponent displayname="Services" hint="ColdFusion Component for showing services">
<!--- This function retrieves all services from the database --->
<cffunction name="getServices" hint="Gets services from the database" returntype="query">
<cfquery name="services">
SELECT *
FROM dbo.services
ORDER BY cat_ID
</cfquery>
<cfreturn services>
</cffunction>
</cfcomponent>
好吧,我想尽可能多,我试过data-target =“### cat_ID#?cat_ID = 1”......这显然打破了它,但不知道我是否应该采取一种全新的方法。谢谢,会尝试通过cat_ID的数字方法... – Shalinko
@Shalinko你可能想看看这个Q + A http://stackoverflow.com/questions/10626885/passing-data-to-a-bootstrap-modal – Jarede
感谢,对我来说很重要的东西,但期待调整我使用的代码 – Shalinko