Thursday, May 17, 2012
Tagged under: development, drupal
By default, Drupal does not support this type of sorting. According to the answer of this question, we must use a module called Views Arguments Extras:
How to sort items by the order of multi-arguments in Drupal Views
Tagged under: auto, complete, development, drupal, php, textfield
This is mostly applied to both Drupal 6 and 7, the only difference is Drupal 6 uses
Create a link to my form and a link to page that used for return autocomplete results:
Create content of my form:
Query whatever you want from database using the text you type in the textbox:
How to use auto-complete textfield in Drupal
drupal_json() and Drupal 7 uses drupal_json_output(). Here's what I did.Create a link to my form and a link to page that used for return autocomplete results:
//hook_menu
function my_module_menu() {
$items['my_autocomplete_form'] = array(
'type' => MENU_CALLBACK,
'title' => 'My Autocomplete Form',
'access callback' => TRUE,
'page callback' => 'drupal_get_form',
'page arguments' => array('my_autocomplete_form')
);
$items['autocomplete'] = array(
'type' => MENU_CALLBACK,
'title' => 'Autocomplete',
'access callback' => TRUE,
'page callback' => 'my_autocomplete_form_result'
);
return $items;
}Create content of my form:
function
my_autocomplete_form () {
$form = array();
$form['my_autocomplete_textfield'] = array(
'#title' => 'Text',
'#type' => 'textfield',
'#description' => 'This is a autocomplete textfield',
'#autocomplete_path' => 'autocomplete',
'#maxlength' => 500,
);
return $form;
}Query whatever you want from database using the text you type in the textbox:
function istar_front_product_manager_result($string) {
$matches = array();
$result = db_query_range("SELECT nid, title FROM {node} WHERE LOWER(title) LIKE LOWER('%%" . $string . "%%')", 0, 10);
while ($row = $result->fetchObject()) {
$matches[$row->nid] = check_plain($row->title);
}
return drupal_json_output($matches);
}Monday, May 14, 2012
Tagged under: development, query
Sometimes you can not enter phpMyAdmin to see the list of tables, use this query somewhere in your code to test:
How to get the list of tables using a query
select table_name from information_schema.tables where TABLE_TYPE = 'BASE TABLE'
Tagged under: css, development, drupal, jcarousel
Sometimes you use JCarousel module in your Drupal website and you want it fit your website quickly. All you have to do is:
Quick CSS adjustment on JCarousel module in Drupal
#block-views-kornova-news-news-scrollbar .jcarousel-container {
width: 460px;
}
#block-views-kornova-news-news-scrollbar .jcarousel-clip {
width: 460px;
overflow: hidden;
}
Tagged under: development, drupal, php, title
Sometimes you can not set page titles using formal method, here's how to do it programmatically
How to set page title in Drupal 7 programmatically
Sometimes you can not set page titles using formal method, here's how to do it programmatically
Tagged under: development, drupal, php, tabs
This is a Drupal issue I think. To make it right, you have to check all 2 following variables:
Tabs appearance checking in Drupal template file always returns TRUE!
This is a Drupal issue I think. To make it right, you have to check all 2 following variables:
Tagged under: development, drupal, pane, panels, php, title
Use Panels' hook to embed t() function (for example, your module name is my_module):
How to translate pane titles (Panels module) in Drupal 7
Use Panels' hook to embed t() function (for example, your module name is my_module):
Saturday, May 12, 2012
Tagged under: development, php
Here's the bug I encountered when coding for my client and took me an hour to figure out the cause.
Always reset mutual variables after every loop
Here's the bug I encountered when coding for my client and took me an hour to figure out the cause.
Tagged under: computer, sp2, sp3, windows, xp
To make your Windows XP copy work great without any permission from Gates
Download here
Windows XP SP2 & SP3 medicine
To make your Windows XP copy work great without any permission from Gates
Download here
Tagged under: computer, hotkey, sound, volume
How to control sound volume with hotkey
If you're using a laptop, there's no problem with adjusting sound volume because there's always hotkeys for that (Fn + some key depending on the manufacturer). But on desktop, there's nothing like that and it's really inconvenient when your computer suddenly make a loud noise. Using hotkeys is obviously faster than looking for the volume icon on the taskbar, click on it and then scroll your mouse. Here's how.
Subscribe to:
Comments (Atom)







