Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 07-15-2014, 11:13 PM
Several Zombies Several Zombies is offline
 
Join Date: Nov 2011
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Search Bar in Static HTML Widget

I'm trying to set a search bar up in the CMS using the static HTML widget, but no matter what I try, I get an error saying the security token is invalid or missing.

My code is as follows;

Quote:

<div style="white-space:nowrap">
<form action="search.php?search_type=1#ads=24" method="post">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="showposts" value="0" />
<input type="hidden" name="quicksearch" value="1" />
<input type="text" style="width:150px;" class="bginput" name="query"/>
<input style="font: bold 10px Arial" type="submit" class="button" value="Search" /></form>
<a style="text-decoration:none" href="$vboptions[bburl]/search.php" accesskey="4" rel="nofollow" id="header_search" class=""></a><!--&nbsp;-->
</div>
Any ideas?
Reply With Quote
  #2  
Old 07-16-2014, 07:22 AM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you're using vBulletin 3 syntax, you have to use {vb:raw session.sessionurl}, {vb:raw bbuserinfo.securitytoken}, search.php{vb:raw session.sessionurl_q} as variables. I'm not sure if that works in a widget though.
Reply With Quote
  #3  
Old 07-16-2014, 04:33 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you are going to use variables, I think you need to use a PHP widget.
Reply With Quote
  #4  
Old 07-16-2014, 07:06 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As @Lynne was saying, you need a php widget.

Create a new widget template and insert the following:
Code:
<!-- 2014_07_16__php_search_widget -->
<style>
.tb_widget_content {
  background: #203020;
}
.tb_button {
  width: 24px;
  vertical-align: middle;
}
.tb_textbox {
  background: #A7B7A7;
  color: black;
  border: 0 none;
  height: 24px;
  width: 240px;
  font-size: 13px;
 } 
.tb_advanced_search li a {
  color: white;
}
</style>

<div class="cms_widget">
<div class="block">
<div class="cms_widget_header widget_header">
    <h3><img src="{vb:stylevar imgdir_siteicons}/php.png" alt="" /> {vb:raw title}</h3>
</div>
<div class="cms_widget_content widget_content tb_widget_content">


    <form action="search.php?{vb:raw session.sessionurl}do=process" method="post" id="tb_search" class="tb_search">
        <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
        <input type="hidden" name="do" value="process" />
        
        <span>
            <input type="text"  class="tb_textbox textbox" value="" name="query" tabindex="99"/>
            <input type="image" class="tb_button" src="{vb:stylevar imgdir_button}/search.png" name="submit" onclick="document.getElementById('tb_search').submit;" tabindex="100"/>
        </span>
    </form>
    
    <!-- Advanced Search -->
    <ul class="tb_advanced_search">
        <li><a href="search.php{vb:raw session.sessionurl_q}" accesskey="4">{vb:rawphrase advanced_search}</a></li>
    </ul>


</div>
</div>
</div>
Notes
---------------
1.) This uses a php widget, but is not inserting any new php -- all variables that we are using are already registered in the normal vbulletin context. You should be trying this under the vbulletin default style.

2.) This is not inserted into the widget configuration. This code is added to a newly created template (Template Manager). Use the name of the template (case sensitive) and replace the template name in the widget configuration textbox (at the bottom of the widget configuration page).

Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:52 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04400 seconds
  • Memory Usage 2,182KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete