HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Tracing how OCP works - a little help please

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#94616 (In Topic #18858)
Avatar

Community saint

Hi,

So as I move deeper into customising OCP I am starting to change templates to suit our needs. At the moment I understand what I am doing in the context of a simple template - but I need (and want) to understand more !

I would like to add some custom and none custom fields to the Profile box that is shown next to each erpson OCF forum post. These fields would be defined against a members profile.

(1) I used the "Show Template Edit Links" to get a feel and find an entry point for the template involved.
(2) That took me to OCF_TOPIC_POST.tpl and I can see exactly where the Avatar, Poster Title and Rank Images are created.
(3) Ok all good so far :-)
(4) There are some passed in links of {POSTER}, {POST_AVATAR}, {POSTER_TITLE*} and {RANK_IMAGES}. I decided that these must get passed in somewhere up the template tree, so I used the "Template Tree" view to understand the hierarchy - like this:
(mixed)
    GLOBAL_HTML_WRAP  
        OCF_TOPIC_SCREEN  
        SCREEN_TITLE  
        (mixed)
            OCF_USER_MEMBER  
                COMMENTS_POSTING_FORM  
                    (mixed)
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                        EMOTICON_CLICK_CODE  
                    (mixed)
                        HYPERLINK  
                        BREADCRUMB_SEPARATOR  
                        HYPERLINK  
                    (mixed)
                        SCREEN_BUTTON  
                        SCREEN_BUTTON  
                        SCREEN_BUTTON  
                        SCREEN_BUTTON  
                    (mixed)
                        OCF_TOPIC_POST  
                            OCF_POSTER_MEMBER  
                                OCF_MEMBER_BOX  
                                    (mixed)
                                        OCF_MEMBER_BOX_CUSTO
M_FIELD  
                                        OCF_MEMBER_BOX_CUSTO
M_FIELD
                                         etc

(5) However it did not matter how far I went up the tree I could never find where the links like {POSTER} are passed in - can anyone enlighten me where I should look ?
(6) What does it mean what a passed in variable has an asterix on it like {POSTER_TITLE*}.

I guess that this is basic stuff - but I just cannot find the answer that I require !

Any help greatly appreciated.

Cheers
Ade
Back to the top
 
Posted
Item has a rating of 5 (Liked by FletchLiked by Jean)  
Rating:
#94617
Avatar

Community saint

Parameters are passed in from php code not templates, so once you identify the template you need to search the php files for the template name without the .tpl, and you will see references like do_template('OCF_TOPIC_POST',…, followed by all the parameters that are passed to the template, like so:

Code

         $posts->attach(do_template('OCF_TOPIC_POST',array(
                  '_GUID'=>'sacd09wekfofpw2f',
                  'ID'=>strval($_postdetails['id']),
                  'TOPIC_FIRST_POST_ID'=>is_null($topic_info['first_post_id'])?'':strval($topic_info['first_post_id']),
                  'TOPIC_FIRST_POSTER'=>is_null($topic_info['first_poster'])?'':strval($topic_info['first_poster']),
                  'POST_ID'=>strval($_postdetails['id']),
                  'URL'=>$post_url,
                  'CLASS'=>$_postdetails['is_emphasised']?'ocf_post_emphasis':(array_key_exists('intended_solely_for',$_postdetails)?'ocf_post_personal':''),
                  'EMPHASIS'=>$emphasis,
                  'FIRST_UNREAD'=>$first_unread,
                  'POSTER_TITLE'=>$_postdetails['poster_title'],
                  'POST_TITLE'=>$post_title,
                  'POST_DATE_RAW'=>strval($_postdetails['time']),
                  'POST_DATE'=>$_postdetails['time_string'],
                  'POST'=>$_postdetails['post'],
                  'TOPIC_ID'=>is_null($id)?'':strval($id),
                  'LAST_EDITED_RAW'=>$last_edited_raw,
                  'LAST_EDITED'=>$last_edited,
                  'POSTER_ID'=>strval($_postdetails['poster']),
                  'POSTER'=>$poster,
                  'POSTER_DETAILS'=>$poster_details,
                  'POST_AVATAR'=>$post_avatar,
                  'RANK_IMAGES'=>$rank_images,
                  'BUTTONS'=>$buttons,
                  'SIGNATURE'=>$signature,
                  'UNVALIDATED'=>$unvalidated,
                  'DESCRIPTION'=>$description,
         )));
As for the *, it means that the content will be escaped so that it renders correctly in HTML. See ocPortal Tutorial: Tempcode programming - ocPortal.com

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#94647
Avatar

Community saint

Just to point out (and I am sure you probably know this and want to do something different but) you can add extra profile fields to a users profile without using template edits via your admin panel under Tools->Members->Custom Profile Fields
Back to the top
 
Posted
Rating:
#94656
Avatar

Community saint

Thanks for the replies guys.

I have added some custom profile fields Duck, but I cannot get them to display in the members profile on the side of the forum posts as per this setting when editing a custom profile field:

"Show with content - Whether the value of this field will be shown with member content (currently next to posts on the forum, and also from within personal-galleries)."

This box is ticked but nothing ever shows in the profile box next to a forum post.

Any ideas ?

Cheers
Ade
Back to the top
 
Posted
Rating:
#94658
Avatar

Seems to work when I test, although there's no profile box (by default) on the threaded view. Could that be it?

Also, is the CPF set as public?


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#94660
Avatar

Community saint

Hi Chris,

Not using the threaded view.

The CPF is public.

I have a CPF called "UK & Ireland Primary Region:"

My profile has this set to "Staffordshire" - it is a publically viewable field.

If you go to a post of mine:http://vwgolfmk1.org.uk/forum/index.php?page=topicview&id=website-issues_2%2Fa-few-tweaks-for-mobile

You can see that "Staffordshire" does not appear in my profile aera at the side of the forum post.

Am I missing something ?
Back to the top
 
Posted
Rating:
#94662
Avatar

Well-settled

Ade

I don`t think ocPortal does this out of the box, I think it requires modding like this to get what you want

Adding CPF's (and other data) below users avatar in posts - ocPortal.com
Back to the top
 
Posted
Rating:
#94664
Avatar

Right yes, misunderstanding I think -- it is there, but under the username tooltip. OCF goes for a more lightweight display than some other forums do.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#94665
Avatar

Community saint

Cheers Mark !!

Chris - woods for the trees and all that - thanks for pointing that out - lol
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: