How could I insert a forum description similar to this:

(http://www.imagehosting.com)
This was done by simply adding a line break (<br />) in the Forum title field in the ACP's Server Settings but I would like to add that description under the title using a smaller font and maybe use a different color and style (italic).
This might mean modifying the index template to add another table division which would hold the description, either hard coded along with the text formatting or done properly according to SMF's Mod guidelines (if you wish to turn it into a Mod) with a CSS class.
Index template code (core theme) which would need to be modified:
echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' : '', '>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="catbg" height="32">';
if (empty($settings['header_logo_url']))
echo '
<span class="forumname">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '
</td>
<td align="right" class="catbg">
<img src="', $settings['images_url'], '/smflogo.gif" style="margin: 4px;" border="1px" alt="" />
</td>Any ideas?
Cheers,
Gene
Hmm, no one knows where and how I should hard code my text in the above post's code? Being that it's only for one forum, hard coding the description would be the easiest way to go.
Cheers,
Gene
you would need to add a new table where you have
if (empty($settings['header_logo_url']))
echo '
<span class="forumname">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '
so simple would be adding after the <td>
<table>
<tr><td>if (empty($settings['header_logo_url']))
echo '
<span class="forumname">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '</td></tr>
<tr><td>
Would like description here!!!
</td></tr>
</table>
I have omitted syling from this table so you can add your own
Thanks Runick,
Tried the above but I get parse errors...
Cheers,
Gene
oops i forgot to check, i typed this at work
<table>
<tr><td>';
if (empty($settings['header_logo_url']))
echo '
<span class="forumname">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '</td></tr>
<tr><td>
Would like description here!!!
</td></tr>
</table>
Try that :)
Thanks, tried it and still getting errors with <table>
Parse error: syntax error, unexpected '<' in .../Themes/default/index.template.php on line 178
Here's the code:
<body>';
echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' : '', '>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="catbg" height="32">';
<table>
<tr><td>';
if (empty($settings['header_logo_url']))
echo '
<span class="forumname">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '</td></tr>
<tr><td>
Would like description here!!!
</td></tr>
</table>
echo '
</td>
<td align="right" class="catbg">
<img src="', $settings['images_url'], '/smflogo.gif" style="margin: 4px;" border="1px" alt="" />
</td>
</tr>
</table>';
Cheers,
Gene
look at the bit
<tr>
<td class="catbg" height="32">';
<table>
at the top you need to remove the ';
Ok, did that and still getting errors:
LainaaParse error: syntax error, unexpected '/' in /home/gemigene/public_html/menthealth/Themes/default/index.template.php on line 194
Line 194 is the </td>
echo '
</td>
<td align="right" class="catbg">
<img src="', $settings['images_url'], '/smflogo.gif" style="margin: 4px;" border="1px" alt="" />
</td>
</tr>
</table>';Sorry for being such a pain...
Gene
whats after </table>';
Lainaus käyttäjältä: RunicWarrior - tammikuu 17, 2008, 07:35:32 IP
whats after </table>';
Uncanny, while playing around with this, I found out that simply adding 2 lines (echo and This is...):
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '
This is a test, Hello Runick';
to the original code and it looks OK, take a look at http://matesjunction.com/menthealth/index.php
Simpler than we thought... Now all I need to do is add formatting to that line.
Someone should turn this into a Mod...
LOL!
Gene
I think I'll insert CSS for description in the style.css file, better than inline CSS.
Still playing around with this, had to add a line break to separate the title and the description.
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '
<br />';
echo '
<span style="font-size: 130%;"><i>This is a test. Hello Runick, whoops, sorry about the K</i></span>';
Cheers!
Update:
Moved the styling for "description" to CSS, added a ruler <hr width="98%" align="left"> in the index template to separate the Title from the description and a few other things.
If I post the snippet of code, would someone tell me if I did it right?
Cheers,
Gene
BTW: You may see it at http://matesjunction.com/menthealth/index.php
if you want to take it further you should add it as a txt string instead of hardcodede example
in the index.template.php
<span class="test">', $txt[test] ,'</span>
in languages/index.english.php
$txt[test] = 'This is an example of a text string';
Yup, that was going to be my next step and the good thing is that if I wish to use more than 1 language, it'll be great.
Have any idea on how to link the title and logo back to the main page instead on clicking on Home or the navigation tree?
Thanks Runic
Gene
BTW, some Mod author should consider turning this into a Mod, quite a few forum software packages have this feature.
All right Runic, done...
Does the code look "compliant"?
if (empty($settings['header_logo_url']))
echo '
<span class="forumname">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '
<br />';
echo '
<hr width="99%" align="left">';
echo '
<span class="description">', $txt[forum_desc] ,'</span>';
Thanks,
Gene
in whatever file you have the text add
<a href="', $scripturl, '">your text here</a>
thats looks ok
Lainaus käyttäjältä: RunicWarrior - tammikuu 18, 2008, 09:57:39 IP
in whatever file you have the text add
<a href="', $scripturl, '">your text here</a>
Great, thanks!
Gene
Thanks again Runic, works great. Here's the code to make sure I did it right (inserted in the title and logo lines).
if (empty($settings['header_logo_url']))
echo '
<a href="', $scripturl, '"><span class="forumname">', $context['forum_name'], '</span></a>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';
echo '
<br />';
echo '
<hr width="99%" align="left">';
echo '
<span class="description">', $txt[forum_desc] ,'</span>';
echo '
</td>
<td align="right" class="catbg">
<a href="', $scripturl, '"><img src="', $settings['images_url'], '/smflogo.gif" style="margin: 4px;" border="1px" alt="" /></a>
</td>
</tr>
</table>';
BTW, if I were to insert text between the quote marks in alt="", isn't it supposed to show when hovering over the image?
Thanks for being such a great mentor,
Gene
that is correct.