SEBLOD Contextual Content Features
Dynamically pull values in to your content submission and search forms
Accessing contextual-based content and using that to feed information to your SEBLOD elements is useful in a variety of settings. There are a few different mechanisms for doing this, and in this post we'll look at them and the scenarios in which they can be useful.

What is contextual content?

We term contextual content as content that is available on the page that the user is currently viewing. When you are using live values (which we'll explore later), you have access to variables in the page URL, and also information that is tied to the currently logged in user's session.

Using live values to retrieve contextual content

We've got a whole manual on Playing with Live Values, but we'll re-hash the main concepts here. Live values are a way of dynamically setting the default value of a field. This is useful when you have a Site Form module embedded in the Content View of an article, and you want to link the information that is submitted in the form to the article you are viewing. A prime example of this is a comments form - you want the comment that is entered to be linked to the post that is being commented on.

Keeping with this example, let's say you're looking at the Content View of an article that is linked in your menu. If you turn off SEF URL's in your Joomla website's configuration, you'll see a URL that looks something like this:

From this URL, you can see a number of variables that can each be accessed by using Live Values. These are:
  • Variable: option     Value: com_content
  • Variable: view        Value: article
  • Variable: id           Value: 10
  • Variable: catid       Value: 2
  • Variable: Itemid     Value: 101
Here, the id of 10 is the one we would use in order to link the form submission to the article, as that is the article's ID. To set this, in our site form, we would add a field called something like "article parent ID", click on the [2] button, select URL as the live value, click "configure", then select Type > "int", Variable > "id". This will now pull the article's ID dynamically in to our form.

Using the Form and List plugin to retrieve contextual content

While live values are incredibly useful in many circumstances, one down side is that they don't allow you to pull information from individual list items within a list page. So if you have a list, and you want each list item to have a sub-list that is related dynamically to the parent list item, it's not achievable with live values.

That's where the SEBLOD Form & List Pack comes in. This plugin allows you to embed a list or site form in a SEBLOD view without using a Joomla module. With this plugin, it's possible to pass values from the parent item to a search field within the child List & Search Type. Please note it's not currently possible to pass a value from an item to a form embedded within an item, or nest lists within lists beyond 1 level of nesting.seblod list field setup screenshot Using these contextual content features enable you to create powerful, dynamic websites. Give them a try today!
Get a Book for SEBLOD


There is no comment yet.. Be the first to submit one!