...
Code Block |
---|
title | displaySearchform.cfm |
---|
|
<cfsetting enablecfoutputonly="true" />
<!---
Copyright 2010:
Author: Marco van den Oever
Company: MVDO-WSO
Website: http://www.webserviceonline.biz
Email: marco@webserviceonline.biz
License:
This software is licensed under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
For a copy of the GNU General Public License check the license folder or see <http://www.gnu.org/licenses/>.
Description:
Simple Searchform for dmNews.
Created: 30/05/10
Tested on CF9, FC6.0
--->
<cfimport taglib="/farcry/core/tags/formtools/" prefix="ft" />
<cfimport taglib="/farcry/core/tags/webskin/" prefix="skin" />
<cfoutput>
<!-- Start of Search Form Results -->
<!--- perform action when someone searches --->
<ft:processform action="search">
<ft:processFormObjects typename="searchform">
<!--- get search results --->
<cfset obj = createObject('component','farcry.plugins.cms.packages.types.dmNews') />
<cfset props.whereclause = "objectid=objectid AND title LIKE '%#stproperties.searchfield#%' OR Body LIKE '%#stproperties.searchfield#%' OR Teaser LIKE '%#stproperties.searchfield#%'">
<cfset results = obj.getMultipleByQuery(argumentCollection=props) />
<cfset searchquery = stproperties.searchfield />
</ft:processformobjects>
</ft:processform>
<!-- End of Search Form Results -->
<!-- Start of Search Form -->
<div id="searchform">
<h2>Search</h2>
<ft:form css="style.css">
<ft:object typename="searchform" lFields="searchfield" />
<ft:farcryButtonPanel>
<ft:button value="search" />
<cfif not isdefined('results')>
No Results
</cfif>
<cfif isdefined('results.recordcount')>
<cfif results.recordcount gt 1>
#results.recordcount# Results:<br />
<cfelseif results.recordcount eq 1>
#results.recordcount# Results:<br />
<cfelse>
No Results
</cfif>
<br />
<cfloop query="results">
<skin:buildLink type="dmNews" objectid="#results.objectid#">#results.title#</skin:buildLink>
<br />
</cfloop>
</cfif>
</ft:farcryButtonPanel>
</ft:form>
</div>
<!-- End of Search Form -->
</cfoutput>
<cfsetting enablecfoutputonly="false" />
|
The CSS code
The CSS code is placed in the CSS file of your project or plugin. Note that i used style.css as style name, you might need to change that to your needs. This CSS is just some code i used to change the form layout to my needs, it might be a place to start for you.
Code Block |
---|
|
#searchform {
margin-bottom: 1px;
padding: 5px 5px 15px;
width: 118px;
border-color: #9e9ec3;
border-width: 1px 1px 1px 0px;
border-style: solid;
overflow: hidden;
font-weight: bold;
}
#searchform h2 {
padding-bottom: 10px;
font-size: 10px;
}
#searchform input {
padding-left: 0px;
width: 115px;
height: 16px;
border: #bfbfe6 1px solid;
float: left;
clear: left;
}
#searchform input.button {
margin-top: 3px;
margin-left: 95px;
width: 22px;
height: 13px;
border: none;
}
#searchform #link_cancel {
margin-top: 5px;
}
#searchform .farcryButtonPanel {
margin-bottom: -15px;
}
#searchform .farcryButtonPanel button {
width: 25px;
font: bold 11px/16px arial, helvetica, sans-serif;
padding: -10px;
border: 1px solid #7575A9;
background-color: #9E9EC3;
cursor: pointer;
color: #fff;
margin-left: 89px;
margin-bottom: -10px;
}
#searchform .farcryButtonPanel button:hover {
background: #7575A9;
color: #E1E1E1;
}
#searchform .farcryButtonPanel a:hover {
color: #69699c;
cursor:pointer;
}
#searchform .f-btn-text {
float:left;
margin:0px;
padding:0px;
}
|