Search form not working with pretty url

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm
Location: The Netherlands

Search form not working with pretty url

Post 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
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Search form not working with pretty url

Post 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.
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm
Location: The Netherlands

Re: Search form not working with pretty url

Post by bob_basli »

Unfortunately neighter of the suggestions works
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Search form not working with pretty url

Post 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)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Search form not working with pretty url

Post 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...
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm
Location: The Netherlands

Re: Search form not working with pretty url

Post 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.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Search form not working with pretty url

Post 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...
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm
Location: The Netherlands

Re: Search form not working with pretty url

Post 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.
uniqu3

Re: Search form not working with pretty url

Post 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 */
}
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm
Location: The Netherlands

Re: Search form not working with pretty url

Post 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!
uniqu3

Re: Search form not working with pretty url

Post 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;
}
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Search form not working with pretty url

Post 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;
}
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm
Location: The Netherlands

Re: Search form not working with pretty url

Post 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?
bob_basli
Forum Members
Forum Members
Posts: 189
Joined: Mon Sep 24, 2007 6:18 pm
Location: The Netherlands

Re: Search form not working with pretty url

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Search form not working with pretty url

Post by Dr.CSS »

Try using a real page extension like .html, .php, etc...
Post Reply

Return to “Layout and Design (CSS & HTML)”