17452 Posts in 4473 Topics by 1971 members
Page: 1 2
|Go to End||Next >|
4 December 2007 at 6:35am
I'm building a site and added the search-functionality from the tutorial. It seems to me that a lot of unnecessary html is added that I would like to remove but don't know how. For example, new TextField("Search", "", $searchText);
generates an extra div: <div id="Search" class="field text nolabel">
and an extra span: <span class="middleColumn">
How do I get rid of those?
24 May 2008 at 2:02pm
Boy this is a bit of old thread, but exactly the question I was searching for.
I don't really care about the unnecessary HTML at the moment, but is there a way to create a form element like the search box and assign a custom css class to it?
24 May 2008 at 3:27pm
In your code where you're generating the actual search field, you could do something like this:
$searchField = new TextField('Search');
$fields = new FieldSet(
See here, for the search tutorial: http://doc.silverstripe.com/doku.php?id=tutorial:4-site-search
22 July 2008 at 6:13am
Hi - I would really like it if someone could let me know the answer to the original posters question? I'm coming across a lot of unanswered questions in the forum :o/...
"generates an extra div: <div id="Search" class="field text nolabel">
and an extra span: <span class="middleColumn"> "
how does one go about getting rid of this html - can't find it in any .ss files - please help!
25 July 2008 at 1:30am Last edited: 25 July 2008 1:36am
Well just to update anyone else with this problem searching the board. The only way I could get it to work in the absence of a reply to my post, was to edit the formfield.php file, line 265 to get rid of the div and span tags, (perhaps they shouldn't really be mixed in there as they are for presentation rather than functional elements within form controls, no?).
The comments in the formfield.php did point to using another file DefaultFieldHolder.ss that should be used to implement a custom look, however this isn't elaborated on as to how this is achieved unfortunately. I did try by placing it in my themes folder and doing the flush=1 trick but it didn't appear to get picked up by SS when placed in there so I'm none the wiser as to it's proper usage or context.... :o(
Can anyone from the team help to expand on how this file (DefaultFieldHolder.ss) works to create a custom look to forms in the app please?
29 July 2008 at 10:29pm
Actually - scrap that, hacking that file just screws the CMS forms up completely. So that still leaves me with a search form that I need to desperately customise.
Can anyone help with this? Really would appreciate it. Either by using the DefaultFieldHolder.ss or another method please?
2 September 2008 at 2:36pm
I ended up just adding the search form, copying the source code that it generates, the replacing it with hard coded HTML and removing everything I didn't want.
Worked for me, and obviously there is no answer to this.
4 September 2008 at 4:49pm
I know this thread is kind of old but from memory you can extend all the existing classes (ie form fields) and set the template that it renders with. You should do all of this in you own code and templates sections of your site. No need at all to modify the core. Also you can extend to Search Engine overwriting the methods you need to change to make the default search better.
Dio to allow searching in places that are in the sitetree you can add Fulltext to them and then change the Search Engine.
Page: 1 2
|Go to Top||Next >|