Announcement

Collapse
No announcement yet.

AHHH javascript and vbulletin!!! BIG ISSUE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [CMS] AHHH javascript and vbulletin!!! BIG ISSUE

    im trying to pass variables to a custom page.

    im sure everyone has put a custom button on there nav bar by now, so im sure you will recognize this:

    PHP Code:
    $tabselected '';
    $tablinks '';
    if (
    THIS_SCRIPT == 'yourpage')
    {
        
    $vbulletin->options['selectednavtab']='unique_name';
        
    $tabselected ' class="selected"';
        
    $tablinks '                <ul class="floatcontainer">
                            <li><a href="link1.php">Link 1</a></li>
                                <li class="popupmenu">
                                    <a href="javascript://" class="popupctrl">Drop Down</a>
                                    <ul class="popupbody popuphover">
                                            <li><a href="sublink1.php">SubLink 1</a></li>
                                            <li><a href="sublink2.php">SubLink 2</a></li>
                                            <li><a href="sublink3.php">SubLink 3</a></li>
                                    </ul>
                                </li>
                            <li><a href="link2.php">Link 2</a></li>
                            <li><a href="link3.php">Link 3</a></li>
                    </ul> '
    ;


    $template_hook['navtab_end'] .= '<form><li'.$tabselected.'><a style="background-color:#2fc700;" class="navtab" href="http://www.click-server.com/amicus/Amicus18%20Compiler/Amicus18%20Compiler%20Setup.exe">Download Amicus</a>'.$tablinks.'</li>


    </form>


    so what i did was to add a few hidden fields in a form and to submit the form i used some JavaScript.

    so i ended up with this:

    PHP Code:
    $tabselected '';
    $tablinks '';
    if (
    THIS_SCRIPT == 'yourpage')
    {
        
    $vbulletin->options['selectednavtab']='unique_name';
        
    $tabselected ' class="selected"';
        
    $tablinks '                <ul class="floatcontainer">
                            <li><a href="link1.php">Link 1</a></li>
                                <li class="popupmenu">
                                    <a href="javascript://" class="popupctrl">Drop Down</a>
                                    <ul class="popupbody popuphover">
                                            <li><a href="sublink1.php">SubLink 1</a></li>
                                            <li><a href="sublink2.php">SubLink 2</a></li>
                                            <li><a href="sublink3.php">SubLink 3</a></li>
                                    </ul>
                                </li>
                            <li><a href="link2.php">Link 2</a></li>
                            <li><a href="link3.php">Link 3</a></li>
                    </ul> '
    ;


    $template_hook['navtab_end'] .= '<form method="post" action="downloadnow.php" id="the_form">
    <li'
    .$tabselected.'><a style="background-color:#2fc700;" class="navtab" href="<vb:literal>javascript:{}</vb:literal>" onclick="<vb:literal>document.getElementById('the_form').submit(); return false;</vb:literal>">Download Amicus</a>'.$tablinks.'</li>
    <input type="hidden" name="userid" value="{vb:var bbuserinfo.userid}" />
    <input type="hidden" name="username" value="{vb:var bbuserinfo.username}" />
    <input type="hidden" name="email" value="{vb:var bbuserinfo.email}" />

    <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
    <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />

    </form>



    and the it take off all my nav bar buttons except Forum and What's New.

    is there some im doing wrong????

  • #2
    Probably the issue is the <vb:literal> code in the text. Try removing it and see if it works.

    Please don't PM or VM me for support - I only help out in the threads.
    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
    Want help modifying your vbulletin forum? Head on over to vbulletin.org
    If I post CSS and you don't know where it goes, throw it into the additional.css template.

    W3Schools &lt;- awesome site for html/css help

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X