×

Notice

Please note that: starting February 1st, 2017 this product will not be supported anymore, and it will be removed from the store.

SD Plugins by Simon Dowdles

Typography SD Plugins by Simon Dowdles Free

SD Databaser allows you to use the value of your field to perform a database query & use the result as your final field value.

  • Use The Value of Your Field To Perform Database Queries
  • Use The Query Result As The Value of Your Actual Field
  • Use Multiple SQL Result Columns As Your Final Value
  • Joomla! 3.x

SD Databaser Typo Plugin


SD Databaser is a typography (typo) plugin that allows you to dynamically make a query against your Joomla! database, and gives you the ability to use your fields original value inside your SQL query. You then have the ability to use one or more more columns from your SQL query result to render out as your fields final value that the user will see on screen.

The nice thing about SD Databaser is that you don't even HAVE to use your fields value inside of of your SQL query, and the field can be used to make any SQL query possible on your Joomla database, using the result as your fields display value.

What if you have multiple rows returned?

Multiple rows are not an issue. If multiple rows are returned, you have the option to choose how they are separated (line breaks, custom strings etc), read on to see how...

Basic Usage of SD Databaser

Usage is pretty simple. For starters, the typography plugin is applied to your field the same way you would apply the bold, HTML, image typo plugins etc. In your typo plugin list (when editing your content type in the Intro or Content views) you will notice a new option called SD Database. If you select that, a small + icon will appear to the right. Clicking on this + icon will bring up the settings fields for SD Databaser.

There are only 4 fields that you need to fill out, they are:

--

SQL Query

This is the actual SQL query you want to run on your Joomla database. For example, you could type something like this:

SELECT * FROM #__content WHERE id = 2;

Notice the use of #__ above. This will be dynamically replaced with your Joomla database prefix that you chose upon installation. Apart from that, the only rule here is that a VALID SQL query must be made.

Now, let's assume you've applied this type to a field called my_number and let's also assume that the value of this field is going to be a digit between 1 and 20. What if we wanted to DYNAMICALLY use the value of this field to find the article with the ID equal to that of the fields value (1-20)? Simple, the use of the phrase *value* inside of your SQL query will result in the fields value (as pulled from the article) being placed at that point in the query. So, assuming in this case that the value of the my_number field is 8 and we apply the following SQL statement inside our SD Databaser setup screen:

SELECT * FROM #__content WHERE id = *value*;

The resulting SQL query that will be processed by the typo plugin is as follows:

SELECT * FROM #__content WHERE id = 8;

So to summarise, the use of *value* anywhere within the SQL statement results in the fields value (that you're applying the typo to) being inserted at that specific place.

--

Column(s) As Value

This is simple the column, or columns (if more that one are returned by your SQL query) that you wish to use as the display value of your field. Continuing with our above example, that SQL statement would of course return multiple columns, such as id, title, access etc. In our example, we are going to assume that only want the article title shown as our field value, so we would enter a value of title in our field marked column(s) As Value. This says to the typo plugin that of the many columns returned by the SQL query you wrote, you only want to use the title column. These values must of course be valid table column names returned as a result of your SQL query.

What if you wanted to use multiple columns as your field value? You can use as many columns as you wish, provided they are available in your result. For example, instead of us wanting only the article title as our value, we now want the article ID and then the title. TO use multiple columns, they MUST be separated by a double pipe || symbol. So our updated value inside the Column(s) As Value field would be:

id||title

The order in which you place the multiple columns is the SAME order they will be rendered in. The last thing you may want to do is decide how the value of id and title are separated (by space, comma, underscore etc). This brings us to:

--

Separator

It is here where you can supply any string value to act as a separator between your multiple columns. Let's assume that the SQL query used above returned a single article with the title 'Life is Great' and an ID of 8. If we entered an underscore ( _ ) as our separator value, the resulting value displayed on screen (in place of the original field value) would be:

 8_Life is Great

Likewise, if we swapped the order of the Column(s) As Value options around to read as title||id, the resulting value rendered on the screen would be:

Life is Great_8

--


Multiple RowSeparator

If your SQL query returns MORE than one row, it is here that you are able to decide how you would like each row in your result set separated. For example, assuming you wanted the rows displayed one below each other, you could simply enter in the HTML line break character as the value:

 

This would result in the
being inserted at the end of each row. You are free to add whatever string you like here, be in plain text or an HTML character / character code.

--

Summary

SD Databaser is an incredibly useful plugin for performing all sorts of database lookups, whether you want to use the original field value in your SQL or not. The benefit of this plugin being a Typo Plugin is tenfold. Although this plugin DOES NOT PRESERVE the original field value on screen, disabling the typo on the original field will result in the fields original value showing. This plugin DOES NOT ALTER the original value of your field, and as such you will never lose your fields original value.

Here is an older video showcasing the usage of this plugin, although the styling of the plugin has changed dramatically (as a result of the plugin needing to conform to the SEBLOD presentation of field setting screens), the functionality remains exactly the same:

Business Clubs:

  • Lifetime License
  • Unlimited Domains

Single purchase:

  • Free Updates
  • Lifetime License
  • Unlimited Domains

Details:

2704
21999
GNU GPLv2
2013-06-04
2016-12-16

Requires:

Latest SEBLOD

Downloads

ChangelogFileVersionDate
! Joomla 3 ready.Sign In2.5.02013-06-14

Rating & Reviews

255 characters only for the query

11 years ago
Hi

Thanks Simon but the query seems to be limited to 255 characters which is often too small. Any solution please ?

thanks

cyril
5
4
4