TinyPortal

General => Chit chat => Topic started by: marzi on October 30, 2006, 03:17:11 PM

Title: How to Target a New Button
Post by: marzi on October 30, 2006, 03:17:11 PM
I am using TP 0.9.6 with SMF 1.1 RC3 with the Default Theme.

I have installed an additional button named 'contact' on the navigation bar using the 2 pieces of code  below.

How do I target my contact.html page to load under the top section which contains the  navigation bar? I would like the contact.html page to load and display like, for example, as the register page does, the help page does, etc., under the main top section. Now clicking on the button  just opens the page into the current browser window. I am stumped and help from the more knowledgeable would be appreciated.


if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin', 'contact')))
$current_action = $context['current_action'];

      


// Show the [contact] button.
   echo ($current_action=='contact' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action=='contact' ? 'active_back' : 'back' , '">
               <a href="http://www.mydomain.com/forum/acontact.html">CONTACT</a>
            </td>' , $current_action=='contact' ? '<td class="maintab_active_last">&nbsp;</td>' : '';

Title: Re: How to Target a New Button
Post by: akulion on October 30, 2006, 03:21:38 PM
Put your contact form in an article and then put the link for it like this:

', $scripturl, '?action=XX

instead of

http://www.mydomain.com/forum/acontact.html

Where XX will be the number of the article
Title: Re: How to Target a New Button
Post by: marzi on October 30, 2006, 06:16:43 PM
Thanks for the help.
I think I followed your directions but the article does not show up.
I tried changing the action in the Location Window from article7 to only 7 but without positive results.

The URL for the site is:
http://www.marscafe.com/oxforum/index.php

Here is he code I am using:
// Show the [contact] button.
   echo ($current_action=='contact' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action=='contact' ? 'active_back' : 'back' , '">
               <a href="', $scripturl, '?action=article7">' , $txt[1006] , '</a>
            </td>' , $current_action=='contact' ? '<td class="maintab_active_last">&nbsp;</td>' : '';


Title: Re: How to Target a New Button
Post by: akulion on October 30, 2006, 06:30:09 PM
oh sorry instead of action put this:

<a href="', $scripturl, '?page=7">
Title: Re: How to Target a New Button
Post by: marzi on October 30, 2006, 06:44:19 PM
That did it and thank you very much for you clear assistance.
Title: Re: How to Target a New Button
Post by: akulion on October 30, 2006, 07:16:47 PM
welcome :up:
Title: Re: How to Target a New Button
Post by: marzi on October 31, 2006, 01:19:40 AM
Is there anyway to constrain the use of the 'contact article' to only registered users?
That way the form user has had to pass through the Captacha registration process.

I am afraid of possible spamming of the form if it is in plain HTML and have not bee able get the php option to work at all even with the simplest of php code.

Thank you
Title: Re: How to Target a New Button
Post by: akulion on October 31, 2006, 10:44:50 AM
hopefully this will do the trick:


// Show the [contact] button.
    global $user_info;
    if ($user_info['is_guest'])

   echo ($current_action=='contact' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action=='contact' ? 'active_back' : 'back' , '">
               <a href="', $scripturl, '?page=X">' , $txt[1006] , '</a>
            </td>' , $current_action=='contact' ? '<td class="maintab_active_last">&nbsp;</td>' : '';

    else

   echo ($current_action=='contact' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action=='contact' ? 'active_back' : 'back' , '">
               <a href="', $scripturl, '?page=7">' , $txt[1006] , '</a>
            </td>' , $current_action=='contact' ? '<td class="maintab_active_last">&nbsp;</td>' : '';



with this code u will have to create another article for "guests" explaining to them to register inorder to contact the site admin

And then once that article is created look at the 1st part of the code where it says: page=X - change X to the number of the new article
Title: Re: How to Target a New Button
Post by: jacortina on October 31, 2006, 03:12:21 PM
Quote from: marzi on October 31, 2006, 01:19:40 AM
Is there anyway to constrain the use of the 'contact article' to only registered users?
That way the form user has had to pass through the Captacha registration process.

I am afraid of possible spamming of the form if it is in plain HTML and have not bee able get the php option to work at all even with the simplest of php code.

Thank you

I would really give this some re-consideration.

A major use of a Contact form would be specifically FOR unregistered users (registered users can PM and/or get the admin's email from profile).

If somebody's trying to get in touch to point out that they're having trouble registering and/or logging in...
Title: Re: How to Target a New Button
Post by: akulion on October 31, 2006, 03:19:27 PM
yup i agree with JA

plus i think spambots are over rated really

in my one year history of my site ive only gotten 1 spambot in the forum who got banned.

Apart from that I'm luckily free of them :D

Just remember - dont go to dodgy sites - and they wont follow ya back home :D lol
Title: Re: How to Target a New Button
Post by: marzi on October 31, 2006, 05:13:04 PM
Mr. Cortina and Aku,

I will seriously consider you suggestions.
Better yet, I am going to abandon restricting the form's use to only registered users and allow the general public to use the form until I have reason to not to do so.

Thanks to the both of you.
Title: Re: How to Target a New Button
Post by: Crip on October 31, 2006, 05:45:02 PM
Tried [ target="_blank">]?
Title: Re: How to Target a New Button
Post by: jacortina on October 31, 2006, 05:53:40 PM
Quote from: marzi on October 31, 2006, 05:13:04 PM
Mr. Cortina and Aku,

I will seriously consider you suggestions.
Better yet, I am going to abandon restricting the form's use to only registered users and allow the general public to use the form until I have reason to not to do so.

Thanks to the both of you.

You might also think about 'filtering' through something like gmail for these contact emails. Their basic spam filtering is OK and you can set your account to forward (or store and forward) to another (your 'real') address.
Title: Re: How to Target a New Button
Post by: marzi on November 03, 2006, 01:13:05 AM
I have the new button installed on the navigation bar that hangs down from the Top Frame. of the Portal. It works fine when I click on it and displays the article associated with it  http://www.marscafe.com/oxforum/index.php?page=7

The oddity is that no matter from which tab I come from to click on this new button's tab, the Home button is the one that is highlighted, not the new button. Curious if this is the way it is supposed to be.

http://www.marscafe.com/oxforum/

gracias.