Skip to main content

Dynamic Mode

nx-YouTubeBox Pro integrates a Dynamic Mode the aim is to avoid having to create 10 module instances for 10 different articles, for example. You can use this feature to create  a general setup for videos / playlists in your articles, and do it all with just one module instance.

This is achieved by not storing the source information (Video ID / URL) in the module but in the custom field of the article. The module then reads this field and creates your player.

So now that we have the knowledge, we can get started.

First we need the Customfield

To add custom fields for your articles:

  1. Click Content → Article in the Admin Control Panel
  2. Select Fields in the menu on the left side
  3. Click the button New in tool bar on the top

 Add CF 1

Configure the newly added field

We use "Text" as fieldtype and give it a good name (to identify the field later). In my case i called the field "nx-YouTubeBox Source" but it is up to you how you want to name the field.

 Fieldconfig a

There are numerous tweaks and possibilities to display the field only for articles in individual categories etc.. - However, this is not part of this tutorial and at this point I like to refer to the official Joomla! docs.

But one important option has to be set before we leave the field configuration, switch to the tab Options and scroll down till you see the Select Box for Automatic Display in Render Option - set this option to Do not autmatically display. This prevents the content of our field (i.e. the URL / ID) from being output in the header or footer of the article.

not auto diesplay field

Creating the module instance

Actually this step is quite simple, navigate to the module overview (Content --> Modules (J4) or Extensions --> Modules (J3)) and create a new module instance via the button new in the upper left corner.

Now select nx-YouTubeBox as type and configure the module as you wish. In the module settings select Dynamic as Source Mode - Then you can select the previously created field as CustomField.

DynModeSetup

Please note: Currently it is not possible to create playlists in some articles and single videos or user videos in others. nx-YoutubeBox (module) defines if it treats the source as playlist or single video. So the type must fit.

Then make sure that the module "On all pages" is visible (Check Menu Assignement) and published and that the access rights are correct.

Configure Article(s)

Now we are actually ready to test the whole thing, create a new article (or edit an existing one) and switch to the Fields tab, here you will see the customfield you created earlier with an input field:

AddVideoURLToField

You can enter the video / playlist URL or just the ID in this field.

In the article text we now place the module at the desired position, set the cursor where the module should be added. Depending on the editor / Joomla version used, the procedure here may differ - check the manual of your editor to learn how best to proceed. In our example under Joomla 4 with the standard editor we proceed as follows:

 AddModuleToContent 1

Select CMS Content in the Menubar and then click on Module - This opens a Modal where you got a list of all modules, select here your nx-YouTubeBox Pro module instance that you have created before:

AddModuleToContent 2

The module is now inserted in the form of a shortcode at the corresponding position where your cursor was placed.

AddModuleToContent 3

And that's it - the module with the ID 117 (the ID is of course different for you) is now displayed at the corresponding position in the article. Let's have a look at the whole thing!

Video embedded in content

What could go wrong

If you've gotten to this point and something isn't working as expected, here are some quick tips on what might be causing it.

I don't see the custom field in the article edit screen (Fields tab).

  • Check if the custom field was created for the component "Article" -> Is the field listed under Content > Fields?
  • Check if the corresponding field has been released for single categories only (Field settings)
  • Check if the field is published
  • Check if the fed belongs to a group (groups are displayed in separate tabs in the article edit screen)

Video is not displayed - area is empty

  • Check if the URL you entered is correct / don't use the ID but the complete URL
    (directly from the address bar when you watch the video on Youtube).
  • Did you possibly choose the wrong / no Custoomfield in the module settings?
  • Is the type in the module settings for the content correct? (Playlist / Video)Is the module enabled for display "On all pages"?
  • Is the module in Published status?
  • Is the correct access group selected in the module settings? (Try to use Public)