QUICK NEWS

{NEW} - A new css video is up.

{OLD} - New video courtesy of Skhilled, Thanks for posting it up.

Video of the moment:


Internal Links

SMF Sites

Quick Info

Add Message

Started by Ronald, Jul 04, 2020, 05:08 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Ronald

I would like to add a message in a certain spot. See image and let me know how to put a message in that location.

You cannot view this attachment.

Sorry but there are no mod's for this..

Try this, replace

if ($context['description'] != '' || !empty($context['moderators']))

with

$politicalBoards = array(1, 1, 1, 1);
if (in_array($context['current_board'], $politicalBoards))
echo '
    <div class="noticebox">Notice Text</div>';

if ($context['description'] != '' || !empty($context['moderators']))

fill politicalBoards array with your own board ids

Horme Gaming

on every board or on specific boards?

Ronald

Quote from: Deaks on Jul 04, 2020, 05:32 PMon every board or on specific boards?


I am redoing the Political boards. So I want the same message in every Political forum plus all the sub forums.

Horme Gaming

you would need to modify messageindex.template.php, and use if command like

$which_boards = array(1,2,3);

simply whats is suggested in this VERY VERY Old topic:

https://www.simplemachines.org/community/index.php?topic=117088.msg748380#msg748380

Ronald

// Finally the most important bit - the actual text box to write in!

This is in the old posting on support. Is this what I'm looking for in the files.

Here is my file, cn you see the location, because I can't see it..Probably different on smf 2.1

You cannot view this attachment.

Horme Gaming

quick glance maybe try
look for:
</div>';

echo '
<div class="pagesection">

change to

</div>';

$which_boards = array(1,2,3);
{
echo'
<div>Your Text Here</div>';
}
echo'

I will not say this will work as im half asleep also never tested it

Ronald

Sorry doesn't work. unless I'm getting the page number wrong. Page mumber is 202.0

SychO

#7
Try this, replace

if ($context['description'] != '' || !empty($context['moderators']))

with

$politicalBoards = array(1, 1, 1, 1);
if (in_array($context['current_board'], $politicalBoards))
echo '
    <div class="noticebox">Notice Text</div>';

if ($context['description'] != '' || !empty($context['moderators']))

fill politicalBoards array with your own board ids

Ronald

Thanks. I does work the way it sits.

But when I remove Notice Text, and put my own message in
QuoteThis is a political forum that is non-biased/non-partisan and treats every persons position on topics equally. This debate forum is not aligned to any political party.
In today's politics, many ideas are split between and even within all the political parties. Often we find ourselves agreeing on one platform but some topics break our mold.

It stops and gives my a blank page

SychO

That's because in your text, you need to replace any single quotes with: anti-slash + single quote

so for example: today's politics becomes today\'s politics

Ronald

Here is the original code from where I got the message from.

   <li class="navbit lastnavbit"><span itemprop="title">Europe</span></li>

   </ul>
   

</div>

 
 


   <form action="https://www.debatepolitics.com/profile.php?do=dismissnotice" method="post" id="notices" class="notices">
      <input type="hidden" name="do" value="dismissnotice" />
      <input type="hidden" name="s" value="" />
      <input type="hidden" name="securitytoken" value="guest" />
      <input type="hidden" id="dismiss_notice_hidden" name="dismiss_noticeid" value="" />
      <input type="hidden" name="url" value="" />
      <ol>
         <li class="restore" id="navbar_notice_1">
   
   This is a political forum that is non-biased/non-partisan and treats every persons position on topics equally. This debate forum is not aligned to any political party. In today's politics, many ideas are  split between and even within all the political parties. Often we find ourselves agreeing on one platform but some topics break our mold. We are here to discuss them in a civil political debate. If this is your first visit to our political forums, be sure to check out the FAQ and RULES. Registering for debate politics is necessary before posting. Register today to participate and remove the ads  - it's free!
</li>
      </ol>
   </form>

Ronald

Quote from: SychO on Jul 05, 2020, 08:24 AMThat's because in your text, you need to replace any single quotes with: anti-slash + single quote

so for example: today's politics becomes today\'s politics

Thanks it worked fine..

lurkalot

@Ronald  Just curious, and I realise you have now solved this.  Are you running a portal mod on that site? I had a feeling you were. I only ask because you should be able to add that message in a block on a given board, unless the portal mod doesn't have that feature.

Ronald

Quote from: lurkalot on Jul 16, 2020, 02:10 AM@Ronald  Just curious, and I realise you have now solved this.  Are you running a portal mod on that site? I had a feeling you were. I only ask because you should be able to add that message in a block on a given board, unless the portal mod doesn't have that feature.

Yea running EH Portal, I only use one block. I never set the portal up as a page, just for one block. Never realized you could set up blocks to show on certain pages.. I don't know that much about them..

What I did does seem to fit right in, it's on top of the Topic page as soon as you open it..

Ronald

Lurk, I tried doing how you said, it does work, but doesn't show how I wanted it..