By court-jus on
Hi there,
I want to say that I'm very happy of Drupal and I use the CCK module to create many content types.
I have created a "special content type" that I use to create search forms for some of my content types. This "special content type" just store the information about the search form like the sort order, the searchable fields... Then I use a special theme to generate the form, validate it and query the database.
I would like to share my work with the team and see if it could be integrated in a better way.
Comments
Sounds very interessting! Do
Sounds very interessting! Do you have a url for showing us?
Cheers!
morphir.com
If you want to test it...
Here is how it works :
I created a new content type named 'formulaire' (i'm french speaking) with the following fields :
- title
- introduction (just a text to display at the top of the form)
- modify your query (just a text to display after a search)
- results (just a text to display before the results of a search)
- content type to search (the name of the content type the search form will apply to)
- sort field
- sort order
- search field (a multiple field : name of each field to present in the search form)
- settings (a multiple field : for each field of the search form, the setting to use)
- help (a multiple field : for each field, the help text to display)
The theme used to display this content-type is 'node-content-formulaire.tpl.php' and uses another php file to display the results (it's like a themable theme...) I provide one example named 'show_resshow_results_of_content-bureau.php'.
These two files can be found here : cck-search.zip
I don't know how I can export the 'formulaire' content-type to provide it in the zip file so if you want more help, you can ask me.
Screen shot
Would you be able to provide screen shots of the contents type as it appears filled out in the edit form?
Looks good
I have made a staff directory using cck, which works perfectly except the search. I am very interested in this as it may be the awnser to my problem, will try it out today. Basically what I need is to search all the fields in a cck type, but the results must show the title (Surname), and the second field (first name) in the main title of the search results. I guess this can do that with your code?
Yep
Yes you can do that :)
Got it wrong
I've got it wrong somewhere - recieve the message 'More than one content type found, please use a better pattern'
Not sure what values to put in settings?
Basically i'm trying to duplicate exactly what you have but not succeeding.
me neither :( Is there a
me neither :( Is there a demo of it? or at least a couple of screenshots?
morphir.com
You have to give the name of the content type to search
But if you see that message, that means that using your pattern, my tool did not manage to restrict his choice to one content-type. For example, suppose you have a content type named "supertype" and another one named "normaltype", if you put the value "type", the tool won't be able to choose between the two.
You are right saying we lack a little demo but as I can't give you access to the website i'm working on, I'll post some screenshots.
Thanks for your response
I have tried every possible combination of content type, it doesn't seem to matter what I put in it brings up the same result. I have three types:
Document store
formulaire
Staff directory
There is nothing similar about them?
I have also tried the content type name, and also the node type name.
Sorry to hassle you with all this.
OK, here it is
Going to this URL, you will see a presentation/tutorial/stuff about this little trick.
Be patient, the whole page with images is about 600kbytes
Very nicely done
Thanks a lot, your tutorial is very helpful. This is a really nice trick!
Well
Well... it's a pleasure :)
If manyone use that, I will have to tidy up the code...