Giorgi625 VIP
Total posts: 655
20 Mar 2018 09:29

I was just working on templates for blog and decided to make multiple types because I need to assign different points to author per type. Some records will be about news and there will be enought to write 200-300 sympols, while others will be like test or reviews where user needs to write at least 1000 symbols.

Also I wanted to let users easily understand which records belong to which type on list view using images. Helix template uses this feature very good. Click here to link... As you can see in front of title there is icon which shows what type or record is this.

Unfortunately I was not able to find this feature in Cobalt. I know about type filter icon, but it is not good solution for me. If there is any solution please let me know. If not, it will be good if in Cobalt 9 it will be added. I thinks this is good feature.

Thanks.

Last Modified: 04 Apr 2018


pepperstreet VIP
Total posts: 3,837
21 Mar 2018 04:08

Giorgi625 Also I wanted to let users easily understand which records belong to which type on list view using images. Helix template uses this feature very good. Click here to link... As you can see in front of title there is icon which shows what type or record is this.

Hello, do you want the author to choose an image/icon?
Or do you want an automatic image/icon for each type?


The latter one can be achieved through record's type_id.

<?php echo $item->type_id;?>

Just use the type's ID number in your custom template to build a unique CSS CLASS or an IMAGE FILE NAME.
(See similar concept for marking new records in this topic)


Giorgi625 VIP
Total posts: 655
21 Mar 2018 07:49

Images must be set for each type by default so second solution is better, but it can be used only in current situation. So if I want to use same template on another site I will need to edit template for each site right?


I got an idea just now. I can create image field in all types used in that template and select for each field needed icon as default image and disable that field in submit form.

I think it is beter if I need to share template with person who is not a programmer. Right?


pepperstreet VIP
Total posts: 3,837
22 Mar 2018 00:56

Giorgi625 if I want to use same template on another site I will need to edit template for each site right?>

It depends on your implementation.
If everything is CSS based, it is lite and flexible. You might create "graphical symbols" out of the leading letter and a certain color combo. For instance the "N" from "news". The type_name should be available to you.
For a single language, the CSS property "content" could be used as well.

If image files are involved, defaults could be overridden.

Giorgi625 I can create image field in all types used in that template and select for each field needed icon as default image and disable that field in submit form.

Technically it is the wrong solution. The image values are stored for each record. I remember, I did it the same way back in the "Mighty Resources" days ;) Bad idea :D

You actually need only 1 parameter/data-flag for the type. The type_id is perfect, but has no visual representation.
It would require an extra image parameter in type settings to make it "configurable".


You might also create template parameters, that allow to assign the type_ID to a certain image.
See "Multiple Ratings" param as an example. This is only one way of many…


Sergey
Total posts: 13,748
04 Apr 2018 06:53

It is easy to add in template

<img src="/images/types/<?php
if ($item->type_id == 2) 
    echo "pin.png";
elseif ($item->type_id == 3) 
    echo "note.png";
?>" />
Powered by Cobalt