News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

News and Newsletters position

Started by FredT, June 09, 2022, 08:40:30 AM

Previous topic - Next topic

FredT

Using smf 2.1.2:

I am not the absolut PHP pro Guru but I tried alot to move my News/Newsletter postion now many time in my index.template.php

Whatever I do, I can only get it to where it is atm. When I try to position it higher on the top/ or header of the forum it will come up with a blank page.

What I am doing wrong and how can I move the container up there?

Please see screenshot.

Thank you so much

Kindred

Well, primarily because you need to adjust CSS as well as php (maybe just CSS instead of php)

the other thing, of course is that, within a php/html file, you can't just randomly move code.  That's the cause of your white page of death....
Сл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."

Antechinus

Quote from: Kindred on June 09, 2022, 04:03:43 PMWell, primarily because you need to adjust CSS as well as php (maybe just CSS instead of php)
No. You could not do this just with CSS changes. It would require template changes too.

Quote from: FredT on June 09, 2022, 08:40:30 AMWhat I am doing wrong and how can I move the container up there?
Your problem is likely due to PHP syntax errors. This is the part you need to move:
// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']) && !empty($context['random_news_line']))
echo '
<div class="news">
<h2>', $txt['news'], ': </h2>
<p>', $context['random_news_line'], '</p>
</div>';
You need to move exactly that. No more, and no less.
If you want it to end up between the forum title (at the left) and the forum slogan (at the right) you would do it like this:
echo '
<div id="header">
<h1 class="forumtitle">
<a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name_html_safe'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a>
</h1>';

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']) && !empty($context['random_news_line']))
echo '
<div class="news">
<h2>', $txt['news'], ': </h2>
<p>', $context['random_news_line'], '</p>
</div>';

echo '
', empty($settings['site_slogan']) ? '<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.svg" alt="Simple Machines Forum" title="Simple Machines Forum">' : '<div id="siteslogan">' . $settings['site_slogan'] . '</div>', '';
You would then adjust the CSS to give the exact look you want.

FredT

Thank you so much. I will dig more in and check and move the code like Antechinus recommended. This looks promissing, I think I also graped the wrong code.

FredT

No. Does not move the news up there. Instead of my "S" Logo it moves the original simple machines forum logo up there what is do to

<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.svg" alt="Simple Machines Forum" title="Simple Machines Forum">

But nothing else moves. The news remains under the title "S Forum Test"

Antechinus

Aha. You are not trying to move the news lines. You are trying to move the news fader. Ok, different file, and a more complex problem. I'll sort code for that later, when I have more time.

FredT

Correct Antechinus. I tried to move the whole block/container for news up there. The news message should be up there then and also moving to the next news, when there are more as one news messages.

Advertisement: