Recen topics with variables for specific boards

Started by Goten22, August 27, 2015, 04:00:18 PM

Previous topic - Next topic

Goten22

I'm looking for some way to expand/merge those two scripts:
http://simpleportal.net/index.php?topic=1621.0 - recent topics with exclude boards
http://simpleportal.net/index.php?topic=2132.0 - recent topics with include

But i want to introduce some extra things for topics from secific boards. For example:

I want to add specific images for specific boards. I will appreciate any help, thanks

Kindred

where is the image coming from?  Is the image defined BY BOARD? (e.g. board1 would get image 1 and board 2 would get image 2, etc?)

If so, that is simple....

(and, as far as I can tell, there is no need for all those direct code edits mentioned in those simpleportal posts...)

plain code block for simpleportal


<?php
$new_topics
=ssi_recentTopics(10nullnull'array');

foreach (
$new_topics as $topic) {
   echo 
'
   <div class="topic_list">
      <div class="topic_image"><img src="url/to/image/image' 
$topic['board']['id'] . '.png" alt="' $topic['board']['name'] . '"/>
      <div class="topic_details">' 
$topic['link'] . ' &mdash; ' $topic['poster']['link'] . ' &#38;#124; Comments:  ' $topic['replies'] . ' </div>
   </div>'
;
}
?>


remember, recent topics HAS exclude and include built in
ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo');

Then, you just define the CSS for the topic_list, topic_image and topic_details CSS
(someone else can make specific suggestions on that - I am not that good with css - but I would suggest using a css table )

(do note, I built the above quickly. I make no guarantee about the specific accuracy of the code and have not tested it...  but you should get the general idea and be able to find any mistakes when you put it in a block)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Goten22

Thank you.
Almost what i want. But i would like to have it coded with "if" variable so i could define image only for few specific boards and rest will be default. Now i must make images for every board.

Something like:
if(boardid=3){
<div class="topic_details_board3">' . $topic['link'] . ' &mdash; ' . $topic['poster']['link'] . ' &#38;#124; Comments:  ' . $topic['replies'] . ' </div>
} else {
<div class="topic_details">' . $topic['link'] . ' &mdash; ' . $topic['poster']['link'] . ' &#38;#124; Comments:  ' . $topic['replies'] . ' </div>
}

Goten22

Or there's a chance to avoid this by setting specific images for every topic in specific board and disable option for choosing it by user. How can I do this?

I mean this images:

http://i.imgur.com/z1yFyvR.jpg

Goten22

Sorry for this third in a row but i think i figured it out.

It goes like this:
<?php
$new_topics
=ssi_recentTopics(10nullnull'array');

$board_ukonczone=3;
$board_wip=1;

foreach (
$new_topics as $topic) {

if(
$topic['board']['id']==$board_ukonczone){
echo

      <div class="topic_list"><a href="" class="d_block">3D</a> ' 
$topic['link'] . ' &mdash; ' $topic['poster']['link'] . ' | Comments:  ' $topic['replies'] . ' </div>';

} elseif(
$topic['board']['id']==$board_wip){
echo

      <div class="topic_list"><a href="" class="d_block">WIP</a> ' 
$topic['link'] . ' &mdash; ' $topic['poster']['link'] . ' | Comments:  ' $topic['replies'] . ' </div>';


} else{
echo
'
      <div class="topic_list"><img src="/Themes/flatline/images/post/xx.gif" alt="' 
$topic['board']['name'] . '"/>' $topic['link'] . ' &mdash; ' $topic['poster']['link'] . ' | Comments:  ' $topic['replies'] . ' </div>';

}
}


Thanks again. :)

Kindred

glad you got it solved.... 

Although, you should be using an HTML entity for the vertical pipe...

and, I'm not sure the point of defining the two boardIDs as variables and then just using them...   why not just use them directly as numbers?

Third note...   the null and null in the ssi_recentTopics are for exclude and include (make an array of the board to exclude or include)...

fourth note....hrmmmm... it looks like they are using the same class for each, and thus would be using the same image...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: