If you need to test a code in browser – try http://ideone.com/
Entry found on http://alouche.net/blog/2009/11/24/ideone-compiler-pastebin/
Dec 22
Posted by admin in php | No Comments
If you need to test a code in browser – try http://ideone.com/
Entry found on http://alouche.net/blog/2009/11/24/ideone-compiler-pastebin/
Tags: code in browser, code testing, pastebin, php
I was really suprised and pleased when i found myself on elance.com in TOP10 coders!
http://www.elance.com/p/blog/2009/12/congratulations_to_our_php_code_off_winners.html
Geotagging script (http://themeforest.net/user/php4ucouk)
Script converts visitor’s ip adress into :
and BONUS
Data is provided to you, so you can use it (display it, store in db or do whatever you need)
Tags: geotagging, php, user stats, visitors live stats
Jul 23
Posted by admin in Drupal 6.xx | 3 Comments
I wanted to set item to be active from my module. After research i found quite easy way to do it.
I found theme_links() which are preparing menu to be displayed. Copy that into template.php in your theme folder.
My function is quite simple:
function YOURTHEMENAME_links($links, $attributes = array('class' => 'links')) { global $language; $output = ''; /** * Make our item active */ if (strpos($_GET['q'],'URLTOMATCH1/') !== false) { $org = $_GET['q']; menu_set_active_item('node/57819'); // nid is taken from primary links } if (strpos($_GET['q'],'URLTOMATCH2') !== false) { $org = $_GET['q']; menu_set_active_item('node/57789'); } if (strpos($_GET['q'],'URLTOMATCH3') !== false) { $org = $_GET['q']; menu_set_active_item('node/57829'); } // inspiration if (strpos($_GET['q'],'inspiration') !== false) { $org = $_GET['q']; menu_set_active_item('node/57839'); } if (count($links) > 0) { $output = '<ul'. drupal_attributes($attributes) .'>'; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = $key; // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class .= ' first'; } if ($i == $num_links) { $class .= ' last'; } if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page())) && (empty($link['language']) || $link['language']->language == $language->language)) { $class .= ' active'; } $output .= '<li'. drupal_attributes(array('class' => $class)) .'>'; if (isset($link['href'])) { // Pass in $link as $options, they share the same keys. $output .= l($link['title'], $link['href'], $link); } else if (!empty($link['title'])) { // Some links are actually not links, but we wrap these in <span> for adding title and class attributes if (empty($link['html'])) { $link['title'] = check_plain($link['title']); } $span_attributes = ''; if (isset($link['attributes'])) { $span_attributes = drupal_attributes($link['attributes']); } $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>'; } $i++; $output .= "</li>\n"; } $output .= '</ul>'; } // set original value menu_set_active_item($org); return $output; } |
Tags: drupal 6.x, drupal menu, drupal theming, theme_links
I wanted to sort my views result on field which doesn’t exists in db table, so my idea was to use:
SELECT … WHERE field IN (value1, value2) … ORDER BY field = value1 DESC, field = value2 DESC etc
Which orders my elements exactly as I need, but problem was how to modyfy views sorting options?
Simply you can implement hook_views_query_alter(&$view, &$query) in your_module.views.inc file
$query->orderby is an array of all orderby elements, so you can easily modify it.
Tags: drupal, mysql, orderby, views 2.xx
I’ve installed fresh version of Ubuntu 9.04 with Lamp, but I couldn’t send emails outside.
Problem was SMTP auth of outgoing server, spending time found http://dbaron.org/linux/sendmail who made my day. Thanks
May 19
Posted by admin in Browsers issues | 1 Comment
I did really simple application, but still under IE7 it was crashing with Operation aborted.
First “You can turn off friendly HTTP error messages in Internet Explorer. This workaround still lets the error message appear. However, Internet Explorer does not move away from the page after the error occurs. This workaround works only for Internet Explorer 6.
To do this, follow these steps:
1. On the Tools menu, click Internet Options.
2. On the Advanced tab, click to clear the Show friendly HTTP error messages check box under the Browsing section, and then click OK.
3. Close the browser. ” according to http://support.microsoft.com/kb/927917
At least page is rendered, but it doesn’t solve a problem. When i started to dig i found that i’m using Jqwuery tooltip inside table.
Next thing i’ve added line to execute javascript when document is fully loaded.
It solved IE7 from crashing
Tags: internet explorer. ie7, Javascript, jquery, operation aborted
May 8
Posted by admin in Zend Framework | 1 Comment
Maybe should dig more in ZF API, but found simple solution:
class YourClass extends Zend_Db_Table_Abstract
{
public function findOneByParams(array $params)
{
// prepare query
$query = $this->select();
// add our terms
foreach ($params as $param => $value)
{
$query->where($param.' = ?', $value);
}
// find row
$row = $this->fetchRow($query);
// return
return $row;
}
}
Tags: mysql query, Zend Framework, zend_db_table
How to enable spell checking in Firefox? Enable built-in functionality
Type in address bar about:config
Then in next window type layout.spellcheckDefault
When option appear below double click on it and change value to be 2
Install any dictionary add-on for firefox you like from https://addons.mozilla.org/en-US/firefox/browse/type:3
Restart browser
To make sure it works right click on textfield and enable Check Spelling
Done
Tags: addons, firefox, spell checking
![]() | Loading Feed... |
![]() | Loading Feed... |
![]() | Loading Feed... |
![]() | Loading Feed... |
Arclite theme by digitalnature | powered by WordPress