Page 1 of 1

Search form not working with pretty url

Posted: Mon Sep 10, 2012 9:44 am
by bob_basli
Hi all,

For the proper layout of my search box, I'm using following code:

Code: Select all

<form class="searchform" id="cntnt01moduleform_1" method="get" action="index.php">
<div class="hidden">
<input type="hidden" name="mact" value="Search,cntnt01,dosearch,0" />
<input type="hidden" name="cntnt01returnid" value="15" />
</div>

 <p><input type="text" class="textbox" id="cntnt01searchinput" name="cntnt01searchinput" size="20" maxlength="50" /><input name="submit" class="button" value="Zoeken" type="submit" /></p>

</form>
When NOT using pretty urls, there is no problem
When using pretty urls, no page and results are displayed.

Code of .htaccess:

Code: Select all

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
RewriteRule ^tag/(.*)\/([0-9]*)$ index.php?&mact=Search,m99,dosearch,0&m99returnid=$2&m99searchinput=$1 [NC,L]
Code of config.php:

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '';

#If using none of the above options, what should we be using for the query string
#variable?  (ex. http://www.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'page';
What can I do to get the searchbox working WITH pretty url's?

Regards,
Arjan

Re: Search form not working with pretty url

Posted: Mon Sep 10, 2012 12:25 pm
by velden
I would suggest adding a slash before index.php
<form class="searchform" id="cntnt01moduleform_1" method="get" action="/index.php">
Alternative might be:
Site Admin -> Content Editing Settings -> Automatically created URL's are flat: Yes
However never used this setting myself.

Re: Search form not working with pretty url

Posted: Mon Sep 10, 2012 1:05 pm
by bob_basli
Unfortunately neighter of the suggestions works

Re: Search form not working with pretty url

Posted: Mon Sep 10, 2012 1:50 pm
by velden
Is there a special reason why you use method="get" in stead of post?

Used your form code on a website of mine, just works.
I use the .htaccess which is delivered with cmsms on 1.10.3 (/docs/htaccess.txt)

Re: Search form not working with pretty url

Posted: Mon Sep 10, 2012 7:51 pm
by Dr.CSS
@bob_basli

Push the restore to default button at the bottom of the search template and use the htaccess.txt file from the doc folder renamed to .htaccess...

Re: Search form not working with pretty url

Posted: Mon Sep 10, 2012 8:22 pm
by bob_basli
Hi all,

I'm running CMSMS 1.9.4.3 and am NOT using the search template.
Reason is that in the CSS of the form there is a reference to a class which I seem not to get into the {search} module.
form class="searchform"
If I can get this working in the search template it's also fine with me.

Re: Search form not working with pretty url

Posted: Mon Sep 10, 2012 8:40 pm
by Dr.CSS
Run the default search form and use the classes it has to style it to your liking, check the page source for what classes it uses...

Re: Search form not working with pretty url

Posted: Fri Sep 14, 2012 9:00 am
by bob_basli
Then,
How do I define the form class in the default search?
I know how to define the input class and button class.
My problem is the form class itself.

Re: Search form not working with pretty url

Posted: Fri Sep 14, 2012 1:06 pm
by uniqu3
If class is only reason i don't see why you could not wrap your form in a div with that class.

Code: Select all

<div class='searchform'>
    <!-- the form stuff -->
</div>
And target it like:

Code: Select all

.searchform form {
    /* do your funky style now here */
}

Re: Search form not working with pretty url

Posted: Sat Sep 15, 2012 6:01 am
by bob_basli
Thanks for the help but I seem not to get it right.
This is the current css

Code: Select all

/* search form */
form.searchform {
	background: transparent;
	border: none;
	margin: 0; padding: 0;
}
form.searchform input.textbox { 
	margin: 0; 
	width: 120px;
	border: 1px solid #9EC630; 
	background: #FFF;
	color: #333; 
	height: 14px;
	vertical-align: top;
}
form.searchform input.button { 
	margin: 0; 
	padding: 2px 3px; 
	font: bold 12px Arial, Sans-serif; 
	background: #FAFAFA;
	border: 1px solid #f2f2f2;
	color: #777;	
	width: 60px;
	vertical-align: top;
}
This is what my search form template looks like:

Code: Select all

{$startform}
{* <label for="{$search_actionid}searchinput">{$searchprompt}:&nbsp;</label> *}
<input type="text" class="search-input" id="{$search_actionid}searchinput" name="{$search_actionid}searchinput" size="20" maxlength="50" value="{$searchtext}" {$hogan}/>
{*
<br/>
<input type="checkbox" name="{$search_actionid}use_or" value="1"/>
*}
<input class="search-button" name="submit" value="{$submittext}" type="submit" />
{if isset($hidden)}{$hidden}{/if}
{$endform}
A little help on transforming is very much appreciated!

Re: Search form not working with pretty url

Posted: Sat Sep 15, 2012 6:53 am
by uniqu3

Code: Select all

<div class="searchform">
{$startform}
{* <label for="{$search_actionid}searchinput">{$searchprompt}:&nbsp;</label> *}
<input type="text" class="textbox" id="{$search_actionid}searchinput" name="{$search_actionid}searchinput" size="20" maxlength="50" value="{$searchtext}" {$hogan}/>
{*
<br/>
<input type="checkbox" name="{$search_actionid}use_or" value="1"/>
*}
<input class="button" name="submit" value="{$submittext}" type="submit" />
{if isset($hidden)}{$hidden}{/if}
{$endform}
</div>

Code: Select all

/* search form */
.searchform form {
   background: transparent;
   border: none;
   margin: 0; padding: 0;
}
.searchform input.textbox { 
   margin: 0; 
   width: 120px;
   border: 1px solid #9EC630; 
   background: #FFF;
   color: #333; 
   height: 14px;
   vertical-align: top;
}
.searchform input.button { 
   margin: 0; 
   padding: 2px 3px; 
   font: bold 12px Arial, Sans-serif; 
   background: #FAFAFA;
   border: 1px solid #f2f2f2;
   color: #777;   
   width: 60px;
   vertical-align: top;
}

Re: Search form not working with pretty url

Posted: Sat Sep 15, 2012 4:23 pm
by Dr.CSS

Code: Select all

/* search form */

input.search-input { 
	margin: 0; 
	width: 120px;
	border: 1px solid #9EC630; 
	background: #FFF;
	color: #333; 
	height: 14px;
	vertical-align: top;
}
input.search-button { 
	margin: 0; 
	padding: 2px 3px; 
	font: bold 12px Arial, Sans-serif; 
	background: #FAFAFA;
	border: 1px solid #f2f2f2;
	color: #777;	
	width: 60px;
	vertical-align: top;
}

Re: Search form not working with pretty url

Posted: Mon Sep 17, 2012 9:54 am
by bob_basli
Doesn't the code

Code: Select all

.searchform form {
	background: transparent;
	border: none;
	margin: 0; padding: 0;
}
conflict with this part of the Stylesheet?

Code: Select all

form {
	margin:10px; padding: 0;
	border: 1px solid #f2f2f2; 
	background-color: #FAFAFA; 
}
If so, how do I fix it?

Re: Search form not working with pretty url

Posted: Tue Dec 11, 2012 8:12 am
by bob_basli
The issue here lays with the form class="searchform".
I am not able to set that class to the {search}.
When using <div class="searchform> the searchbox is not put in the proper place.

Also my last post was not answered.

For the record, Id rather use the search module than the <form> stuff but that last seems the only thing that is displaying the searchbox in the proper css and on the proper location.

Hope to get some help and sort this out.

When not using pretty_url everything works fine

Re: Search form not working with pretty url

Posted: Tue Jan 29, 2013 9:15 pm
by Dr.CSS
Try using a real page extension like .html, .php, etc...