New guy with, I hope some easy questions to answer
4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 7, 2008 (RSS)
By Chris_t - February 7, 2008
1. The search yes I have read the new page about adding a search box. My question is, only part of the site will be in the CMS will I have to create a page in CMS for the search? I am not getting how a non CMS page with a search form will know to hit the correct database and look up what the person is looking for.
2. One site we are working on adding CMS to is a local sports team I have played with the list view and have got it looking how I want it my question is. On the list view when you bring up the players I have there jersey number, name and position. At the top of the page I want them to if they click player name it sorts the list by name or if they click position it sorts by position.
3. This is a more of has anyone else had this happen. When I work on the php in Dreamweaver MX it just wipes the <?php echo "<?xml version='1.0'?>\n"; ?> out. I have to work on it not save and use good old trusty notepad to save it.
Thanks in advance for any advice you all might have I am sure I will have more questions and in time able to help as well.
Chris
Re: [ChrisTitchenal] New guy with, I hope some easy questions to answer
By Dave - February 7, 2008 - edited: February 7, 2008
I'll do my best to answer your questions. As always, let me know if I can provide more detail or clarity about anything.
1. The search is more like a "filter" for the list page. It controls what is shown and not shown on that list only. So say you wanted to search by city, you could add cityList.php?city_keyword=Vancouver to the end of the viewer url. Or if you wanted to have a separate search form, it would submit to cityList.php. So you might have citySearch.html which looked like this:
<form method="GET" action="cityList.php">
<input type="text" name="city_keyword" value="">
<input type="submit" name="submit" value="Search">
</form>
Even though it's on a different page, it's submitting to the CMS page and creating the same search url as you would manually. Hope that makes sense.
2. This would require a little bit of custom PHP code. The basic idea is that you specify the field to sort by in the 'orderBy' option like this:
$options['orderBy'] = 'title';
So if you wanted to sort by title you'd use title, name for name, position for position, and so on.
You could pass the sort field to the viewer like this yourViewer.php?orderBy=position and then have some code to check that and use different sorting based on the value, like this:
if (!@$FORM['orderBy'] == 'title') { $options['orderBy'] = 'title'; }
else if (!@$FORM['orderBy'] == 'jersey') { $options['orderBy'] = 'jersey'; }
else { $options['orderBy'] = 'position'; }
Then it would set a different order by value based on what you specified in the url.
3. I don't know that the <?xml version='1.0'?> is required for XHTML standard documents or having browser render the page in compliance mode. I know doctype is. Maybe we could just remove that. We need to print it out with PHP because some PHP installations take anything that start with <? as a PHP tag, try to parse it, and generate an error. I'll have to look into that. If anyone has more information or suggestions on that feel free to post.
Hope that helps! Let me know if you need anything else.
interactivetools.com
Re: [Dave] New guy with, I hope some easy questions to answer
By Chris_t - February 7, 2008
Thanks again
Chris
Re: [ChrisTitchenal] New guy with, I hope some easy questions to answer
By Dave - February 7, 2008
Yes, you can search multiple fields. If you want to search multiple fields for the same thing you'd do it like this:
playerList.php?name,position_keyword=tom
That would search the name and position fields for the keyword "tom". If either field matches you'll get a result. If you wanted to search multiple fields for different values you'd do it like this:
playerList.php?name_keyword=tom&position=quarterback
Both fields must match to get a result. And you could do that with form fields like this:
<input type="text" name="name,position_keyword" value="tom">
or
<input type="text" name="name_keyword" value="tom">
<input type="text" name="position" value="quarterback">
Hope that makes sense. Anything else you need just let us know.
interactivetools.com