Tuesday, 29 May 2012
Ajax-based Auto-completing Search Field for your WordPress Theme
Posted by
Unknown
01:35
Ajax-based
Auto-completing Search Field for your WordPress Theme
When someone will start to type on the search field, we will use Javascript to send a request to a php page which will do the following SQL request SELECT * FROM matable WHERE ‘name’ LIKE ‘$search%’. Via Ajax, we’ll send back the request results to our page, and display it to the visitor.

Your searchform.php file should look like this:
Why not helping your visitors
to find what they’re looking for on your blog, by using a cool auto-completion
on your search field? To do so, we’ll use WordPress tagcloud, php and ajax.
Please note that even if this code is fully functional,
this is an experimentation, and the SQL query isn’t really optimized.
The idea
We will use tags as a list of keyword to suggest to the readers.When someone will start to type on the search field, we will use Javascript to send a request to a php page which will do the following SQL request SELECT * FROM matable WHERE ‘name’ LIKE ‘$search%’. Via Ajax, we’ll send back the request results to our page, and display it to the visitor.
First part: PHP
The first thing to do is to create a php page. This page will send a request to our WP database and display the tags as a html unordered list.<?php
if (isset($_POST['search'])) {
$search = htmlentities($_POST['search']);
} else $search ='';
$db = mysql_connect('localhost','root',''); //Don't forget to change
mysql_select_db('wp', $db); //theses parameters
$sql = "SELECT name from wp_terms WHERE name LIKE '$search%'";
$req = mysql_query($sql) or die();
echo '<ul>';
while ($data = mysql_fetch_array($req))
{
echo '<li><a href="#" onclick="selected(this.innerHTML);">'.htmlentities($data['name']).'</a></li>';
}
echo '</ul>';
mysql_close();
?>
This code is simple: It receive a POST parameter (The letter(s) typed
in the search field by the visitor) and then sends a request to our WP database
in order to gets all tags starting with the letter(s) typed in the search
box.Part two: Ajax
Now it’s time to start the client-side programming. We need to code 4 Javascript functions in order to make our auto-completion work:- Function ajax() will create a XMLHTTPRequest object.
- Function request() will send an Ajax request to our gettags.php file.
- Function return() will return gettags.php contents.
- And the selected() function will update the search field.
var myAjax = ajax();
function ajax() {
var ajax = null;
if (window.XMLHttpRequest) {
try {
ajax = new XMLHttpRequest();
}
catch(e) {}
}
else if (window.ActiveXObject) {
try {
ajax = new ActiveXObject("Msxm12.XMLHTTP");
}
catch (e){
try{
ajax = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
return ajax;
}
function request(str) {
//Don't forget to modify the path according to your theme
myAjax.open("POST", "wp-content/themes/openbook-fr/gettags.php");
myAjax.onreadystatechange = result;
myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
myAjax.send("search="+str);
}
function result() {
if (myAjax.readyState == 4) {
var liste = myAjax.responseText;
var cible = document.getElementById('tag_update').innerHTML = liste;
document.getElementById('tag_update').style.display = "block";
}
}
function selected(choice){
var cible = document.getElementById('s');
cible.value = choice;
document.getElementById('tag_update').style.display = "none";
}
Part three: Editing your theme
Now that we have our php and javascript ready, we can edit the searchform.php file from your WP theme:Your searchform.php file should look like this:
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<div>
<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
We have to add a div, which will display the
received data from the request, as well as a Javascript event on the search
form:<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<div>
<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" onkeyup="request(this.value);"/>
<input type="submit" id="searchsubmit" value="Search" class="button" />
</div>
<div id="tag_update"></div>
</form>
Final part: CSS
Due to the fact that every theme use different color schemes, this is only an example. Anyways, I thought it could be a good start:#tag_update {
display: block;
border-left: 1px solid #373737;
border-right: 1px solid #373737;
border-bottom: 1px solid #373737;
position:absolute;
z-index:1;
}
#tag_update ul {
margin: 0;
padding: 0;
list-style: none;
}
#tag_update li{
display:block;
clear:both;
}
#tag_update a {
width:134px;
display: block;
padding: .2em .3em;
text-decoration: none;
color: #fff;
background-color: #1B1B1C;
text-align: left;
}
#tag_update a:hover{
color: #fff;
background-color: #373737;
background-image: none;
}
That’s all. You now have a very nice auto-completing search form! If you
have any questions, feel free to leave a comment below.Newspaper - THEME-JUNKIE - Wordpress Theme - Free Download (hotfile,filesonic,mediafire)
Posted by
Unknown
01:32
Newspaper - THEME-JUNKIE - Wordpress Theme - Free Download (hotfile,filesonic,mediafire)
Theme featuresAdvanced Theme Control Panel
Auto-sized Thumbnail Management
Text/Image Logo Switcher
Fully Widgetized Sidebars
Advertisement Management
Localization Ready
Analytics/Stat Management
Built-in FeedBurner Support
Threaded Comments
Gravatar Ready
Custom Page Templates
Custom Widgets
Dropdown Menu Navigation
Smooth Tableless design
WordPress 3.2+ Compatible
Cross-Browsers
Demo:
http://adf.ly/94xBM
Download:
http://adf.ly/94xD9
OS X Mountain Lion DP3 Build 12A206j Released
Posted by
Unknown
01:20
Newspaper - THEME-JUNKIE - Wordpress Theme - Free Download (hotfile,filesonic,mediafire)
Theme featuresAdvanced Theme Control Panel
Auto-sized Thumbnail Management
Text/Image Logo Switcher
Fully Widgetized Sidebars
Advertisement Management
Localization Ready
Analytics/Stat Management
Built-in FeedBurner Support
Threaded Comments
Gravatar Ready
Custom Page Templates
Custom Widgets
Dropdown Menu Navigation
Smooth Tableless design
WordPress 3.2+ Compatible
Cross-Browsers
Demo:
http://adf.ly/94xBM
Download:
http://adf.ly/94xD9
Corel PDF Fusion 1.11 Build 2012.04.05 Fileserve
Posted by
Unknown
01:05
Corel PDF Fusion 1.11 Build 2012.04.05 | 279 MB
Corel PDF Fusion is a professional application designed to enable you to open, view, edit PDF files and convert various documents to PDF format. Boost your productivity with Corel PDF Fusion, an all-in-one PDF creator that lets you view files, plus assemble, edit and create PDFs. View more than 100 different file types just by dragging and dropping them into the Welcome Screen. Take pages from multiple files, including documents, spreadsheets and presentations, and combine them into a single PDF to share with anyone. Add new text, bookmarks and comments. Plus, convert files to PDF, XPS and DOC formats with just a click.
Corel PDF Fusion:
View over 100 file types:
· Open over 100 file types—even if you don't have the software used to create the file!
· Open Microsoft Word, Microsoft Excel, Microsoft PowerPoint, Microsoft Project, Adobe Illustrator, Adobe Photoshop, Microsoft Visio and many other file types
· Choose from Page, Assembly or Flick views to work with your document
· Use Flick View to flip through the pages of your document just like you're reading a book
Edit and rearrange content:
· Just select a phrase or sentence and start typing to make changes
· Edit or add text anywhere in a document
· Easily add bookmarks and comments
· Mark up documents using highlighting and sticky notes
· Redact sensitive information and save securely
· Add watermarks
· Insert hyperlinks to other pages in your document, other files or websites
· Rearrange, rotate or crop pages
· Change or add text anywhere in a document.
Assemble new documents with ease:
· Drag and drop to easily add content from multiple sources—including documents, spreadsheets, presentations and images—into a single PDF package to share with anyone
· Quickly assemble new documents using pages from existing material
· Export and email PDF documents
· Convert to PDF or XPS
· Drag and drop to combine text, spreadsheets, graphics and other content in a single PDF package.
Create files in PDF, DOC and XPS formats:
· Create new PDF documents from within any application that can print
· Organize and send related files in a single PDF package
· Convert multiple files at once with the Corel® PDF Batch Converter
OS: Windows XP/Vista/7
Link Download:
View over 100 file types:
· Open over 100 file types—even if you don't have the software used to create the file!
· Open Microsoft Word, Microsoft Excel, Microsoft PowerPoint, Microsoft Project, Adobe Illustrator, Adobe Photoshop, Microsoft Visio and many other file types
· Choose from Page, Assembly or Flick views to work with your document
· Use Flick View to flip through the pages of your document just like you're reading a book
Edit and rearrange content:
· Just select a phrase or sentence and start typing to make changes
· Edit or add text anywhere in a document
· Easily add bookmarks and comments
· Mark up documents using highlighting and sticky notes
· Redact sensitive information and save securely
· Add watermarks
· Insert hyperlinks to other pages in your document, other files or websites
· Rearrange, rotate or crop pages
· Change or add text anywhere in a document.
Assemble new documents with ease:
· Drag and drop to easily add content from multiple sources—including documents, spreadsheets, presentations and images—into a single PDF package to share with anyone
· Quickly assemble new documents using pages from existing material
· Export and email PDF documents
· Convert to PDF or XPS
· Drag and drop to combine text, spreadsheets, graphics and other content in a single PDF package.
Create files in PDF, DOC and XPS formats:
· Create new PDF documents from within any application that can print
· Organize and send related files in a single PDF package
· Convert multiple files at once with the Corel® PDF Batch Converter
OS: Windows XP/Vista/7
Link Download:
Mirror:
http://adf.ly/94uao
http://adf.ly/94uao
VRay 2 SP2 for 3ds Max 2009, 2010, 2011, 2012 (x64/x86)
Posted by
Unknown
01:03
VRay 2 SP2 for 3ds Max 2009, 2010, 2011, 2012 (x64/x86) | 800 MB
VRay - a powerful visualization tool that supports the Depth of Field (DOF), Motion Blur (effect of "smearing" in the motion), Displacement (displacement map, with increasing detail of three-dimensional objects). In addition, Vray has its own light source, a system of sun-sky for realistic lighting with natural light, and the physical camera parameters, similar to a real photo and video cameras. System Vray Proxy allows rendering of extremely large volumes of similar objects, consisting of total tens of billions of polygons. The newest update to VRay 2.0 for 3ds Max is now delivers new shader for rendering Fur and Hair and significant GPU enhancements.
VRay 2 SP2 features:
VRayCarPaintMtl - create stunning car paint shaders complete with base, flake and coat layers.
VRayHairMtl - is a new shader, allowing hair and fur to be rendered with unprecedented control, quality, and speed.
VRayLightSelect Render Element - become a master of lighting with the new VrayLightSelect feature and extract the contribution of each light to
the scene or compose all the lights back together and change their intensity in real time in any compositing software.
VRayMultiSubTex - use this VRay specific texture to assign different textures based on object.
Link Download:
VRayCarPaintMtl - create stunning car paint shaders complete with base, flake and coat layers.
VRayHairMtl - is a new shader, allowing hair and fur to be rendered with unprecedented control, quality, and speed.
VRayLightSelect Render Element - become a master of lighting with the new VrayLightSelect feature and extract the contribution of each light to
the scene or compose all the lights back together and change their intensity in real time in any compositing software.
VRayMultiSubTex - use this VRay specific texture to assign different textures based on object.
Link Download:
Subscribe to:
Posts (Atom)
