ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Search Form HTML - Difference between EE 1.0 and 2.x

October 31, 2012 10:48am

Subscribe [2]
  • #1 / Oct 31, 2012 10:48am

    dmacli

    141 posts

    Hello,

    In EE 1.0 I found a way to get my search bar into the User Message template.  The solution was pretty simple.  I just viewed the html of a rendered page that included the search form, copied the form text, and put that into the user template.

    The code that I pasted looked something like this:

    <form method="post" action="http://www.djbooth.net/index">
                      <input type="hidden" name="ACT" value="17" />
                      <input type="hidden" name="XID" value="" />
                      <input type="hidden" name="RP" value="general&#47;search" />
                      <input type="hidden" name="NRP" value="" />
                      <input type="hidden" name="RES" value="20" />
                      <input type="hidden" name="status" value="" />
                      <input type="hidden" name="channel" value="not trackschart|charts|tracks-sandbox" />
                      <input type="hidden" name="search_in" value="titles" />
                      <input type="hidden" name="where" value="all" />
                      <input type="hidden" name="site_id" value="1" />
                      <input type="text" name="keywords" id="keywords" value="Search the DJBooth" maxlength="100" width="39" height="26" class="inputtext" />
                      <input type="image" src="http://static.djbooth.net/images/go-btn.gif" class="go-btn" />
                      </form>

    However this code doesnt work in 2.x.  The new version of EE seems to put the parameters into a long encrypted string.

    I was wondering if there was a way to get around this in 2.x.

  • #2 / Nov 02, 2012 12:09pm

    Dan Decker

    7338 posts

    Hi dmacli,

    You need to use the {XID_HASH} variable like so:

    <form method="post" action="http://www.djbooth.net/index">
                      <input type="hidden" name="ACT" value="17" />
                      <input type="hidden" name="XID" value="{XID_HASH}" />
                      <input type="hidden" name="RP" value="general&#47;search" />
                      <input type="hidden" name="NRP" value="" />
                      <input type="hidden" name="RES" value="20" />
                      <input type="hidden" name="status" value="" />
                      <input type="hidden" name="channel" value="not trackschart|charts|tracks-sandbox" />
                      <input type="hidden" name="search_in" value="titles" />
                      <input type="hidden" name="where" value="all" />
                      <input type="hidden" name="site_id" value="1" />
                      <input type="text" name="keywords" id="keywords" value="Search the DJBooth" maxlength="100" width="39" height="26" class="inputtext" />
                      <input type="image" src="http://static.djbooth.net/images/go-btn.gif" class="go-btn" />
                      </form>

    Let me know the result.

    Cheers!

  • #3 / Nov 05, 2012 10:32am

    dmacli

    141 posts

    Thanks!  I am going to try this out today.  So the XID Hash variable will work on message templates?

    Related question.  There is a page on my site that is not run through EE for various reasons.  Would there be anyway to display a search form on that page?  It worked with EE 1.x but it seems like it wouldnt here if the XID is now required.

  • #4 / Nov 05, 2012 10:37am

    dmacli

    141 posts

    Looks like the XID has variable doesnt work on user message templates.  Any other ideas?

  • #5 / Nov 06, 2012 3:08pm

    Dan Decker

    7338 posts

    Hi dmacli,

    Well… dang. The User Message templates are a special lot, and not parsed through the main Template Parsing Engine.

    I’m not entirely sure this is something we can support, but I would like to take a look if possible. Be on the lookout for an email from EllisLab.

    Cheers,

  • #6 / Nov 07, 2012 9:18am

    dmacli

    141 posts

    Sent it yesterday, did you get it?  I want to close that login once you guys are done.

  • #7 / Nov 07, 2012 10:56am

    Dan Decker

    7338 posts

    Hi Dave,

    I wanted to get in just to test out some theories. As I came to suspect, ExpressionEngine doesn’t parse Global Variables or system constants in the Message templates.

    You might look into Custom System Messages as an option.

    Looks like what you are after isn’t available in ExpressionEngine 2 out-of-the-box.

    Cheers,

  • #8 / Nov 07, 2012 10:59am

    dmacli

    141 posts

    OK thanks for checking.

  • #9 / Nov 08, 2012 10:17am

    Shane Eckert

    7174 posts

    Hey there dmacli,

    I am glad that Dan was able to help you out!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases