Archive for the 'php' Category

20
Jun
12

howto: execute SQL Query in a view (Joomla)

No, it doesn’t comply to MVC standards but yes it’s still handy:

$db = JFactory::getDBO();
$db->setQuery( ‘Your SQL query here‘ );
$res = $db->loadObject();

Use $res for further operations 

IE:

$db = JFactory::getDBO();
$db->setQuery( ‘SELECT c_category FROM #__sample_category WHERE c_id =’ . $k );
$res = $db->loadObject();
$category_name = $res->c_category ;
echo ‘<h2>’.$category_name.'</h2>’;

20
Jun
12

Using CSS3 rounded corners in IE7/IE8 (without images)

Yes it’s possible, you can now write your CSS3 code once thanks to CSS3 Pie

20
Jun
12

howto: get template path in Joomla

You may need to get your template path outside index file, all you need is to type these 2 magical lines:

$app = JFactory::getApplication();

$templateDir = JURI::base() . ‘templates/’ . $app->getTemplate();

$templateDir is the path to your template, happy echo 

20
Jun
12

howto: add js or css file to head in Joomla

Wondering how to properly call a js or css file to your page header from a view  ? Two quick lines will do the trick:

//This is a reference to the global document object (I know it sounds snoozy but you’ll need it anyway)
$doc = JFactory::getDocument();

//CSS File call
$doc->addStyleSheet(‘path to/yourfile.css’);

//JS File call
$doc->addScript(‘path to/yourfile.js’);

It will work for all Joomla versions starting from 1.5.

If you’re calling your stuff right from your template directory, check the post right above to figure out how to get your template path.

29
Dec
11

Openinviter Twitter Plugin ‘Unable to get contacts’ Error Fix

If you’re using Openinviter, you probably got this error while trying to use the Twitter service:

'Unable to get contacts'

Same thing will happen using the online demo.

This is due to a recent Twitter update forcing SSL on mobile version (The Openinviter plugin is not using the official API methods but a clever interaction with the mobile version of Twitter).

To fix that issue, just open the /OpenInviter/plugins/twitter.plg.php file and change all the http references to https.

Btw, this will also fix the send invitations problem (if you ever succeeded to get contacts).

It should work flawlessly 

20
Dec
11

Facebook Open Graph tags for WordPress

Maybe you heard about the Opengraph Tags used by Facebook ? Basically “including Open Graph tags on your Web page, makes your page equivalent to a Facebook Page”:

http://developers.facebook.com/docs/opengraph/

And yes, you’ll get a nice like Thumbnail of your web page using this stuff (knowing that the share function is now deprecated: http://developers.facebook.com/docs/share/ and has been replaced with like).

This is a quick code for WordPress (minimal tags), just adapt, then copy & paste to your wordpress theme header:

Continue reading ‘Facebook Open Graph tags for WordPress’

20
Dec
11

Find out the source code source :]

Wondering about the license, version, and the original project of that piece of code you’ve got ? Just use this new search engine to find out:

antepedia

http://www.antepedia.com/

20
Dec
11

Howto: Display home link in wordpress menu

Good trick:

http://www.wpbeginner.com/wp-themes/how-to-show-home-page-link-in-wordpress-3-0-menu/

20
Dec
11

Get a rid of all IE7 problems

Internet Explorer 7 getElementById killer, this saved my life:

http://www.impressivewebs.com/avoiding-problems-with-javascript-getelementbyid-method-in-internet-explorer-7/

20
Dec
11

Using wordpress native lightbox

Don’t bother yourself installing 3rd party plugins, use the classy WordPress native lightbox, read more here:

http://manchumahara.com/2010/03/22/using-wordpress-native-thickbox/