Kevan Posted May 10, 2006 Posted May 10, 2006 I am learning SMF and would like to add links to the header section of the default (babylon) theme for SMF. I have the graphic I want but it's not a link. The link would take users back to the main site from the forum. For an example of what I am looking for, check out the top of this page. The TotalChoiceHosting graphic is a link to the main forum index. Below that is a link to the main hosting page. Perhaps you have a better idea on how I can accomplish this same thing with SMF? Thank You Quote
cajunman4life Posted May 10, 2006 Posted May 10, 2006 Give me a moment, I'm digging through source files right now... Quote
cajunman4life Posted May 10, 2006 Posted May 10, 2006 Alright, now this is assuming you know a bit about HTML and the like... Open "index.template.php" and find "<body>';"... Shortly below that is the section that begins the header at the top. Find where it starts "<img src="', $settings['images_url'], ", and add "<a href=yourlinkhere>" before and "</a>" after. That should take care of it for you. Let us know if that does the trick or not. Quote
Kevan Posted May 10, 2006 Author Posted May 10, 2006 Open "index.template.php" and find "<body>';"... Shortly below that is the section that begins the header at the top. Find where it starts "<img src="', $settings['images_url'], ", and add "<a href=yourlinkhere>" before and "</a>" after. "Template Parse error It seems something has gone sour on the forum with the template system. " Original Code ><img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />'; Altered Code ><a href="http://www.mydomain.ext/index.htm"><img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />'</a>; I've looked at other examples in the php file and this looks similar. Quote
Kevan Posted May 10, 2006 Author Posted May 10, 2006 I've looked at the view source of working pages. I was able to get the graphic on the right to link as expected, doing the same thing you suggested on another line. This one line with the header_logo is giving the error. Quote
Steve Scrimpshire Posted May 10, 2006 Posted May 10, 2006 Just a quick look, I see that this: '</a>; should be this: </a>'; That may not be the whole problem, though. Quote
Kevan Posted May 10, 2006 Author Posted May 10, 2006 Pow! That did it. The apostrophe in the correct position. Thank You Aaron for giving me the correct answer and Thank You to Steve for sorting out my syntax error! Quote
cajunman4life Posted May 10, 2006 Posted May 10, 2006 Odd based on this comment: // This part is the logo and forum name. You should be able to change this to whatever you want... So technically you should be able to do anything here. Just out of curiosity, try this: <a href="http://www.yourdomain.ext/index.htm" /> (notice the trailing slash...) See if that makes a difference. Quote
Kevan Posted May 10, 2006 Author Posted May 10, 2006 Odd indeed. Turns out to be my lack of PHP knowledge that caused the problem. Including the </a> in the echo statement ' ' did the trick. Thank You for all the effort! Quote
Kevan Posted May 10, 2006 Author Posted May 10, 2006 Correct Code ><a href="http://www.mydomain.ext/index.htm"><img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" /></a>'; Bad Code ><a href="http://www.mydomain.ext/index.htm"><img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />'</a>; One little tick ' placement (at the end) makes all the difference. Quote
cajunman4life Posted May 10, 2006 Posted May 10, 2006 Ahh... I missed that As a programmer, I'll agree that one small mistake will throw the whole thing off. You gotta be really careful Glad to hear it got worked out for you Quote
Kevan Posted May 10, 2006 Author Posted May 10, 2006 (edited) My first program was a pong game, back in 1984. I could not figure out why the paddle would appear to punch a hole in the wall when it touched the right wall. I spent 5 days working on it and finally got it working properly. Then, because I had made many changes with each edit, I tried to go back and figure out just what single edit made the difference. It turned out to be a missing semi-colon after a print statement but it took me a MONTH to figure that out. Normally, since then, I watch out for those tiny but powerful things. I have done very little, if any, programming since 1998 though. Had there been forums back then like the ones here at TCH, that entire exercise might have only taken me one a day. I really appreciate the help and the resource! Edited May 10, 2006 by Kevan Quote
Steve Scrimpshire Posted May 10, 2006 Posted May 10, 2006 I mae so many little mistakes, I look for those first....that's how I got lucky finding yours I'm no programmer....just a hacker. Quote
cajunman4life Posted May 10, 2006 Posted May 10, 2006 Anytime we can be of help just let us know Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.