<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"
		xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
<channel>
<title>The Magic Clicks Blog</title>
<atom:link href="http://www.themagicclicks.com/" rel="self" type="application/rss+xml" />
<link>http://www.themagicclicks.com/blog.html?task=feed&amp;type=rss</link>
<description>Powered by The Magic Clicks</description>
<pubDate>2010-12-17 01:36:28</pubDate>
<language>English (United Kingdom)</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<item>
<title>Ads Manager Router Full Version</title>
<link>/blog/2010/12/17/15-ads-manager-router-full-version.html</link>
<comments>/blog/2010/12/17/15-ads-manager-router-full-version.html#comment</comments>
<dc:creator>Administrator</dc:creator>
<category><![CDATA[joomla]]></category>
<description>Several people found my Ads Manager router useful. but since it was not built for the front end ad management facility, my version missed handling those specific tasks and views.One guy "agu" who pos</description>
<content:encoded><div style="text-align: left;">Several people found my Ads Manager router useful. but since it was not built for the front end ad management facility, my version missed handling those specific tasks and views.<br ><br >One guy "agu" who posted a comment on my previous post on Ads Manager Router took my router and advanced it further, and later mailed me the updated version.<br ><br > I'm posting it here,please comment if this is useful,since he also is keen to know how good his code turned out to be.He said he has used it successfully, so this might be the answer to many of your requirement, those who need a more complete router.<br ><br >BTW, heard that there are several updated versions of Ads Manager coming along, can anybody point me to one of them?<div>
{codecitation class="brush:php;html-script:false;}<?php
**
* Builds route for AdsManager
*
* @access public
* @param array Query associative array
* @return array SEF URI segments
*
defined( '_JEXEC' ) or die( 'Restricted access' );
function adsmanagerBuildRoute(&$query)
{
   $page = '';
    $segments = array();
    print_r($query);
    if(isset($query['page'])){
        $page = $query['page'];
        unset($query['page']);
    }

   switch ($page) {
        
        case 'show_category';
                        
            if(isset($query['catid'])){
                $segments[] = 'categories';                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                unset the rest of useless extra query string parameters passed on by the AdsManager 

Menu...
                viz. text_search=&order=0&expand=0
                unset($query['text_search']);
                unset($query['order']);
                unset($query['expand']);
            }

        break;
        
        case 'show_ad';
            $segments[] = 'ads';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
        break;

                case 'write_ad';
            $segments[] = 'post';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
        break;

                case 'save_ad';
            $segments[] = 'save';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
        break;

                case 'show_search';
            $segments[] = 'search';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
        break;


        case 'show_all';
            $segments[] = 'allads';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
                break;
        

                case 'show_rules';
            $segments[] = 'rules';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
        break;
        
                case 'delete_ad';
            $segments[] = 'delete';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
        break;

        case 'show_result';
            $segments[] = 'result';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
        break;

        case 'search';
            $segments[] = 'advsearch';
            if(isset($query['catid'])){                
                $category_alias = getCategoryTitle($query['catid']);
                $segments[] = $category_alias;        
                unset($query['catid']);
                
            }
            if(isset($query['adid'])){
                                
                $ad_alias = getAdTitle($query['adid']);
                $segments[] = $ad_alias;        
                unset($query['adid']);
            }
            unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
            viz. text_search=&order=0&expand=0
            unset($query['text_search']);
            unset($query['order']);
            unset($query['expand']);
        break;
    } 
   return $segments;
}

**
* Method to parse Route
* @param array $segments
* 
function adsmanagerParseRoute($segments)  
{
    $vars = array();
   
     Get the active menu item.
    $menu   = &JSite::getMenu();
    $item   = &$menu->getActive();
    
    $firstSegment = $segments[0]; 
    switch($firstSegment){
        case 'categories';
        $vars['page'] = "show_category";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
                $vars['Itemid'] = $item;
        }
        break;
        case 'ads';
        $vars['page'] = "show_ad";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;
        break;
                case 'post';
        $vars['page'] = "write_ad";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;
        break;
                case 'save';
        $vars['page'] = "save_ad";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;
        break;
                case 'search';
        $vars['page'] = "show_search";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;
        break;
                case 'allads';
        $vars['page'] = "show_all";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;            
        break;
        case 'rules';
        $vars['page'] = "show_rules";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;
        break;
        case 'delete';
        $vars['page'] = "delete_ad";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;
        break;
        case 'result';
        $vars['page'] = "show_result";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;
        break;
        case 'advsearch';
        $vars['page'] = "search";
            if(isset($segments[1])){
                $vars['catid'] = $segments[1];
        }
        if(isset($segments[3])){
                $vars['adid'] = $segments[3];
        }
        $vars['Itemid'] = $item;
        break;
    }
    return $vars;
}

function getCategoryTitle($id){
    $db    = & JFactory::getDBO();
    
    $query = "SELECT `name`,`parent` FROM #__adsmanager_categories WHERE `id`=".$id;
    
    $db->setQuery($query);
    $category_name = $db->loadResult();
    if($category_name=="")
        return;

    you can add nested categories here

    $category_alias = strtolower($category_name);

    Remove following characters
    $special_chars = array('!','@','#','$','%','*','(',')');
    foreach($special_chars as $char){
        $category_alias = str_replace($char,'', $category_alias);
    }

    $category_alias = str_replace(' ','-', $category_alias);
    $category_alias = str_replace('  ','-', $category_alias);
    return $category_alias;
}

function getAdTitle($id){
    $db    = & JFactory::getDBO();
    
    $query = "SELECT `ad_headline` FROM #__adsmanager_ads WHERE `id`=".$id;
    
    $db->setQuery($query);
    $ad_name = $db->loadResult();
    if($ad_name=="")
        return;

    you can add nested categories here

    $ad_alias = strtolower($ad_name);

    Remove following characters
    $special_chars = array('!','@','#','$','%','*','(',')');
    foreach($special_chars as $char){
        $ad_alias = str_replace($char,'', $ad_alias);
    }

    $ad_alias = str_replace(' ','-', $ad_alias);
    $ad_alias = str_replace('  ','-', $ad_alias);
    return $ad_alias;
}

?>
{codecitation}</content:encoded>
<pubDate>Fri, 17 Dec 2010 01:36:28 -0700</pubDate>
<guid isPermaLink="false">/blog/2010/12/17/15-ads-manager-router-full-version.html</guid>
<wfw:commentRss>http://www.themagicclicks.com/blog.html?task=feed&amp;amp;type=rss2&amp;amp;id=15</wfw:commentRss>
</item>
<item>
<title>SEF Router for AdsManager using component native router.php</title>
<link>/blog/2010/08/08/14-adsmanangerrouter.html</link>
<comments>/blog/2010/08/08/14-adsmanangerrouter.html#comment</comments>
<dc:creator>Administrator</dc:creator>
<category><![CDATA[joomla]]></category>
<description>the Joomla! AdsManager component is pretty beautiful, and easy to use and modify to suit your requirement. The only major problem it seems to have is that it has a SEF Plugin tha</description>
<content:encoded><div style="text-align: left;"><span style="font-size: 10pt;">the Joomla! AdsManager component is pretty beautiful, and easy to use and modify to suit your requirement. The only major problem it seems to have is that it has a SEF Plugin that requires a commercial purchase from 3rd Party, and there is no native router as available now in Joomla!<br >Joomla! now allows a component developer to put a router.php in the component root and then this acts as an override of the URL parser functions of the Joomla! core JRoute Class.<br ><br >I recently developed a router.php for AdsMananger... so if anybody needs it , copy the code, paste it and save it as router.php inside the component's root folder, and turn on Joomla! SEF and you should be ready to go.<br ><br > NOTE:<a href="http:www.themagicclicks.comblogjoomla15-ads-manager-router-full-version.html">Here<a> is the updated and more complete version of the router.<span><div><br >
{codecitation class="brush:php"}
<?php
**
* Builds route for AdsManager
*
* @access public
* @param array Query associative array
* @return array SEF URI segments
*
defined( '_JEXEC' ) or die( 'Restricted access' );
function adsmanagerBuildRoute(&$query)
{
   $page = '';
	$segments = array();
	print_r($query);
	if(isset($query['page'])){
		$page = $query['page'];
		unset($query['page']);
	}

   switch ($page) {
		
		case 'show_category';
						
			if(isset($query['catid'])){
				$segments[] = 'adventures';
				$segments[] = $query['catid'];				
				$category_alias = getCategoryTitle($query['catid']);
				$segments[] = $category_alias;		
				unset($query['catid']);
				unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
				viz. text_search=&order=0&expand=0
				unset($query['text_search']);
				unset($query['order']);
				unset($query['expand']);
			}

		break;
		
		case 'show_ad';
			$segments[] = 'tours';
			if(isset($query['catid'])){
				$segments[] = $query['catid'];				
				$category_alias = getCategoryTitle($query['catid']);
				$segments[] = $category_alias;		
				unset($query['catid']);
				
			}
			if(isset($query['adid'])){
				
				$segments[] = $query['adid'];				
				$ad_alias = getAdTitle($query['adid']);
				$segments[] = $ad_alias;		
				unset($query['adid']);
			}
			unset the rest of useless extra query string parameters passed on by the AdsManager Menu...
			viz. text_search=&order=0&expand=0
			unset($query['text_search']);
			unset($query['order']);
			unset($query['expand']);
		break;

	} 
   return $segments;
}

**
* Method to parse Route
* @param array $segments
* 
function adsmanagerParseRoute($segments)  
{
    $vars = array();
   
     Get the active menu item.
    $menu   = &JSite::getMenu();
    $item   = &$menu->getActive();
	
    $firstSegment = $segments[0]; 
	switch($firstSegment){
		case 'adventures';
		$vars['page'] = "show_category";
			if(isset($segments[1])){
				$vars['catid'] = $segments[1];
				$vars['Itemid'] = $item;
		}
		break;
		case 'tours';
		$vars['page'] = "show_ad";
			if(isset($segments[1])){
				$vars['catid'] = $segments[1];
		}
		if(isset($segments[3])){
				$vars['adid'] = $segments[3];
		}
		$vars['Itemid'] = $item;
		break;
	}
	return $vars;
}

function getCategoryTitle($id){
	$db	= & JFactory::getDBO();
	
	$query = "SELECT `name`,`parent` FROM #__adsmanager_categories WHERE `id`=".$id;
	
	$db->setQuery($query);
	$category_name = $db->loadResult();
	if($category_name=="")
		return;

	you can add nested categories here

	$category_alias = strtolower($category_name);

	Remove following characters
	$special_chars = array('!','@','#','$','%','*','(',')');
	foreach($special_chars as $char){
		$category_alias = str_replace($char,'', $category_alias);
	}

	$category_alias = str_replace(' ','-', $category_alias);
	$category_alias = str_replace('  ','-', $category_alias);
	return $category_alias;
}

function getAdTitle($id){
	$db	= & JFactory::getDBO();
	
	$query = "SELECT `ad_headline` FROM #__adsmanager_ads WHERE `id`=".$id;
	
	$db->setQuery($query);
	$ad_name = $db->loadResult();
	if($ad_name=="")
		return;

	you can add nested categories here

	$ad_alias = strtolower($ad_name);

	Remove following characters
	$special_chars = array('!','@','#','$','%','*','(',')');
	foreach($special_chars as $char){
		$ad_alias = str_replace($char,'', $ad_alias);
	}

	$ad_alias = str_replace(' ','-', $ad_alias);
	$ad_alias = str_replace('  ','-', $ad_alias);
	return $ad_alias;
}

?>

{codecitation}</content:encoded>
<pubDate>Sun, 08 Aug 2010 13:16:48 -0700</pubDate>
<guid isPermaLink="false">/blog/2010/08/08/14-adsmanangerrouter.html</guid>
<wfw:commentRss>http://www.themagicclicks.com/blog.html?task=feed&amp;amp;type=rss2&amp;amp;id=14</wfw:commentRss>
</item>
<item>
<title>SOBI2 and Large Databases with tens of thousands of records</title>
<link>/blog/2010/07/31/13-sobi2largedatabase.html</link>
<comments>/blog/2010/07/31/13-sobi2largedatabase.html#comment</comments>
<dc:creator>Administrator</dc:creator>
<category><![CDATA[joomla]]></category>
<description>SOBI2 is fine for sites with moderate database sizes and moderate traffics, but when the number of records in your database exceeds 10s of thousands (and in our c</description>
<content:encoded><div style="text-align: left;"><span style="font-size: 10pt;"><strong>SOBI2 <strong>is fine for sites with moderate database sizes and moderate traffics, but when the number of records in your database exceeds 10s of thousands (and in our case it was 50000), SOBI2 might fail in generating the search <script type="textjavascript" src="http:www.themagicclicks.compluginseditorsjcetiny_mcethemesadvancedlangsen.js?version=156"><script><script type="textjavascript" src="http:www.themagicclicks.compluginseditorsjcetiny_mcepluginsadvcodelangsen.js?version=156"><script>results when the search filters are very broad, in fact SOBI2 fails in such cases because the large Queries generated by <strong>SOBI2 <strong>can not be parsed by <strong>mySQL <strong>if <strong>SQL_BIG_SELECTS<strong> option is not set in your <strong>mySQL <strong>Database.<br ><br >So, those of you who own dedicated servers or have hosts friendly enough to turn on this mySQL option, go and get it set to 1 and SOBI2 will be back in action again. For the others, let's open the axsearch.class.php and add these few lines before any query is executed, and mySQL will be ready to run large queries.<br > <br > <span><div>
<br >
{codecitation class="brush:php"}
$db2=& JFactory::getDBO();
$db2->setQuery("SET OPTION SQL_BIG_SELECTS=1");
$db2->query();
echo $db2->getErrorMsg();
{codecitation}</content:encoded>
<pubDate>Sat, 31 Jul 2010 14:23:20 -0700</pubDate>
<guid isPermaLink="false">/blog/2010/07/31/13-sobi2largedatabase.html</guid>
<wfw:commentRss>http://www.themagicclicks.com/blog.html?task=feed&amp;amp;type=rss2&amp;amp;id=13</wfw:commentRss>
</item>
<item>
<title>SOBI2 VCard Template Custom Data Display</title>
<link>/blog/2010/07/30/12-sobi2vcardtemplatecustomdatadisplay.html</link>
<comments>/blog/2010/07/30/12-sobi2vcardtemplatecustomdatadisplay.html#comment</comments>
<dc:creator>Administrator</dc:creator>
<category><![CDATA[themagicclicks]]></category>
<description>Continuing from my previous post on how to add your custom formatted data to a SOBI2 Details view template, let's now consider the SOBI2 VCard template, which again has the restric</description>
<content:encoded><p style="text-align: left;"><span style="font-size: 10pt;">Continuing from my previous post on how to add your custom formatted data to a SOBI2 Details view template, let's now consider the SOBI2 VCard template, which again has the restrictions of displaying the major field data in a pre processed set defined from inside SOBI2 Classes, so that, from the template itself you are left mostly with tasks like making them look better and doing the CSS for the field labels and values.<br ><br >But, this is not sufficient in many cases, so let's do it again. let's go through the simple 1,2,3 Step routine of achieving this, the rest you'll understand naturally.<br ><br ><strong>Step 1:<strong> Once again, from the From Sobi2 control panel select <strong>V-Card Template<strong> template under <strong>template & css<strong> menu. Let's say we need the Item detail URL separately to build a custom More Info link.We'd call our custom function and store the returned URL in our own variable and use it anywhere we like in our vCard HTML template, like this<br > <span><p>
{codecitation class="brush:php"}$href=HTML_SOBI::createMoreInfoUrl( $id ); {codecitation}<br >
<div style="text-align: left;"><span style="font-size: small;"><strong>Step 2: <strong> open file <strong>sobi2.html.php<strong> from inside the folder <strong>componentscom_sobi2 <strong>and create the createMoreInfoUrl function to the class <strong>HTML_SOBI <strong>just where you find the other pre defined function like <strong>createWaySearchUrl<strong><span><div>
{codecitation class="brush:php"}function createMoreInfoUrl($id) 	{ 		REMEMBER TO ADD CATID LATER... 		$href = "index.php?option=com_sobi2&sobi2Task=sobi2Details&&sobi2Id={$id}";&Itemid={$config->sobi2Itemid} 		$href = sobi2Config::sef($href); 		return $href; 	}{codecitation}<br >
<div style="text-align: left;"><span style="font-size: 10pt;">You can easily see how this function is similar to the createWaySearchUrl function and in the vCard template can be used just as the createWaySearchUrl or WaySearchUrl functions are used, as shown in Step1! <br ><br >So, once again, you are done! you can have as many custom functions outputting as many custom fields separated from the generic custom field output block that SOBI2 generates.<br ><br ><strong>NOTE:<strong>The actual use of this method is not well explained in the given example, since if you want your custom display of individual fields in SOBI2 VCard Template, instead of using the pre defined block of custom fields data, you can comment out the following<span><div>
{codecitation class="brush:php"}<?php echo HTML_SOBI::customFieldsData($fieldsFormatted);?>{codecitation}<br >
<div style="text-align: left;"><span style="font-size: 10pt;">and use individual custom formatted field labes and data like <span><div>
{codecitation class="brush:php"}<?php echo $fieldsObjects['field_name']->label; ?><br >
<?php echo $fieldsObjects['field_name']->data; ?>
{codecitation}<br >
<div style="text-align: left;"><span style="font-size: 10pt;">Writing a custom function is only important when you need some complex data to be output on your template based on many other fields or want to modify some of the existing functions there.<span><div></content:encoded>
<pubDate>Fri, 30 Jul 2010 23:21:07 -0700</pubDate>
<guid isPermaLink="false">/blog/2010/07/30/12-sobi2vcardtemplatecustomdatadisplay.html</guid>
<wfw:commentRss>http://www.themagicclicks.com/blog.html?task=feed&amp;amp;type=rss2&amp;amp;id=12</wfw:commentRss>
</item>
<item>
<title>SOBI2 Detail View Custom Field Display</title>
<link>/blog/2010/07/30/11-sobi2detailviewcustomization.html</link>
<comments>/blog/2010/07/30/11-sobi2detailviewcustomization.html#comment</comments>
<dc:creator>Administrator</dc:creator>
<category><![CDATA[themagicclicks]]></category>
<description>Recently we were working on a SOBI2 project, where the detail view generated by SOBI2 was not sufficient for us, simply put the formatted data </description>
<content:encoded><div style="text-align: justify;"><span style="font-size: small;"><span style="font-size: 10pt;">Recently we were working on a SOBI2 project, where the detail view generated by SOBI2 was not sufficient for us, simply put the formatted data SOBI2 presents us on the detail view was not sufficient for us, since we <script type="textjavascript" src="http:www.themagicclicks.compluginseditorsjcetiny_mcethemesadvancedlangsen.js?version=156"><script><script type="textjavascript" src="http:www.themagicclicks.compluginseditorsjcetiny_mcepluginsadvcodelangsen.js?version=156"><script>needed some fields to be displayed so separately from the SOBI2 Generated bunched data, that we needed to do something that presents us with a completely separate data field with no connection with SOBI2 generated detail view. We did the following to achieve this...and hope it's helpful for you too...  I'll write in 1,2,3 Steps for ease of implementation, understanding what is happening is actually quite simple! we are simply adding a few more functions to the required classes to achieve the separate output we want.<br ><br ><span><strong><span style="font-size: 10pt;">Step 1:  <span><strong><span style="font-size: 10pt;">Let's say we want to display the Item description completely separated from SOBI2 detail view data,what we do first is go to the Joomla Admin of our site and from the Sobi2 control panel select <span><strong><span style="font-size: 10pt;">Detail view<span><strong><span style="font-size: 10pt;"> template under <span><strong><span style="font-size: 10pt;">template&css<span><strong><span style="font-size: 10pt;"> menu.<br ><span><strong><span style="font-size: 10pt;">Step 2:<span><strong><span style="font-size: 10pt;">  Now, assume that we'll be writing an appropriate function to render the expected output, and then call it from the position in your layout, where you want this data to be displayed...like this,<span><span><div>
{codecitation class="brush:php"}<?php HTML_SOBI::getItemDesc($config,$mySobi); ?>{codecitation}<br >
<div style="text-align: left;"><span style="font-size: small;"><span style="font-size: 10pt;"> Where <span><strong><span style="font-size: 10pt;">getItemDesc <span><strong><span style="font-size: 10pt;">is the function we'll look into next.<br ><br ><span><strong><span style="font-size: 10pt;">Step 3: <span><span style="font-weight: normal;"><span style="font-size: 10pt;">Now open file <span><span><span style="font-size: 10pt;">sobi2.html.php <span><span style="font-weight: normal;"><span style="font-size: 10pt;">from inside the folder <strong>componentscom_sobi2<strong> and add the following function inside the <span><strong><span style="font-size: 10pt;">HTML_SOBI <span><strong><span style="font-size: 10pt;">class along side the other functions you'll see SOBI2 already uses to generated data.<span><span><strong><span><div>
{codecitation class="brush:php"}function getItemDesc($config,$mySobi)
    {
		sobi2Config::import("sobi2.entry");
		return sobiEntry::getItemDesc( $config,$mySobi );
    }
{codecitation}<br >
<div style="text-align: left;"><strong><span style="font-size: 10pt;">Step 4: <span style="font-weight: normal;">Next open<span> sobi2.entry.php <span style="font-weight: normal;">from inside the folder <span>componentscom_sobi2 <span style="font-weight: normal;">and add the follwing function inside the class <strong>sobiEntry<strong><span><span><strong><div>
{codecitation class="brush:php"}function getItemDesc($config, $mySobi)
	{
		$fieldsObjects 	=& $mySobi->myFields;
		$my =& $config->getUser();
    	        $cid = intval( sobi2Config::request( $_REQUEST, 'catid', 0 ) );
		foreach( $fieldsObjects as $field ) 
		{
			$field->name = $config->getSobiStr( $field->fieldname );
			$field->label = $config->getSobiStr( $field->label );
			if($field->name=='field_description')
			{
				echo $field->data;
			}
		}
	}
{codecitation} <br ><br >
<div style="text-align: left;"><span style="font-size: 10pt;">And <strong>So! you have your additional field displayed independently on the detail view<strong>, it could be any custom field you have added only that you have to know the exact name of the field.<span><div>


<br ><br ><div style="text-align: left;"><span style="font-size: 10pt;"><strong>NOTE:<strong>One again, The actual use of this method is not well understood from the given example, since if you want your custom display of individual fields in SOBI2 Detail Template, instead of using the pre defined block of custom fields data, you can use the following just like in vCard and use individual custom formatted field labes and data like <span><div>
{codecitation class="brush:php"}<?php echo $fieldsObjects['field_name']->label; ?><br >
<?php echo $fieldsObjects['field_name']->data; ?>
{codecitation}<br >
<div style="text-align: left;"><span style="font-size: 10pt;">Writing a custom function is only important when you need some complex data to be output on your template based on many other fields or want to modify some of the existing functions there,and in case of the detail view template, the sobi2.entry.php is the perfect place where you can access the Database from and run your custom queries too<span><div></content:encoded>
<pubDate>Fri, 30 Jul 2010 22:49:03 -0700</pubDate>
<guid isPermaLink="false">/blog/2010/07/30/11-sobi2detailviewcustomization.html</guid>
<wfw:commentRss>http://www.themagicclicks.com/blog.html?task=feed&amp;amp;type=rss2&amp;amp;id=11</wfw:commentRss>
</item>
</channel>
</rss>

