SimplePortal

Customization => Themes and Graphics => Topic started by: SinisterForces on April 03, 2011, 10:49:38 PM

Title: How can I create a 'Portal' button for a standalone portal in the Babylon theme?
Post by: SinisterForces on April 03, 2011, 10:49:38 PM
First, thank you for the excellent modification for SMF. It is just what I have been looking for. I am learning how to use Simple Portal, and so far it is living up to its name. The basic principles of it are indeed simple to work with.

I want to add a button to my theme with the label of "Portal" and that takes the user to the standalone portal page that I created for the site.

Here are the details:


I tried modifying the information presented in the custom theme tutorial for the Classic and Babylon themes presented here (http://simpleportal.net/index.php?topic=713.msg4543#msg4543), but I have not been able to make it work.

Here is the code used for the button labeled "Help" that I want to modify:

Code: [Select]
<a href="', $scripturl, '?action=help">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];
I can't figure out what to change in order to create a button with the label "Portal" and no image (at this time) that will take the user to the standalone portal page.

I tried the following code but it caused an error page to appear for the site:

Code: [Select]
<a href="http://www.youmeetinatavern.com/portal/index.php">Portal</a>, $context['menu_separator'];
Do I have to create an action for the new button? If so, how would I do that? Unfortunately I don't know how to program PHP, so any help that is offered is greatly appreciated.
Title: Re: How can I create a 'Portal' button for a standalone portal in the Babylon theme?
Post by: AngelinaBelle on April 04, 2011, 07:28:06 AM
The [home] button is really your portal button.
So, for that home button, all you need to do is use the string 'Portal', or $txt['sp-portal'] instead of the $txt string currently used there ($txt['home'] or $txt[103])
 
Title: Re: How can I create a 'Portal' button for a standalone portal in the Babylon theme?
Post by: SinisterForces on April 04, 2011, 03:00:04 PM
The [home] button is really your portal button.

Thank you, but I am a bit confused here and I need to clarify something.

I am using Simple Portal with the standalone portal option. So my home page is http://www.youmeetinatavern.com/index.php, and my portal page is http://www.youmeetinatavern.com/portal/index.php. The home button for my theme takes the user to the home page, and not the portal page.

I did try to do as you suggested with the following line of code:

Code: [Select]
// Show a button to the Simple Portal standalone portal homepage.
<a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/portal.gif" alt="' . $txt['sp-portal'] . '" border="0" />' : $txt['sp-portal]), '</a>', $context['menu_separator'];

But it resulted in the following error:

Code: [Select]
Template Parse Error!

There was a problem loading the /Themes/babylon/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

Parse error: syntax error, unexpected '<' in .../Themes/babylon/index.template.php on line 514
505: {
506: global $context, $settings, $options, $scripturl, $txt;
507:
508: // Show the [home] and [help] buttons.
509: echo '
510: <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
511: <a href="', $scripturl, '?action=help">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];
512:
513: // Show a button to the Simple Portal standalone portal homepage.
514: <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/portal.gif" alt="' . $txt['sp-portal'] . '" border="0" />' : $txt['sp-portal]), '</a>', $context['menu_separator'];

I don't know which is the unexpected '<' that the error is referring to.
Title: Re: How can I create a 'Portal' button for a standalone portal in the Babylon theme?
Post by: SinisterForces on April 04, 2011, 03:07:45 PM
I reviewed the code again and saw that I had in one spot:

Code: [Select]
'sp-portal
Instead of:

Code: [Select]
'sp-sportal'
So I revised it to be:

Code: [Select]
// Show a button to the Simple Portal standalone portal homepage.
<a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/portal.gif" alt="' . $txt['sp-portal'] . '" border="0" />' : $txt['sp-portal']), '</a>', $context['menu_separator'];

Unfortunately the same error occurred after making the change.
Title: Re: How can I create a 'Portal' button for a standalone portal in the Babylon theme?
Post by: AngelinaBelle on April 05, 2011, 08:27:55 AM
You are on the right track, I think. Please review the tutorial one more time. The info is really all there.
I am sorry I am unable to help much at the moment. I am home sick today and can hardly see straight, so I wouldn't trust myself to offer any useful debugging help right now.
I just wanted to offer you some encouragement.
Title: Re: How can I create a 'Portal' button for a standalone portal in the Babylon theme?
Post by: SinisterForces on April 06, 2011, 01:16:54 AM
Thanks! I used the information that I found here on the SimpleMachines.org forum (http://docs.simplemachines.org/index.php?topic=1032) combined with what this site offered to solve the problem. The code was very simple:

Code: [Select]
<a href="http://www.youmeetinatavern.com/portal/index.php">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/portal.gif" alt="Portal" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];
I'll work on adding a more elegant fix later with a portal action if possible, but for now I am quite content with what is working (if I don't just make the portal my homepage by default one day instead of the standalone version).

Thanks again for your help with this!
SimplePortal 2.3.8 © 2008-2024, SimplePortal