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.


[v9] main_forum_topics modification/change

Login / Search

 [ Join | More ]
 Add topic 
Posted
Item has a rating of 5 (Liked by Chris GrahamLiked by BobSLiked by kennoLiked by JeanLiked by KingBast)  
Rating:
#90049 (In Topic #18231)
Avatar

Community saint

On my forum I like to have a block in the main zone that shows 'new posts' a bit more compact than the standard main_forum_topics block does.   I had this in v7, and just  put it back in v9.

So this is the block:  



To me, this looks neater, and more concise.   And when a user clicks on the thread name, it takes them to the last post they read in the thread rather than the first post. 

In global.css the following has to be added back in, it appears to have been removed in the v9 file:

global.css additions

.variable_table {
table-layout: auto !important;
}
 
.variable_table img {
vertical-align: middle;

}



Paul
Back to the top
 
Posted
Rating:
#90050
Avatar

Community saint

Ok, there is, of course modifications to main_forum_topics.php, and I added two template files as well.

Now I can't see how to attach files to just attach them.   Hmm.

Anyone know how to do that?


I'd like to see this block added as a new standard block in OCP that people can use,  be it main_forum_latest_topics or whatever.


Paul
Back to the top
 
Posted
Rating:
#90056
Avatar

Community saint

Man, I feel like a moron, I totally forgot the attachments thing was just a bit down the page.  Ugh. 

Attachment
modified php file
» Download: main_forum_topics.php (7 Kb, 187 downloads so far)
Attachment
tpl files
» Download: BLOCK_MAIN_FORUM_TOPICS.tpl (402 Bytes, 191 downloads so far)
Attachment
» Download: BLOCK_MAIN_FORUM_TOPICS_TOPIC.tpl (539 Bytes, 189 downloads so far)

Paul
Back to the top
 
Posted
Rating:
#90068
Avatar

Cool :). Btw, variable_table was renamed autosized_table in the CSS.


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:
#90075
Avatar

Community saint

Ah, so everyone ignore my addition of variable_table in global.css and just modify one of the tpl files to use autosize_table instead.   ;)

Paul
Back to the top
 
Posted
Rating:
#90105
Avatar

Community saint

Arbo said

Ah, so everyone ignore my addition of variable_table in global.css and just modify one of the tpl files to use autosize_table instead.   ;)

Can you give me a preview how to do that and where?

Harry


http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#90106
Avatar

Community saint

Yes, in BLOCK_MAIN_FORUM_TOPICS.tpl, just replace variable_table with autosized_table.

the two tpl files should be in themes/nameofyourtheme/templates_custom

the modified main_forum_topics.php should be in sources_custom/blocks

only those three files are needed.


I will reattach, with the change in the tpl file mentioned in the first line.

Attachment
» Download: BLOCK_MAIN_FORUM_TOPICS_TOPIC.tpl (539 Bytes, 206 downloads so far)
Attachment
» Download: BLOCK_MAIN_FORUM_TOPICS.tpl (403 Bytes, 186 downloads so far)
Attachment
» Download: main_forum_topics.php (7 Kb, 201 downloads so far)

Paul
Back to the top
 
Posted
Rating:
#90107
Avatar

Community saint

Thanks Paul, I will try out this one.


http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#90108
Avatar

Community saint

Works perfect Paul thanks!!


http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#90114
Avatar

Community saint

No problem.  Which one of your sites is it on?  Just so I can get the thrill of seeing it used elsewhere.  ;)

Paul
Back to the top
 
Posted
Rating:
#90115
Avatar

Community saint

look at Een blik op de wereld rond om - Digiflash  use one of the clubs they use it all.


http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#94352
Avatar

Community saint

Hoi Arbo,
after upgrade to 9.0.4 some time ago i get this error when i change something to the page where your modification is set to:

A parameter, TOPIC_URL, is referenced in the template, BLOCK_MAIN_FORUM_TOPICS_TOPIC, but not passed

How to make this gone?
If I refresh the page its gone…

Harry


http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#94353
Avatar

Well-settled

Hello

I am trying to use this on a 9.04 site and although it shows and appears to work fine, there is an error message at the very top of the home page where I have placed it as soon as you save, which does disappear until re-adding the block again

"A parameter, TOPIC_URL, is referenced in the template, BLOCK_MAIN_FORUM_TOPICS_TOPIC, but not passed"

Is this something I have missed, I have only added the files in the relevant places as advised
Back to the top
 
Posted
Rating:
#94354
Avatar

Community saint

This is the same error I have. Hope that Arbo will respond to this.


http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#94549
Avatar

Community saint

Sorry, have been away from ocp for a long time now.   This is interesting because that tpl file does not reference a variable called 'TOPIC_URL' at all…

in the php file main_forum_topics, try to change :

Code (php)

                                $out->attach(do_template('BLOCK_MAIN_FORUM_TOPICS_TOPIC',array('_GUID'=>'ae4e351b3fa5422bf8ecdfb7e49076d1','FORUM_ID'=>is_null($forum_names_map)?NULL:strval($topic['forum_id']),'FORUM_NAME'=>$forum_name,'TOPIC_LINK'=>$topic_link,'TITLE'=>$title,'DATE'=>$date,'DATE_RAW'=>strval($topic[$date_key]),'USERNAME'=>$username,'MEMBER_ID'=>is_null($member_id)?'':strval($member_id),'NUM_POSTS'=>integer_format($topic['num']))));

Code (php)

                                        $out->attach(do_template('BLOCK_MAIN_FORUM_TOPICS_TOPIC',array('_GUID'=>'ae4e351b3fa5422bf8ecdfb7e49076d1','FORUM_ID'=>is_null($forum_names_map)?NULL:strval($topic['forum_id']),'FORUM_NAME'=>$forum_name,'TOPIC_LINK'=>$topic_link,'TITLE'=>$title,'DATE'=>$date,'DATE_RAW'=>strval($topic[$date_key]),'USERNAME'=>$username,'MEMBER_ID'=>is_null($member_id)?'':strval($member_id),'NUM_POSTS'=>integer_format($topic['num']),'TOPIC_URL'=>'')));

That way it will pass an empty variable…  so it should clear the error.   But if it does, it makes me wonder why it says it's requesting something that it's not requesting.

Paul
Back to the top
 
Posted
Rating:
#94551
Avatar

Community saint

Hi Arbo, after the change from you, this is the result after editing the page with the forum block in it.



http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#94559
Avatar

Community saint

Isn't that the same thing it had before?

I don't understand, topic_url isn't in the tpl file at all… perhaps one of the developers could give us an idea what is going on.

Paul
Back to the top
 
Posted
Rating:
#94561
Avatar

Arbo's change should have worked, but the issue here is TOPIC_LINK was renamed to TOPIC_URL in v9.
Generally across many templates we harmonised/perfected sloppy terminology, LINK->URL was one of those cases.


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:
#94565
Avatar

Community saint

oke thanks Chris for the explanation to this. Its not a big problem. After refresh the page its gone. So only after editing the page who has that block on it will give this error after saving, nothing more.


http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#94566
Avatar

Community saint

Thanks Chris.

So it seems the 'fix' would be to change TOPIC_LINK in the tpl files and in the php file to TOPIC_URL.

Does that sound right?

Paul
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Expand