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)

Re: [ChrisTitchenal] New guy with, I hope some easy questions to answer

By Dave - February 7, 2008 - edited: February 7, 2008

Hi Chris, welcome aboard!

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.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] New guy with, I hope some easy questions to answer

By Chris_t - February 7, 2008

Thanks Dave I get the search now. On the viewer search page they have in the example "<form method="POST" action=" ">" I was stumped as to what would go in the action now it makes sense. I will try out the sort code soon and tell you how that goes. Can I have it search more than one field at a time? If they say type Tom brady or quarterback can it search not just player names but also poisons.

Thanks again

Chris

Re: [ChrisTitchenal] New guy with, I hope some easy questions to answer

By Dave - February 7, 2008

Thanks, I've updated that doc page so it will be less confusing for others.

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.
Dave Edis - Senior Developer
interactivetools.com