How do I modify the index area below the header?

Started by Anjuna, July 15, 2015, 02:31:43 AM

Previous topic - Next topic

Anjuna

Hi all,

I'm using this theme for my forum: http://custom.simplemachines.org/themes/index.php?lemma=2833
Depending on the page you are on, it displays a little navigation index like this one, which is usually kinda neat.

(In case the image doesn't show: http://i.stack.imgur.com/o5OHD.png )

However, when you go to the home page, it just repeats the site name twice, like this.

(In case the image doesn't show: http://i.stack.imgur.com/KXled.png )

I understand why this has happened, but I don't like it, and I want to change it. I want to add a small welcome message instead, complete with an image and a bit of inline CSS to make it look nice.
After a bit of searching, I found out that someone else had a similar question, where the answer said:

Quote from: Ricky. on October 06, 2011, 10:42:40 AM
You change it through Themes/default/languages/index.english.php

Look for :
$txt['forum_index'] = '%1$s - Index';

change it to whatever you want.. just change the last part..

So I followed this instruction, and entered the following in that line:

$txt['forum_index'] = 'Welcome to [SITE NAME]!' . '<br>' . '<div style="float:left; width: 50%"><h3>[SITE SLOGAN]</h3><br><p>[SOME TEXT]</p></div><img src="[IMAGE].jpg" style="float:right;"></img>';

This caused it to be even worse than before, all the code appeared in the title, the image didn't show, and the second link still appeared (I have no clue how to remove that).
So how can I make it work?

Illori

are you talking about the link tree? if so you cannot and should not modify it to have an image in it.

that other topic was a very different question, it is not related to what you want to do at all.

Anjuna

Quote from: Illori on July 15, 2015, 05:19:43 AM
are you talking about the link tree? if so you cannot and should not modify it to have an image in it.

that other topic was a very different question, it is not related to what you want to do at all.

That appears to be what I am talking about.
If I can't/shouldn't do that, what do I do instead?

Illori


Kindred

no.... tht is NOT what you are talking about.  Based on a quick glance, that other thread is dealing with the page TITLE (which is part of the header information and can NEVER have an image or other HTML as part of it anyway)

What you are trying to do is modify the linktree... for the index page only....

You **COULD** try using a conditional to prevent it from showing, but it is not recommended to mess around with the linktree.
Сл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."

Sir Osis of Liver

Um, no, I believe op is referring to the title between main menu and link tree, which is specific to that theme.   Looks like it's getting it from browser title, but don't remember where that is, and don't have time to look right now.  If so, would need a conditional in index.template.php to replace it with other text.  Will have a look tonight if no one else gets it.

Ok, don't have the theme installed, but looks like it's using $txt['forum_index'] in /languages/index.english.php.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Illori

Quote from: Krash on July 15, 2015, 01:11:18 PM
Ok, don't have the theme installed, but looks like it's using $txt['forum_index'] in /languages/index.english.php.

the op said they already tried that and it did not fix the issue.

Kindred

right... because that string can **NOT** have html in it.
Сл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."

margarett

I would suggest you use the Theme's support/comments topic for these questions, actually... It is totally theme's specific.
http://www.simplemachines.org/community/index.php?topic=535335.0

But since we're here already :P
index.template.php

function pages_titlesdesc()
{
global $txt, $context, $scripturl, $settings, $modSettings, $options, $sourcedir, $topic, $topicinfo, $board_info, $board, $category;

if(!empty($topic))
{
echo '
<h2>', $context['subject'], '</h2>';
}
elseif(!empty($board))
{
echo '
<h2>',$board_info['name'],'</h2>';
}
else
{
echo '
<h2>',$context['page_title'],'</h2>';
}
}

See the latest "echo"? Replace that <h2>.....</h2> by whatever you want to show in there.

edit: if it is the text above the linktree you're talking about...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Sir Osis of Liver

Quote from: Illori on July 15, 2015, 01:39:48 PM
Quote from: Krash on July 15, 2015, 01:11:18 PM
Ok, don't have the theme installed, but looks like it's using $txt['forum_index'] in /languages/index.english.php.

the op said they already tried that and it did not fix the issue.

Yes, I know.  The point was, it's not the linktree.  If $txt['forum_index'] is changed, the new text will also appear in the browser title bar or tab.  Bruno's code should fix it.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Illori

Quote from: Krash on July 15, 2015, 11:04:24 PM
Yes, I know.  The point was, it's not the linktree.  If $txt['forum_index'] is changed, the new text will also appear in the browser title bar or tab.  Bruno's code should fix it.

if it is not the linktree then how does margarett's code fix it? his code is for the linktree... we can continue to assume all day, the op has not returned to tell any of us if we are correct or not.

margarett

No, it isn't ;) The theme has a function above the link tree which shows the current "location": topic/board/page_title. So the user only needs to replace the page_title bit ;)

But yes, we need to hear from the user.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Anjuna

Hey all, sorry to keep you hanging  :P

It seems margarett was right. I tested it first by adding something like this first:

function pages_titlesdesc()
{
global $txt, $context, $scripturl, $settings, $modSettings, $options, $sourcedir, $topic, $topicinfo, $board_info, $board, $category;

if(!empty($topic))
{
echo '
<h2>', $context['subject'], '</h2>';
}
elseif(!empty($board))
{
echo '
<h2>',$board_info['name'],'</h2>';
}
else
{
echo '
<h2>some text over here</h2>';
}
}


And that worked... but not in the way I wanted. It displayed in every page, which wasn't exactly what I wanted, I wanted the welcome message to display only on the homepage.
That said, I thought, "ehh, why not" and put the html that I wanted in that last echo over there. I got a template parse error. sigh

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Anjuna

Quote from: margarett on July 16, 2015, 08:34:57 AM
So which html did you add?

I put this:

<div style="float:left; width: 50%"><h3>[SITE SLOGAN]</h3><br><p>[SOME TEXT]</p></div><img src="[IMAGE].jpg" style="float:right;"></img>'

margarett

Can you give us the complete code of the function?
(You can still mask the content like you did but make sure it is accurate. Looking at the code you provided it seems you have an extra ' in the end)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Anjuna

Quote from: margarett on July 16, 2015, 12:25:07 PM
Can you give us the complete code of the function?
(You can still mask the content like you did but make sure it is accurate. Looking at the code you provided it seems you have an extra ' in the end)
Quote from: Krash on July 16, 2015, 02:35:05 PM
Also missing a ; after width: 50%


Oops, It seems like I've left this thread to die lmao.
I just got access to the computer again, so here it is. I tried to add the semicolon like Krash asked ( I supposed that was the problem, considering the error says "expecting ; or ,") but that didn't fix it either.

Here's the code I wanted to put:

function pages_titlesdesc()
{
global $txt, $context, $scripturl, $settings, $modSettings, $options, $sourcedir, $topic, $topicinfo, $board_info, $board, $category;

if(!empty($topic))
{
echo '
<h2>', $context['subject'], '</h2>';
}
elseif(!empty($board))
{
echo '
<h2>',$board_info['name'],'</h2>';
}
else
{
echo '
<div style="float:left; width: 50%;"><h3>[SITE SLOGAN]</h3><br><p> check out the about page<b><a href="mysite.com/about">About</a></b><p>blah blah read the rules<b><a href="mysite.com/rules">Rules</a></b> before posting.</p>
<p>More text over here</p></div><img src="mysite.com/images/IMAGE.jpg" style="float:right;"></img>';
}
}

Anjuna

I've tried to put this elsewhere as well, (same place where the banner is supposed to be put) and I got the same error. I really don't see how that tiny bit of html could be so destructive??  :'(

EDIT: I tried yet again, and it seems I messed it up so bad that the admin login page isn't being shown, and I'm not allowed to login to my own forum, instead being replaced by a maintenance mode message. I know how to fix it, but I don't know why this is happening. >_>

margarett

I don't see anything wrong with your code, really...
I need to check in place. Can you please drop me a PM with a real link to your site?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: