justanotherguy
Total posts: 88
27 Март 2014 22:21

There is probably a way to do this in Cobalt's many features. Any help how to achieve would be great. I would like to show the ID of a record in the record list - simple list template. Thank you in advance.

Последние изменения: 01 Апр 2014


pepperstreet VIP
Total posts: 3,837
28 Март 2014 01:16

Welcome to the world of Cobalt! ;-)

This template? default_list_simple_list.php

You may copy it in Cobalt templates manager. Then search for the 2 occurrences of the record title. They are around line 80. The first one outputs a title + link, the second is text only...

<?php echo $item->title?>

I guess, the following line should give you the raw record ID:

<?php echo $item->id?>

Place it to your liking and add some HTML formatting. You may place it directly in front of the title output and add a SPAN for easy styling etc. Example without link on title:

<span class="myRecordId"> <?php echo $item->id?> </span> <?php echo $item->title?>

Hope this helps.


justanotherguy
Total posts: 88
28 Март 2014 15:16

pepperstreet Welcome to the world of Cobalt! ;-)

Thank you! I will give this a try now. This would be a handy Yes/No Option to go with all the rest.

w1


justanotherguy
Total posts: 88
28 Март 2014 15:57

pepperstreet <span class="myRecordId"> <?php echo $item->id?> </span> <?php echo $item->title?>

Hope this helps.

Worked perfect! Thank You @pepperstreet


pepperstreet VIP
Total posts: 3,837
28 Март 2014 18:49

justanotherguy Worked perfect! Thank You @pepperstreet

You are welcome! Great it worked out for you.

justanotherguy This would be a handy Yes/No Option to go with all the rest.>

Not sure about it, because the real DB recordID is of no use for the majority of users. Most likely it is an internal number that does not have a meaning for visiters and frontend display.

(maybe as a sort of reference-# that is important for user submissions/purchase. May I ask you what is your purpose and application?)


justanotherguy
Total posts: 88
01 Апр 2014 18:56

I built a frontend talent database. To respect privacy we do not want our members to see others last names of other members. So we needed a way to have an identifier that would be unique to each user and also provide privacy to our talent. An example would be if we have 2 talent named Mike we needed a way to have users on the frontend tell one Mike from the other. The solution for us is to use the id of their record. So other users would see Mike141 and Mike38.

The username field could also be used but many times the users put FirstInitialLastName as their username. So it would be MBradley and it would be very easy to deduce the person is Mike Bradley.

In the end it would be a reference number that would not be duplicated that could be used in many applications like you note for submission/ purchase among others.


pepperstreet VIP
Total posts: 3,837
01 Апр 2014 23:54

justanotherguy The username field could also be used but many times the users put FirstInitialLastName as their username. So it would be MBradley and it would be very easy to deduce the person is Mike Bradley.

Yep, makes absolutely sense.

Thanks for giving some insights and reason for your application. Good luck and success with your site!

Работает на Cobalt