Posted by & filed under Java script, Joomla, Joomla Extention.

Dear Friends,

I know there is no update on tinybn for many days and it has so many bugs but I am not gone yet ! heh heh. I think who are very familiar with joomla and it’s content editor tinymce, are also familiar with jce(joomla content editor), a joomla conent editor based on tinymce with lots of feature. You can get jce here. Please check their donwload section to download the jce component and jce plugin/mambot(editor).

hmm, please don’t get sleep … I just made a plugin for jce to use my tinybn plugin directly in jce. No manuall install needed , I mean editing files to work with default tinymce.
So , here is the download file of tinybn for jce.

Download

  Tinybn JCE Editor (12.1 KiB, 7,917 hits)

How to install

1. Install jce component (that will help you to modify or control jce editor and install new plugin and much more)
2. Install jce plugin
3. Now install tinybn plugin for jce. Go to Administrator-> Components-> JCE Administrations-> Install (see screenshot bellow)
4. Now browser the downloaded zip file and install it.

tinybnjce1

that’s it.
Install finish :) . Ok now go to article manager and try to open/write any new article. I think you are intelligent enough to make your editor default to jce or even disabled tinymce from plugins. If jce is your current editor and you have install the tinybn for jce according to instruction then you should see like bellow. Select keyboard and type in diff bengali layout.

tinybnjce2

mu ha ha…waiting for your feedback.

Posted by & filed under wordpress, Wordpress Plugin, Wordpress Themes.

Don't Follow MeOne of my senior brother just asked me, how to add no follow rel for comments in wordpress. May be there is plugin for this. Look to my code :)
How to use:
1.Open the functions.php file in ur current theme and put these code within php tags.

What it will do:
1. Will add ‘no follow’ as rel in url , if comment contains any url.
2. Will ad ‘external’ as rel in url , if comment contains any url.
3. Will add target=”_blank” in comment author’s url so that their web url open’s in new window/new tab as in browser settings
4. Will add target=”_blank” to url, if comment contains any url
5. Wp adds ‘no follow’, ‘external’ rel in comment author’s url by default. So we don’t need to add this 😛

Tips:
1.If possible upgrade to wp2.8.2

      function nofollow($text) {
	        $text = preg_replace('/<a /i','<a rel="nofollow external" ',$text);
	        $text = preg_replace('/<a /i','<a target="_blank" ',$text);
	        return $text;
    }
    function targetblank($text){
    		$text = preg_replace('/<a /i','<a target="_blank" ',$text);
	        return $text;
    }

    add_filter('comment_text', 'nofollow');
    add_filter('get_comment_author_link','targetblank');

any question ask me :)
p.s.: post image is just for fun 😛

BTW, are you afraid of editing your functions.php ? Ok, no problem you can add the above piece of code using the bellow wp plugin.

  Wp nofollow plugin for comment (997 bytes, 1,748 hits)

Duh, you are totally unhappy with this post, na ? You can to treat your commentors with “cake and cook”, ok no problem.Just forget my post and read this blog post …“The Single, Most Profound Way To Thank Your Commenters”.
Happy now ?

Posted by & filed under wordpress, Wordpress Plugin.

Yah, I know my developed tinybn (an ekushey project ,  tinymce plugin to write bangla in tinymce editor) has so many bugs and even I will recommend not to use in any live :P. But we are crazy to write bangla in web in any condition… heh heh.. hmm I didn’t get time to update the scripts. Though updated them to make compatible for tinymce3.x. Yes, I am so lazy …I didn’t udpate the lastest version in ekushey :(

Even I made a plugin for wordpress to use this plugin in wordpress editor in Visual mode (that means tinymce is enabled :D).hmm I didn’t release this too. Let me release this for every body. Please keep this mind that it has bugs, yes it has so many bugs but I will be happy if ppl use this and give me feedback so that I can update this when I am free.

Let me show how the tinybn plugin in wordpress will show [ Screenshot taken from my blog,wp2.8.2]
wptinybn

How to use:
1. Download the zip given here for download and then unzip.
2. Copy the folder wp_tinybn_fixed to your wodpress plugin dir.
3.Activate the plugin
4. Try to write any new post/page in visual mode
Licence: GPL2
Download:

  Wp tinybn plugin 2.2 (20.6 KiB, 2,000 hits)

Any kind of negative and positive comment/feedback is welcome :)

update:
version 2.1 released
1. Fixed bug for js if the language mode is in bangla :P. That was my mistake to migrate the plugin from tinymce2.x compatible to 3.x. I forgot to change the language file setting for bangla language and I didn’t use this plugin while bangla is active in backend :(. Oh I have to fix same thing for jce version of tinybn.
2. Special thank to Hasan

Posted by & filed under Joomla, Projects.

It’s many days I didn’t write any thing here. I am not lost yet ! heh heh really I am not lost. Within last 4/5 months I did lots of projects. I said in many place that I started my professional career in jan 2008 and then it was hampered by so many things. I back to work again 4/5 months ago and now working as a full time freelancer at home. Yes I like to work with full freedom though working from home has some bad sides. Let me introduce you with some of my last 4/5 months projects. Hei ! I am really and here every thing is in brief.

ISLAM TRIBUNE_1248087112584Time.com clone (look and feel) using wordpress: Though time.com changes their layout frequently, I made a clone of it’s interface using wordpress, I mean the theme of wordpress. Here is snapshot of that. Oh yes, at first I made it red as time.com and then changed the red color to greenish. It’s for islamtribune.com.

BBC NEWS_1248108686378
BCC.co.uk clone using wordpress: I mentioned in another post that I made a theme for wordpress with same look and feel of bbc.co.uk. It’s front page is like bbc.co.uk and innner pages are like news.bbc.co.uk . sexy na ? heh heh.. wana see demo. check here. Here is screenshot.

secondbillysecondbilly.com clone of mobile.de: A german site for furniture market. It’s using  joomla and market place component , though it’s customized too much. The main marketplace component is customized as needed and some custom modules are developed to give support to the component in front end. It’s in german language :) Visit the site from here(http://www.secondbilly.com/).

Will update mores in another post :)

Posted by & filed under wordpress, Wordpress Plugin, Wordpress Themes.

I think to show the first image as thumb in wp front page or blog layout is very common for any theme. But to use it in wordpress mu version is not direct or need to do some hack or modify the normall process of adding timthub. Normally we upload images from wp media manager and use those in posts. In normal wordpress the upload dir is wp-content/uploads and files and images are uploaded to that directory. In wordpress mu version files are uploaded by user basis folder and for this wp-content/blogs.dir/userid is the uploaded dir for any image. here user id is named as folder name for each user. then wp-content/blogs.dir/userid/files. But when u browse the site the image link format is like http://yoursitename/files/year/month/image name but format is reshaped by the wp mu htacces which real physical path is like wp-content/blogs.dir/userid/files/year/month/image name.
Read more »

Posted by & filed under Joomla, Joomla Extention.

I think JW Player(flash player) by longtailvideo.com is well known to u all. There are so many extension for joomla, wordpress, drupal and other cms using this tool. Simple_video_flash_player is a joomla module to show flash and other videos. Today I used it with one of project. But after checking in ie6 I was tempered becuase it was showing a js error in ie and the modules config file I meant he xml file has not param to show module class suffix which is very important to style module using css. I searched google and got so many solution. Here is my code that helped to solve this issue in ie6.
Read more »

Posted by & filed under Joomla.

I always like to share web related silly problems that I face in my works.
If u are a joomla fan and u like to make a image gallery in joomla then rsgallery2 can be ur better(to me it’s best) choise. But one thing that I faced in joomla1.5(don’t know about the condition in joomla1.x series) about rsgallery2 is it’s title and pathway problem when it’s just connected as component from menu I mean just when u go to rsgallery2 as from menu as a component it doesn’t show any breadcrumb(pathway) and pagetitle

I searched google and joomla forum for this but didn’t get much help actually. BTW, at this time the rsgallery2 site is down for maintenance. So I gave a try to fix this as I always do.

At first let me clear about the problem. When first time u will go to rsgallery2 as component, in this condition no gallery is selected and no items in any gallery ie, no gallery id or current gallery is as no gallery id

Not clear yet, check the code in com_rsgallery2\templates\meta\display.class.php and in function showRSPathWay()…To get it clearly u have to check this function dear

see this
if ( $gallery->id == $currentGallery && empty($item) )

this is true when just go to rsgallery2 because no items and both the gallery id is null and currentgallery id is null and
as it’s true the code is executed as $pathway->addItem($gallery->name );
but as gallery id is null then it’s doesn’t show any gallery name… isn’t it a bug huh ? that means pathway fails to show any thing for this condition and same problem in
function metadata() which shows the pagetitle for rsgallery2 and meta information.

Here is the code that I edited for those two functions


/**     * shows proper Joomla path     */
function showRSPathWay() {
		global $mainframe, $mosConfig_live_site, $Itemid, $option;
		// if rsg2 isn't the component being displayed, don't show pathway
		if( $option != 'com_rsgallery2' )	return;

		$gallery = rsgInstance::getGallery();
		$currentGallery = $gallery->id;
		$item = rsgInstance::getItem();
		$galleries = array();
		$galleries[] = $gallery;
		while ( $gallery->parent != 0) {
			$gallery = $gallery->parent();
			$galleries[] = $gallery;
		}
		$galleries = array_reverse($galleries);
		if( defined( 'J15B_EXEC' ) )
		{
			// J1.0 method
			foreach( $galleries as $gallery )
			{
				if ( $gallery->id == $currentGallery &amp;&amp; empty($item) )
				{
					$mainframe->appendPathWay($gallery->name);
				} else {
					$mainframe->appendPathWay('<a href="' . JRoute::_('index.php?option=com_rsgallery2&amp;Itemid='.$Itemid.'&amp;gid=' . $gallery->id) . '">' . $gallery->name . '</a>');
				}
			}
			if (!empty($item)) {
					$mainframe->appendPathWay( $item->title );
			}
		}
		else
		{
			// J1.5 method
			$pathway =&amp; $mainframe->getPathway();

			/*Edit start by manchumahara*/
			$document	=&amp; JFactory::getDocument();
			$params = &amp;$mainframe->getParams();
			$menus	= &amp;JSite::getMenu();
			$menu	= $menus->getActive();
			$pagetitle = '';
			if (is_object( $menu ))
			{
				$menu_params = new JParameter( $menu->params );
				if (!$menu_params->get( 'page_title'))
				{
					$pagetitle = JText::_('MRSGALLERYTITLE');
					//loading it from language file
				}
				else $pagetitle =$menu_params->get( 'page_title');
			}
			else
			{
				$pagetitle = JText::_('MRSGALLERYTITLE');
				//loading it from language file
			}
			//$pagetitle = $mainframe->getPageTitle();
			foreach( $galleries as $gallery )
			{
				if ( $gallery->id == $currentGallery &amp;&amp; empty($item) )
				{
					if($gallery->id== 0){
						//gallery id zero and no items ie, if menu is link to component directly
						$pathway->addItem($pagetitle);
					}
					else
					{
						//gallery id not zero,ie gid id ok but no items in this gallery
						$pathway->addItem($gallery->name );
					}
				} else
				{
					$link = 'index.php?option=com_rsgallery2&amp;gid=' . $gallery->id;
					$pathway->addItem( $gallery->name, $link );
				}
			}
			/*Edit end by manchumahara*/

			/*Edit start by manchumahara*/
			if (!empty($item)) {
				$mainframe->appendPathWay($item->title );
				//$mainframe->appendPathWay( $title );
			}
			else {$mainframe->appendPathWay($pagetitle);}
			/*Edit end by manchumahara*/
		}
	}
	/**	 * insert meta data into head	 */
	function metadata(){
		global $mainframe, $option;
		// if rsg2 isn't the component being displayed, don not append meta data
		if( $option != 'com_rsgallery2' )
			return;		/*Edit by manchumahara*/
		$document	=&amp; JFactory::getDocument();
		$params = &amp;$mainframe->getParams();
		$menus	= &amp;JSite::getMenu();
		$menu	= $menus->getActive();
		$pagetitle = '';
		if (is_object( $menu )) {
			$menu_params = new JParameter( $menu->params );
			if (!$menu_params->get( 'page_title')) {
				$pagetitle = JText::_('MRSGALLERYTITLE');
				//loading it from language file
			}
			else $pagetitle =$menu_params->get( 'page_title');
		}
		else
		{
			$pagetitle = JText::_('MRSGALLERYTITLE');
			//loading it from language file
		}

		/*Edit start by manchumahara*/
		$title = $this->gallery->get('name');
		$description = htmlspecialchars(strip_tags($this->gallery->get('description')), ENT_QUOTES );
		$item = rsgInstance::getItem();
		if ($item != null){
			$title .= ' - ' . $item->title;
			$description .= ' -  ' . htmlspecialchars(strip_tags($item->descr), ENT_QUOTES );
		}

		/*Edit end by manchumahara*/

		if($title == ''){ $title = $pagetitle;}

		/*Edit start by manchumahara*/
		$mainframe->setPageTitle( ' '. $title );
		$mainframe->appendMetaTag( 'description',  $description );
	}

BTW, as if there is nothig set as pagetitle from menu then I showed it from language file and for this I made an entry in language file as like this. Open en-GB.ini file and put this line at the end
MRSGALLERYTITLE = RSGallery2

Posted by & filed under wordpress, Wordpress Themes.

bbcNow a days I am a great fan of wordpress. Recently I have done some projects on wordpress and getting expert day by day 😛 heh heh.

This post about how can we make menu in wordpress like news.bbc.co.uk. Now a days some clients want clone sites. They don’t think about all the functionality but the look and feel clone :) .
So to clone the menu like news.bbc.co.uk we what we need:
1. wp function wp_list_categories(args)
2. CSS to give look and feel like news.bbc.co.uk

Before we start let’s check what we are going to do:
here is the image that we are going to make or the menu that we are doing to make using wp_list_categories function and css. Look this menu is 2 level deep. To keep the theme clean u can make a function in functions.php file like bellow and just call the function in theme where u want to place the menu.
Look here we are using echo= 0 as want to just return the output from this function. and depth =2 as we want to make two level hirarachy… check others params that I have used. To know details about the template tag wp_list_categories pls check this page in wp codex.

Now what we need is to apply the css to style the menu like news.bbc.co.uk… one thing to keep in mind. When u will browse through the category I mean u click the any category from the menu and posts will be shown using category.php template then active category will get an extra class automatic which is helpfull to highlight using css but if u browse any single.

function get_leftcatmenu(){
$excludecats = array();
$excludecats = array(1,2,3); //categories to exlclude
//or
//$includecats = array ();
//$includecats = array(1,2,3); //categories to include

/*
// same thing can be done using a simple plugin and saving the categories in option table , bellow code is for comma seperated cat list
$excludecats = explode(',', get_option('bbcnews_leftmenucid'));
$excludecats = implode( ",",$excludecats);
*/
/*
$includecats = explode(',', get_option('bbcnews_leftmenuscid'));
$includecats = implode( ",",$seccats);

//sample code to exclude
return wp_list_categories('orderby=name&amp;amp;amp;style=list&amp;amp;amp;hide_empty=0&amp;amp;amp;show_count=0&amp;amp;amp;title_li=&amp;amp;amp;exclude='.$excludecats.'&amp;amp;amp;hierarchical=true&amp;amp;amp;depth=2&amp;amp;amp;echo=0');

// sample code to inlclude
return wp_list_categories('orderby=id&amp;amp;amp;style=list&amp;amp;amp;hide_empty=0&amp;amp;amp;show_count=0&amp;amp;amp;title_li=&amp;amp;amp;include='.$includecats.'&amp;amp;amp;hierarchical=true&amp;amp;amp;depth=2&amp;amp;amp;echo=0');
*/
}

post we need the hightlight the category in the menu to which the single post belongs to. But to make this happen that adding an extra class to the menu to make active while browsing any single posts I have used a plugin :) named “Show Active Category (while browsing a post)“. Note if any post belongs to more one category then it will add extra active class to each category.

Uff….now check the css code that I used:
Note: this css code works fine in ff3 and ie6 and I have no interest with other browser at this moment.
Code to use in theme:

<ul class="catmenu">
<li class="<?php if (is_home()){ echo"> home"><a href="<?php echo get_option('home'); ?>">News Front Page</a></li>
</ul>

and code to add in style.css

ul.catmenu li{ background-color:#E5E5E5; margin-bottom:2px;}
ul.catmenu li a{ text-decoration:none;  line-height:19px;  font-size:11px; font-weight:bold;  padding:2px 0  2px 5px; color:#1F527B; vertical-align:middle; }
ul.catmenu li ul.children li a{ text-decoration:none; line-height:19px; font-family:9px; font-weight:normal; padding:2px 0  2px 5px; vertical-align:middle;}
ul.catmenu li:hover{ background-color:#D8D8D8;}
ul.catmenu li.current-cat{ background:#665F6E url(images/v3_square_rb.gif) repeat-y scroll right top;}
ul.catmenu li.current-cat:hover{ background-color:#665F6E;}
ul.catmenu li.current-cat a{ color:#FFFFFF;}
ul.catmenu li a:hover{ text-decoration:underline;}
ul.catmenu li ul.children{ background-color:#D3D3D3; display:none;}
ul.catmenu li ul.children li{ margin-bottom:0px;}
ul.catmenu li.current-cat-parent{ background:#665F6E;}
ul.catmenu li.current-cat-parent a{ color:#FFFFFF;}
ul.catmenu li.current-cat-parent ul li a,ul.catmenu li.current-cat ul li a{ color:#1F527B;}
ul.catmenu li.current-cat-parent ul li.current-cat{ background:#C0BFBF url(images/v3_square_rb.gif) repeat-y scroll right top;}
ul.catmenu li.current-cat ul.children,ul.catmenu li.current-cat-parent ul.children { display:block; background-color:#D3D3D3; }

ul.catmenu li.current-cat-parent ul li.current-cat a{ font-weight:bold; color:#1F527B;}

have not enogh time to discuss what the above css code do but it took me more than 1 hr to write the above css perfectly :( . If u are familiar with the abc of css then u will get the css code easily.

BTW, u need one image in the images folder and here is link for that image . Copy and paste the image in images folder. Pls keep in mind about the copy right of the image. Here the main thing that I wanted to highlight that how to make clone of any “look and feel” with own creativity that is what I actually did here.

Another screenshot:

bbc2

Posted by & filed under wordpress, Wordpress Themes.

If u are reached here using search engine then I am sure that you are just fucked up :( .. is_home(), is_single(), is_category() are not working…specially in footer and other places. I faced the same problem. While working with a wordpress theme, this functions were working fine in footer but once I noticed that they are not working as they should be !….

Let me explain why and how this problem occurs and what’s the solution :

I think if u are familiar with the famus LOOP in wordpress. The following is_home(), is_single(), is_category() functions depends on the loop. ACtually when u visit the home page then header.php, index.php, sidebar.php and footer.php files are executed and in the same way when u visit a single post then normally header.php, single.php, sidebar.php and footer.php files are executed. Actually some global page specific query is done for single.php, index.php etc. is_home(), is_single(), is_category() they will work fine if u use the default theme and don’t add any custom query !

Let’s check the code for is_home() function …

/**
* Whether current page view is the blog homepage.
*
* @since 1.5.0
* @uses $wp_query
*
* @return bool True if blog view homepage.
*/
function is_home () {
global $wp_query;
return $wp_query->is_home;
}

Ok, for custom query maximum time I use this function get_posts. But to get more control I used query_posts. They are same and share some common arguments but query_posts gives more controls and more arguments to pass to get the exact query. Now Let’s check the code for query_posts() function

/**
* Setup the Loop based on the query variables.
*
* @uses WP::$query_vars
* @since 2.0.0
*/
function query_posts() {
global $wp_the_query;
$this->build_query_string();
$wp_the_query->query($this->query_vars);
}

and code for get_posts

/**
* Retrieve list of latest posts or posts matching criteria.
*
* The defaults are as follows:
*     'numberposts' - Default is 5. Total number of posts to retrieve.
*     'offset' - Default is 0. See {@link WP_Query::query()} for more.
*     'category' - What category to pull the posts from.
*     'orderby' - Default is 'post_date'. How to order the posts.
*     'order' - Default is 'DESC'. The order to retrieve the posts.
*     'include' - See {@link WP_Query::query()} for more.
*     'exclude' - See {@link WP_Query::query()} for more.
*     'meta_key' - See {@link WP_Query::query()} for more.
*     'meta_value' - See {@link WP_Query::query()} for more.
*     'post_type' - Default is 'post'. Can be 'page', or 'attachment' to name a few.
*     'post_parent' - The parent of the post or post type.
*     'post_status' - Default is 'published'. Post status to retrieve.
*
* @since 1.2.0
* @uses $wpdb
* @uses WP_Query::query() See for more default arguments and information.
* @link http://codex.wordpress.org/Template_Tags/get_posts
*
* @param array $args Optional. Override defaults.
* @return array List of posts.
*/
function get_posts($args = null) {
$defaults = array(
'numberposts' => 5, 'offset' => 0,
'category' => 0, 'orderby' => 'post_date',
'order' => 'DESC', 'include' => '',
'exclude' => '', 'meta_key' => '',
'meta_value' =>'', 'post_type' => 'post',
'suppress_filters' => true
);

$r = wp_parse_args( $args, $defaults );
if ( empty( $r['post_status'] ) )
$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
if ( ! empty($r['numberposts']) )
$r['posts_per_page'] = $r['numberposts'];
if ( ! empty($r['category']) )
$r['cat'] = $r['category'];
if ( ! empty($r['include']) ) {
$incposts = preg_split('/[\s,]+/',$r['include']);
$r['posts_per_page'] = count($incposts);  // only the number of posts included
$r['post__in'] = $incposts;
} elseif ( ! empty($r['exclude']) )
$r['post__not_in'] = preg_split('/[\s,]+/',$r['exclude']);

$r['caller_get_posts'] = true;

$get_posts = new WP_Query;
return $get_posts->query($r);

}

get_posts will not make any problem for is_single(), is_home(), is_category() etc functions.

Solution: To avoid this problem you can use this trick:

$query_backup = clone($GLOBALS['wp_query']); //keep backup
......
query_posts(.....)
...
$GLOBALS['wp_query'] = $query_backup; //restore from backup

Further info: Please keep in mind that the php function clone() will not work in php4, it’s just for php5 becuase Php5 handles objects in different way. Like in php5 you can copy a object in this way
$new_object = clone ($old_object);
here $new_object will not copy the object actually though it will just point to $old_object but in php4 the thing is just copy like bellow.
$new_object = $old_object;

You can check this link for better explanation.

Sometimes pain gives us a way to think 😛

thanks

Posted by & filed under Bangla Blogs, wordpress, Wordpress Themes.

[যদি আপনার নরমাল এইটিএমএল এবং একদম বেসিক পিএইচপি জ্ঞান না থাকে তাহলে এই পোস্টের কিছু বিষয় জটিল মনে হতে পারে ]
অনেকেই ব্যক্তিগত হোস্টিং এ ওয়ার্ড প্রেস ইনস্টল করে ব্লগিং করছেন এবং পছন্দের কোন ফ্রি থীম ইনস্টল করে দিব্যি সুন্দর ব্যক্তিগত ব্লগ বানিয়ে নিচ্ছেন। যদি এমন হয় এই থীম কিভাবে কাজ করে তা যদি জানা থাকে তাহলে আরো মজা না ? ইচ্ছা হলো একটু সম্পাদনা করে থীমটাকে নিজের মতো সাজিয়ে নিলেন। আমার বকবক শুরুর আগে আসুন জেনে নেই এই পোস্টের উদ্দেশ্যগুলোঃ

একঃ ওয়ার্ড প্রেসের থীম কিভাবে কাজ করে
দুইঃ থীম ফোল্ডারের কোন ফাইলের কাজ কি
তিনঃ থীম সম্পাদনা করা
চারঃ ইত্যাদি :ttt:
Read more »