News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Adding a forum description under the title

Started by gemigene, January 16, 2008, 07:09:28 PM

Previous topic - Next topic

gemigene

How could I insert a forum description similar to this:



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
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

gemigene

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
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Deaks

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
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

gemigene

Thanks Runick,

Tried the above but I get parse errors...

Cheers,
Gene
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Deaks

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 :)
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

gemigene

#5
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
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Deaks

look at the bit

<tr>
<td class="catbg" height="32">';
<table>


at the top you need to remove the ';
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

gemigene

Ok, did that and still getting errors:

QuoteParse 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
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

gemigene

Quote from: RunicWarrior on January 17, 2008, 07:35:32 PM
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
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

gemigene

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!
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

gemigene

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
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Deaks

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';
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

gemigene

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.
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

gemigene

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
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Deaks

in whatever file you have the text add

<a href="', $scripturl, '">your text here</a>
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

gemigene

Quote from: RunicWarrior on January 18, 2008, 09:57:39 PM
in whatever file you have the text add

<a href="', $scripturl, '">your text here</a>


Great, thanks!
Gene
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

gemigene

#18
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
"Religion is metaphysical statism. I will be ruled by no man on earth, nor by any god in heaven"

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Advertisement: