Skip to content
You are here: Home arrow SOBI2 arrow Use of Templates arrow Template Commands
Template Commands | Print |

The description on this site is always for use with the newest SOBI2 version. Most of the functions will work also in older versions. Some older commands (not longer mentioned here) are deprecated.

General Styling Options
Advanced Template Styling
Advanced Template Styling Part II
Inserting Plugin Code

General Styling Options

Description of the basic statements for the Details View and V-Card Template. Insert the statements you need. By default (standard template) all basic statements are included in the template file.

HTML skills are necessary!

Wherever the $mySobi object is used, you should know that this object exists by default only in the Details View Template. In the V-Card Template this object has to be created first using the following statement. The $mySobi object should be created only once for the whole V-Card Template.

<?php $mySobi = new sobi2( $id ); ?>

Style of the Details View (Details View only)  | link | 

That is the background image and border as defined in the SOBI2 back-end configuration. If you remove this statement, the configuration settings are no longer effective.

<?php echo $style; ?>

Style of the V-Card (V-Card only)  | link | 

The style as defined in the SOBI2 back-end configuration. That is the background image and border. If you remove this statement, the configuration settings are not longer effective. Also you will loose the "width" setting if using multiple columns for V-Cards.Don't remove the table column statement!

<td <?php echo $style; ?> >

Title of the entry  | link | 

Normally, this is the company name if you use SOBI2 as a business directory.

<?php echo $mySobi->title ?>

Title of the entry with link to Details View (V-Card only)  | link | 

<?php echo $title; ?>

Icon and image  | link | 

<?php echo $ico; ?>
<?php echo $img; ?>

All other fields  | link | 

This statement inserts all other fields as defined by the fields manager, including your self defined custom fields.

<?php HTML_SOBI::customFieldsData($fieldsFormatted); ?>

Integrated Google Map (Details View only)  | link | 

This statements works only if Google Maps is set up in the back-end correctly.

<?php HTML_SOBI::showGoogleMaps($mySobi, $config); ?>

Way search link  | link | 

<?php HTML_SOBI::waySearchUrl($waySearchLink); ?>
If using this command in the V-Card, you need to create the waysearch link first. To do this, just uncomment (by removing the two slashes) the two lines already given in the default V-Card.
$mySobi = new sobi2($id);
$waySearchLink = HTML_SOBI::createWaySearchUrl($id);

Date and time  | link | 

These statements insert date and time or date only when the entry was added to the directory.

<?php echo HTML_SOBI::addedDate($config, $mySobi); ?>
<?php echo HTML_SOBI::addedDateOnly($config, $mySobi); ?>

Number of hits  | link | 

This statement inserts the number of hits for the entry.

<?php echo HTML_SOBI::showHits($config, $mySobi);?>

Edit and delete buttons  | link | 

These buttons are only shown for the registered owner of the entry and for administrators.

<?php echo HTML_SOBI::editButtons($config, $mySobi); ?>

Separate edit and delete buttons (V-Card only)  | link | 

<?php echo $editButton; ?>
<?php echo $deleteButton; ?>

Link to the "Renew" function  | link | 

This statement inserts a link to the "renew entry" function when the entry expires soon and the renew functionality is enabled in the administration panel.

<?php HTML_SOBI::renewal($config, $mySobi); ?>

Selected categories  | link | 

This statement inserts the selected categories for the entry in the form category | category | category .

<?php echo HTML_SOBI::getMyCategories($mySobi, true);?>

Instead of the returned string you can get an arry with the categories. You have to execute a foreach loop to get all categories for the entry. This is only an example on how to get the info. You have to do your own programming to show the info in the way you want.

<?php foreach (HTML_SOBI::getMyCategories($mySobi) as $category) {
   echo $category['href'];
   echo $category['introtext'];
   echo $category['name'];
   echo $category['icon'];
}
?>

Hot label  | link | 

This statement inserts the "hot" label for the entry. By default an entry is "hot" if it has 500 hits. You can also define how much hits are needed to make an entry "hot". The second statement shows an example for 1000 hits.

<?php echo HTML_SOBI::hotLabel($mySobi);?>
<?php echo HTML_SOBI::hotLabel($mySobi, 1000);?>

Updated label  | link | 

This statement inserts the "updated" label for the entry. By default an entry has an "updated" label if it has been updated within the last three days. You can also define the number of days. The second statement shows an example for 10 days.

<?php echo HTML_SOBI::updatedLabel($mySobi);?>
<?php echo HTML_SOBI::updatedLabel($mySobi, 10);?>

New label  | link | 

This statement inserts the "new" label for the entry. By default an entry is "new" if it has been added within the last three days. You can also define the number of days. The second statement shows an example for 10 days.

<?php echo HTML_SOBI::newLabel($mySobi);?>
<?php echo HTML_SOBI::newLabel($mySobi, 10);?>

Link to all entries of the author  | link | 

This statement inserts a link to a list of all entries of the author. By default the label of this link is the real name of the author. You can also specify that this should be the login name.

<?php echo HTML_SOBI::userHref($mySobi);?>
<?php echo HTML_SOBI::userHref($mySobi, "login");?>

Tags/Meta Keys  | link | 

This statement inserts the selected tags for this entry. Tags in SOBI2 are created from the meta keys which the user has entered in add/edit entry form. By default this statement shows the first five selected tags. You can overwrite the default number of this function.

<?php echo HTML_SOBI::showTags($mySobi); ?>
<?php echo HTML_SOBI::showTags($mySobi, 20); ?>

Advanced Template Styling | link | 


Another method to insert the fields is to do it individually for each field instead of using the statement for inserting all fields defined in the fields manager at once. Don't forget to add your self defined custom fields!

The statements below already contain the formatting information like the CSS id or newlines as adjusted in the SOBI2 fields manager and the label of the field. Therefore you need no extra styling for them.

HTML skills are necessary!

Inserts the field street

<?php echo $fieldsFormatted['field_street']; ?>

Inserts the field postcode

<?php echo $fieldsFormatted['field_postcode']; ?>

Inserts the field city

<?php echo $fieldsFormatted['field_city']; ?>

Inserts the field county

<?php echo $fieldsFormatted['field_county']; ?>

Inserts the field federal state

<?php echo $fieldsFormatted['field_federal_state']; ?>

Inserts the field country

<?php echo $fieldsFormatted['field_country']; ?>

Inserts the field email

<?php echo $fieldsFormatted['field_email']; ?>

Inserts the field website

<?php echo $fieldsFormatted['field_website']; ?>

Inserts the field contact person

<?php echo $fieldsFormatted['field_contact_person']; ?>

Inserts the field phone

<?php echo $fieldsFormatted['field_phone']; ?>

Inserts the field fax

<?php echo $fieldsFormatted['field_fax']; ?>

Inserts the field hotline

<?php echo $fieldsFormatted['field_hotline']; ?>

Inserts the field description

<?php echo $fieldsFormatted['field_description']; ?>

Advanced Template Styling Part II | link | 


To do some further programming or add some custom PHP code you need probably the raw field values without any formatting information like the CSS id. To get these raw data directly use the statements below.
To show the raw data of a field you need to add an echo statement.

HTML and PHP skills are necessary!

The raw value of the field street

<?php $fieldsObjects['field_street']->data; ?>

The raw value of the field postcode

<?php $fieldsObjects['field_postcode']->data; ?>

The raw value of the field city

<?php $fieldsObjects['field_city']->data; ?>

The raw value of the field county

<?php $fieldsObjects['field_county']->data; ?>

The raw value of the field federal state

<?php $fieldsObjects['field_federal_state']->data; ?>

The raw value of the field country

<?php $fieldsObjects['field_country']->data; ?>

The raw value of the field email

<?php $fieldsObjects['field_email']->data; ?>

The raw value of the field website

<?php $fieldsObjects['field_website']->data; ?>

The raw value of the field contact person

<?php $fieldsObjects['field_contact_person']->data; ?>

The raw value of the field phone

<?php $fieldsObjects['field_phone']->data; ?>

The raw value of the field fax

<?php $fieldsObjects['field_fax']->data; ?>

The raw value of the field hotline

<?php $fieldsObjects['field_hotline']->data; ?>

The raw value of the field description

<?php $fieldsObjects['field_description']->data; ?>

Raw data for checkbox group  | link | 

Raw data for checkbox groups are within an array.
To address a specific checkbox use a similar statement as below. Replace 'field_checkbox_opt_1' with the option name you used in the Fields Manager. The example below shows the option value as entered in the Fields Manager if the checkbox is checked and it shows "not selected" if the checkbox isn't checked.

<?php
if (isset($fieldsObjects['field_mylist']->data['field_checkbox_opt_1']))
  echo $fieldsObjects['field_mylist']->data['field_checkbox_opt_1'];
else
  echo "not selected";
?>

To get all checked items of a checkbox group, use statements like these:

<?php
foreach ($fieldsObjects['field_mylist']->data as $name => $value) {
  echo $value;
  echo "<br/>";
}
?>

Another method to output all checked items of a checkbox group separated by a sign (e.g. a comma).

<?php
$separator = ", ";
echo (isset($fieldsObjects['field_mylist']->data) &&
  is_array($fieldsObjects['field_mylist']->data)) ?
  implode($separator, $fieldsObjects['field_mylist']->data) : null
?>

Field labels  | link | 

The label of the fields can be accessed separately by using a statements like the one below. To show the label add an echo.

<?php $fieldsObjects['field_street']->label; ?>
<?php echo $fieldsObjects['field_street']->label; ?>

Example of using raw data  | link | 

This example shows how the real URL of a website will be shown instead of the label "Website". Don't forget to insert the CSS class information.
This example is for the V-Card template. For the Details View template use span id="sobi2Details_field_website".

<span class="sobi2Listing_field_website">
<a href="<?php echo $fieldsObjects['field_website']->data; ?>" target="_blank">
<?php echo $fieldsObjects['field_website']->data; ?>
</a>
</span>
<br />

Linking to Details View (V-Card only)  | link | 

If you want to insert a (second) link to the corresponding details view of the entry, make a link as stated below.

<?php
$catid = (int) sobi2Config::request($_REQUEST, 'catid', 0);
$config =& sobi2Config::getInstance();
$link = sobi2Config::sef("index.php?option=com_sobi2&sobi2Task=sobi2Details&
    catid={$catid}&sobi2Id={$id}&Itemid={$config->sobi2Itemid}");
?>
<a href="<?php echo $link ?>">read more...</a>

Quick edit for raw values (Details View only)  | link | 

By default the Quick Edit function works only for formatted fields. If you need to use the Quick Edit function for raw values you have to use a statement like the one below.

<?php echo HTML_SOBI::toQuickEdit($fieldsObjects['field_street'], $mySobi); ?>

Notice:

  • this function should be called for every field only once.
  • this function works only in details view template
  • the returned value of this function contains not longer only raw data. The raw data is then within a span tag

Other entry related raw data  | link | 

The $mySobi object has the following attributes

$title - Title of the entry (company name)
$hits - Number of hits of the entry
$publish_up - Date of publishing
$publish_down - Date of expiration
$owner - ID of the owner of the entry
$image - File name of the image file
$icon - File name of the icon file
$ip - IP of the user who made the entry
$lastUpdate - Date of last update
$updatingUser - ID of the user who updated the entry the last time
$updatingIp - IP of the user who updated the entry the last time
$myCategories - two dimensional array with all selected categories for this entry
         (catid => catname)
$metakey - Meta keys
$metadesc - Meta description
$background - File name of the background image

Use these data in the following ways:

To show the data:

<?php echo $mySobi->hits; ?>

To use the data:

<?php
if ($mySobi->hits > 1000)
   echo "a lot of hits";
else
   echo "only a few hits";
?>

Inserting Plugin Code | link | 


To insert a plugin code in the Details View or V-Card use a statement like the below one. Replace reviews with the name of the plugin you use.
In the V-Card, normally this will insert a counter for the plugin (Reviews, Gallery and Media plugin). In the Details View, normally the complete functionality of the plugin will be inserted.

HTML skills are necessary!

<?php echo $plugins['reviews']; ?>

Digg!Del.icio.us!Google!Facebook!Slashdot!Netscape!Technorati!Yahoo!Ma.gnolia!
 

User Feedback

Awesome - Monday, 03 December 2007

Holy , this is one of the best J! components on the market - and this for free !
Its a kind of complex but easy to use directory software and fits a wide range of possibilities.
Superb and quick Support via Forum. Rich and useful plugins (Some are commercial). Give it a try and you'll love it...

 
Respect - Wednesday, 14 November 2007

This component is the best free Joomla component. SOBI2 has a framework for endless possibilities. This is the heven for every good developer.
I recommend to every person wanting to build a professional directory. Respect for the developers for the great component and for the best (and free) support I ever seen.

 
1st Class component - Monday, 12 November 2007

Fabulous and offers extras that I hadn´t even thought of using until I saw them.
I´m a Joomla! webmaster novice with only a few months experience and this was simple to install, easy to configure (and the options are multiple and useful) and I think looks great too.

 
Long time user - Thursday, 08 November 2007

What can be said this has to be the most used component on Joomla. If not a very close second :) The community is great, the dev team actually continues to work hard on the project and making changes. I sure hope Joomla is smart enough to change the GPL otherwise we will loose a wonderful component soon.
Oh yeah and its FREE what else can I say!

 
Excellent Directory Component - Tuesday, 30 October 2007

I have played with this component on and off for some time. The latest version is great. Added a couple of thing including the Alpha Index which on a larger directory I think is important. The Captcha code is handy too. The admin is also greatly improved.

 
Free, professional, many functions - Sunday, 07 October 2007

I finally took the moment to register myself here, only to review and rate Sobi2. In the beginning i was lost with this component, so many options!! Taking a moment to read the Sobi2 Wiki, and with the great and fast help of the people (neo and trinity) of the Sobi forum..i got the layout exactly that i needed..this component is much more than some company index..im using it for an music album section! This component is indeed one of the most professional extensions for free! You guys are doing a great job..two thumbs up!!

 
Best ever ... - Monday, 24 September 2007

I just wondering why this extension is not a editors pick.
This is the best extension I ever seen. And not just only this exetnsion is great. The support is much better as many commercial products have. Even if You have problems with SOBI2, you will have the solution for this problem in less than 24 hours.
Thank you very much.

 
Powerful, flexible, and easy to use! - Friday, 21 September 2007

I've used SOBI2 before for the basic business indexing purpose it was built for, and it works great out of the box. There are plenty of settings to tweak and adjust to get your site running exactly how you need.

 
This is an excellent extension - Monday, 17 September 2007

It's simple the best directory component available.
If you want a online directory site, then this is the one to use. It is very simple and fast to install. The support in sisiu forum is really great. Since the RC 2.8.0 this extension has all featured which an directory really need: search in categories, check boxes group with multiple selection, and search in categories. Thanks an Trinity and Neo :-)

 
Best Component EVER!!!! - Wednesday, 08 August 2007

I think my title says it all, this really is the BEST component out there, and I have used many. Not only is the component easy to install, it is also easy to use, easy to customise, and to top it all off - and this is why this is the BEST - it has Excellent support from Trinity and Neo, second to none.

 
Bad Ass Software! - Tuesday, 31 July 2007

We needed a quick and dirty directory for a video based site.
When this project started there was a need for a Business Directory which is why this project started. But now the project is far beyond a business directory. Its way more useful as a multi-media directory.
Took me 1 work day to complete this site!

 
Excellent through and through! - Friday, 06 July 2007

A superb component that just keeps getting better and better! Unbelievable array of configuration options make this a very scalable component indeed.
Quite simple to use considering the amount of options that can be configured, and what can't be done via the admin panel, can (with some basic coding skill) be achieved with simple mods to the very well commented code.

 
Great Extension - Friday, 06 July 2007

I am just going to write a short kudos to the developers here. This is one of the best business directory listing components I have found. I have been searching for quite some time for a component with the features I needed and this one did the job.

 
Outstanding Component! - Thursday, 05 July 2007

After looking for a component like this for quite some time, I am thrilled with my new installation of SOBI 2. The authors have done an incredible job of combining power with ease of use, which is often a difficult task.

 
Kudos to Sigrid and Radek - Wednesday, 30 May 2007

Sobi is flexible, offering broad customization through its backend and CSS templates w/o ever having to enter the arcane world of the files themselves (although, if you are able and willing to go there, the opportunities to express creativity are seemingly boundless). The program produces a wide variety of directories with simplicity or complexity of content and bare-bones or elegancy of appearance limited solely by the user's imagination and effort.

 
Diamond in the rough! - Sunday, 27 May 2007

I use SOBI2 on all my community websites. I have found it to be the most versatile directory component for Joomla, especially with the latest versions' templating system. Also, unlike other directory scripts, SOBI's developers are actively developing the script and participating in their support forums.

 
This is THE directory for Joomla! - Wednesday, 23 May 2007

I have tried quite a few different systems with Joomla! for directories but Sobi2 takes the cake. not only is this an excellent directory component but it also allows you to make a few dollars offering listings. The support forum and general Sobi community is excellent. Get this if you are looking for a directory for your site.

 
Great component - Wednesday, 11 April 2007

Genuinly very very well. A lot of useful work was done. Good and useful features, everything runs without problems.

 
Great work - Friday, 02 March 2007

Haven't seen such a good working component in a while. Everything you need for a Business Index and more. I really like the gallery.
Just download and install. If you get stuck, check the forum. The answers are there, so their support is also awesome. Really guys great job.

 
Excellent Link Directory - Full Options - Wednesday, 07 February 2007

I just downloaded this Component, took a good look at its functionality, and immediately sent a donation to the developers (you should too). I recently did a big time search for a fully-featured, ecommerce ready link directory and bought one for our site.

 
SOBI Should be Editors Pick - Saturday, 02 December 2006

I could only see advantages in using SOBI.
-Active Forum Support. :)
-Easiest way to manage online business directory.
-Most important of all, SOBI is "Always Updated!".

 
Professional Component for Free - Tuesday, 14 November 2006

A few days ago, I was browsing the Joomla! extensions site, seen SOBI for the first time, and decided I would check it out. All I can say is wow! I may need to customize a couple things, but as a free Open source component, I have to admit this is about the most functional and well-built as I have ever seen.

 
Big thank you - Tuesday, 14 November 2006

I can't belive how fast joomla and sobi2 got me up and running with a website. I just needed a very quick and dirty method to store all my business cards to share with my friends, they always like me to refer who I use. Anyhow a big thank you and no hesitations to donate.

 
Comparable to Mosets Tree - Sunday, 12 November 2006

I was definitely initially impressed. The component has a wide range of options, and will work in many situations. From what I see, you could even recreate the Joomla! Extensions site with SOBI2!

 
Wow - Monday, 06 November 2006

I’m very impressed with the amount of thought put in to this extension. The configuration is simple and easy to follow. The layout works great and flows well. For sure one of the best extensions I’ve seen to date.

 
SOBI 2 is Great! - Wednesday, 01 November 2006

I had my doubts about this, but it ended up being excellent. I loaded it and set it up very easily. I had an issue with my sites template script and Trinity figured it out immediately. I am so happy this is a free extension. I look forward to see what they come up with next!

 
Wins the "Quality Crafted" Award.. - Wednesday, 01 November 2006

In a computer driven world, designing for enduser ease of use is imperative. Learning how to write programs/software in a pattern that replicates how users will think and behave (so that using the program/software is easy)is fundamental.

 
Excellent - Wednesday, 01 November 2006

While I haven't spent a lot of time with it yet, it has some very useful configuration options and features, and what is even better is the fact that the component is actively being developed with very useful plugins.

 
Wow - Sunday, 22 October 2006

Sobi 2 is outstanding. I was up and running in no time. Easy install easy use.

 
Stand Up for this component - Wednesday, 18 October 2006

This is a great component well designed, easy interface, and with a lot of help, greetings from Mexico.