Skip to content

1. Setup

ANDI Amine edited this page May 8, 2024 · 2 revisions

Quick start

We will guide you through 4 basic steps to work with JoomCCK. At first JoomCCK may looks complicated because you will see a lot of parameters everywhere. But do not be scared, after you learn JoomCCK concept, understand it is philosophy and learn those parameters you will love them. Believe me you will love every single parameter because every one of them will give you great flexibility. You will even ask for more adjustments options.

Step 1 - Create Joomla Menu Element

I think this have to be first step to create any new section in JoomCCK . I will not describe how to do that. This is standard Joomla operation. You can create menu type separator. Then you do not have to enter any parameters.

Step 2 - Create Content Type

I will not explain all type parameters here, you can quickly look through them. You will find that 99% of them you do not need an explanation. It is very clear what it does.

  1. Go to JoomCCK > Types > New
  2. Enter type name Blog Post. In parameters, find Menu item ID and set there menu element we create in first step.
  3. Now open Submission slider. If you want other users submit from frontend, in Who can submit select public or registered. If you want only administrators to submit you can select special.

Note!

Records may be submitted only from frontend. There is no new record button in backend. This is why you have to set those parameters.

  1. Now you have to decide if you will have categories in the section or not. If your section does not have categories then in Who can select category chose No one.

  2. Click Save & Close button in toolbar.

Type is ready. Now we have to add there some fields.

  1. Click on Fields (0) on the right of the type name to get to the list of the type fields.

  2. Click New in toolbar.

  3. Enter field name Post

  4. Select field type HTML. You will see parameters of the field loaded. You may leave them as they are. If it would be other field type we could save if. But with HTML usually we need little bit more adjustments. Because we want it on the form and in the article to be full width.

  5. In the General Parameters of the field on the right find Show label and set it to Hide Label. Then find Break after label and set it to Break on submit form and record full view.

Note!

This settings are usually make sense for fields like Textarea, HTML or Gallery only in record full view but not in the form. Otherwise you may skip those parameters and keep them default.

Step 3 - Create Section

  1. Go to JoomCCK > Sections > New
  2. Enter section name and title Blog. If you want little introduction, enter section description.
  3. In the Itemid target parameter select menu element we created on first step.
  4. Scroll down and find Submit Type parameter and select type we have just created.
  5. Click Save & Close button in toolbar.
  6. If you want to add categories, click Categories (0) on the left of the section name and add categories as you usually add any core Joomla categories.

Finalize

Now you only need to edit menu element you created and change its type to JoomCCK > Section records list. Access this link in frontend, click Post Blog Post Here and submit new article. The list of articles may not looks like a real blog, but that is because we did not set templates. This is matter for another article.

Conclusion

Of course there is much more to learn, but look how simple is basic concept! Just in 5-10 minutes you have created your first section. You can now study one parameter after another to discover full power and opportunities JoomCCK provides for you.


Create pre-filtered links

Link for order

If you want to create link outside of JoomCCK to pre-ordered list of articles use this URL.

https://www.mywebsite.com/index.php?option=com_joomcck&view=records&section_id=1&filter_order=r.title&filter_order_Dir=asc

Basic rule is that you should take URL of the list of articles you want including all parameters like section_id, Itemid or cat_id or others and add 2 new parameters.

Parameter Req. Description
filter_order  Yes How to order. See below.
filter_order_Dir  Yes What is order direction. Can be asc or desc

List of possible ordering types

  • r.ctime - Time of creation
  • r.mtime - modification time
  • r.extime - time of expiration
  • r.title - Article title
  • name - Name of the author
  • username - User name od the author
  • r.hits - Article views
  • r.comments - Number of comments
  • r.favorite_num - Number of bookmarks
  • r.votes_result - Rating

If your URL is SEF like http://domain.com/list then you can use ?

http://domain.com/list?filter_order=r.title&filter_order_Dir=asc

Link for filters

What if you what to create link in menu (or anywhere else), that can automatically set search filters you want for articles list? For example: Events for the next 14 days with location 20 miles within the London. You can easily do it with new JoomCCK filter interface.

1 - Create URL After dramatic recoding all filtering mechanism, we ended up with filter interface to which you can communicate through special URL.

http://www.mywebsite.com/index.php?option=com_joomcck&task=records.filter&...

Here are all parameters that you can add to this URL.

Parameter Req. Description
section_id Yes  Set section ID
Itemid Yes  Menu Itemid. Please set Itemid of menu that you set in section itemid parameter
cat_id No Category ID if you want to filter in particular category only
filter_name Yes Array of the name of the filters. Explained later.
filter_val  Yes Array of the values of the filters. Explained later.

After user click URL, filters will be set and user will be redirected to standard articles list URL. That is why we need section ID, Itemid and category ID. To land user to correct page. So please do not forget to set those parameters correctly.

2 - Reset and Set Filters If you want to reset all filters before you set new one, add to URL &clean=1

http://www.mywebsite.com/index.php?option=com_joomcck&task=records.filter&clean=1&...

Otherwise filters will be added to curently applied filters.

3 - Set Filters filter_val and filter_name are arrays that set filters. You can add as many of them as you want. Here is the example.

&filter_name[0]=filter_tag&filter_val[0]=2

This is to show all articles with tag ID 2.

Standard Fields:

This table show you list of available standard filter_name and their filter_val.

Filter name Filter value Description
filter_tpl default Name of the article list template. If you want to use settings of the template you have to include filter configuration key. Somethign like default.b604f5fb1ca89b8be2706881a530680f. how you can get this key? Just look temmplate select source code in section edit page.
filter_cat 2 ID of the category
filter_user 42 ID of the user
filter_tag 2 ID of the tag
filter_type 1 ID of the content type
filter_search what is life Search string

Here is an example. It should be one line. I have formatted it just to make it more readable.

http://www.mywebsite.com/index.php?option=com_joomcck&task=records.filter&section_id=2&Itemid=126&filter_name[0]=filter_type&filter_val[0]=2&filter_name[1]=filter_user&filter_val[1]=42

This example will show all records of User Super Admin (ID 42) and content type ID 2.

Fields Filter:

First you have to form filter name. It contains of prefix filter_ and field key. So filter name may looks like this

&filter_name[0]=filter_k2hgsd5FdK79H6Gfdt6hxnsgF55fd

Then, you have to set filter value. And it may be very different for every field but basically only 2 types. Single value may looks like this

&filter_val[0]=value%201

Values have to be url encoded. You can see %20 means whitespace.

Or values may be an array

&filter_val[0][]=value%201&filter_val[0][]=value%202

In this case it will look for records that contain Value 1 OR Value 2

Sometimes it is important to identify array keys like for example for geo field.

&filter_val[0][lat]=41.25458745&filter_val[0][lng]=21.2654789

or date range

filter_val[0][range]=2014-09-01,2014-09-30

But that is very exclusive. Only Geo and DateTime fields. For data time first set is a data from and second date to

If you use boolean field then filter value is true OR false

&filter_val[0]=true

How to reset filters through link

Sometimes you need to reset all filters by URL or single filter.

Reset all filters

index.php?option=com_joomcck&task=records.cleanall&section_id=2&Itemid=123

Reset individual filter

index.php?option=com_joomcck&task=records.clean&clean[filter_k58596481bc7070e4adecd4f2e29569de]=1&section_id=2&Itemid=123

There are few parameters to insert to clean variable

Filter Type Description
filter_search Reset text search
filter_type Reset content type filter
filter_tag Reset tags filter
filter_user Reset user filter
filter_alpha Reset alpha index filter
filter_cat Reset category filter
filter_[key] This is to clean field filter. You have to change [key] to field key like it is in example above.

You may reset few filters at once

index.php?option=com_joomcck&task=records.clean&clean[filter_k58596481bc7070e4adecd4f2e29569de]=1&clean[filter_type]=1&clean[filter_alpha]=1&section_id=2&Itemid=123

What is a field key?

Field Key now is the part of multi type support in templates. Field key is and MD5 of field type and label.

$field_key = 'k'.md5($field->label.'-'.$field->field_type);

Lets, say field label is Year and field type id digits. Then

$field_key = 'k'.md5('Year-digits');

You can find keys in the DB column key in #__js_res_fields table or in the key column in fields manager


Create category menu item

One of the common question is how to create links in menu that reference not to section root but to category. First I’ll explain you how and then I explain why.

  • Create Joomla menu element to JoomCCK section.
  • Navigate to that section.
  • Click on category you want to add to menu.
  • Copy this category URL.
  • Add new Joomla menu element and chose External URL.
  • Enter name, paste copied link and save menu.

Q: Why cannot we just create JoomCCK category Joomla menu element and select category in menu element parameters?

It is simple. It is all about Itemid. If you do not know what it is, then just trust us on this matter and be sure what we are suggesting is the best option. And if you know what is Itemid, you also know all problems connected to it.


Automatic articles checking

It is often happens that users do not close their articles properly after edit. And others (moderators and admins) cannot edit those articles. There is a special cron task which you can use. It will check in all articles that are checked out for more than 30 minuts.

It makes sense to configure to run command at least once a 30 minuts.

You can use curl or wget command. For example.

wget http://[site name]/index.php?option=comjoomcck&task=cron.checkIn&secret=123456

Where [site name] is the root of your Joomla instance and secret is the secret word you set in JoomCCK global configuration.


Send email alerts

Sending email alerts immediately by default is not a good practice for 2 reasons.

First Practice

People don’t like it. Especially if you have an active site, a user can receive dozens of emails daily your IP address can easily get into spammers lists and be blocked.

That’s why every user in JoomCCK has a choice to turn off email notification regardless of your section settings. Every user can choose to receive email alerts daily, weekly or monthly or to not receive any email alert at all.

It is important to provide subscribers an opt-out to stop receiving emails. Your notifications won’t be flagged as spam if they have an unsubscribe instruction at the bottom of the email. To prevent you for being blacklisted, this instruction is included automatically.

Second Practice

There may be thousands of emails generated at each click, which will negatively affect your site’s performance. Example: You post a comment to an article. Let us assume that 1000 users are subscribed/following this article. Then before getting to the next page, you will have to wait until 1000 notification emails are sent. This can severely slow down you site.

You have to configure a cron job in order to send email alerts.

The command that you can use is this.

wget http://[site name]/index.php?option=com_joomcck&task=cron.sendAlert&secret=123456

Sometimes wget command is not accessible or not installed. In this case you might want to use curl or lynx instead. Here are some examples.

lynx -source http://[site name]/index.php?option=com_joomcck&task=cron.sendAlert&secret=123456

curl -c --url "http://[site name]/index.php?option=com_joomcck&task=cron.sendAlert&secret=123456"

curl -A "joomcckcron" "http://[site name]/index.php?option=com_joomcck&task=cron.sendAlert&secret=123456"

Where [site name] is the root of your Joomla instance and secret is the secret word you set in JoomCCK global configuration.

Please don’t configure this cron task to be executed less then once per 5 minutes for immediate alerts. JoomCCK will automatically determine what to sent, immediate alerts or weekly once.