Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Help needed, please, to get started with Search...

 

 


Itsnoprob
User

Mar 16, 2009, 5:05 AM

Post #1 of 10 (2099 views)
Shortcut
Help needed, please, to get started with Search... Can't Post

Apologies,

I have spent quite some time looking through the forum - and read the documention - but can't find the very basics of doing a successful section search...

I have set up a search form at http://www.itsnoprob.co.uk/Search.php which is intended to look at the 'answer' field in the faq table and find any entries that contain keyword_answer as entered to the search box.

The results page is at http://www.itsnoprob.co.uk/Search_Results.php but I get no results found even for a word such as 'web' which is included in faq records.

To be clearer, this page I have left with pretty much 'standard' viewer page PHP coding, so I guess there must be some changes that I need to make to this page's coding to enable the correct selection and presentation of search results?????

Again, I apologise for such a basic question but what am I doing wrong??!

I just need a bit of advice so I can get started properly with search.

Many thanks,

Nigel

[b][url]http://www.Itsnoprob.co.uk[/url][/b]

[b]Personal Service on the Net![/b]

(This post was edited by Itsnoprob on Mar 16, 2009, 8:31 AM)


Kenny
User

Mar 16, 2009, 9:13 AM

Post #2 of 10 (2076 views)
Shortcut
Re: [Itsnoprob] Help needed, please, to get started with Search... [In reply to] Can't Post

Nigel,

First things first - change your characher set from charset=windows-1252 to charset=utf-8

This will prevent future problems....

Now for searching problem - I would need to see your code to diagnose this problem.

One question though - why have a page called Search_Results.php? If you are trying to search an FAQ page, all you have to do is build the main page of the FAQ.

Example:

Question
Answer

Then build a search page (or include it on the same page) that searches your main page for FAQ. There is no reason to create a search results page. The search results will be pulled from the main page.

I hope that makes sense. If not, post your code here and we can go from there.

Kenny


Itsnoprob
User

Mar 16, 2009, 9:39 AM

Post #3 of 10 (2067 views)
Shortcut
Re: [sagentic] Help needed, please, to get started with Search... [In reply to] Can't Post

Hi Kenny,

Thanks for the reply...

I note your point about charset=utf-8 (but I don't know why?)

I hope the code info below gives you what you need to point me in the right direction.....

My main page for FAQs is http://www.itsnoprob.co.uk/Content_Management_System_FAQs.php which has questions and answers as you laid out.

The code for my Search Page currently - http://www.itsnoprob.co.uk/Search.php - is just:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>
<form method="GET" action="http://www.itsnoprob.co.uk/Search_Results.php">
<input type="text" name="answer_keyword" value="">
<input type="submit" name="submit" value="Search">
</form>


</body>

</html>



The code for my results page currently - http://www.itsnoprob.co.uk/Search_Results.php - is:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>
<!-- STEP1: Load Record (Paste this above other step) -->
<?php
require_once "/home/itsnoprobuk/public_html/cmsAdmin/lib/viewer_functions.php";
$options = array(); // NOTE: see online documentation for more details on these options
$options['tableName'] = 'faq'; // (REQUIRED) MySQL tablename to list record from. Example: "article";
$options['recordNum'] = ''; // (optional) Record number to display. Example: "1"; Defaults to number on end of url, then 1
$options['where'] = ''; // (ADVANCED) MySQL WHERE conditions to use INSTEAD of recordNum to look up record. Example: "fieldname = 'value'"
$record = getRecord($options);
?>
<!-- /STEP1: Load Record -->

<!-- STEP2: Display Record (Paste this where you want your record displayed and re-arrange fields) -->
<h1>FAQ Page Viewer</h1>
<?php if ($record): ?>
Record Number: <?php echo $record['num'] ?><br/>
Question: <?php echo $record['question'] ?><br/>
Answer: <?php echo $record['answer'] ?><br/>
Sort (optional): <?php echo $record['sort'] ?><br/>
<?php endif ?>

<?php if (empty($record)): ?><!-- Display "No Records Found" Message -->
No record found!<br/><br/>
<?php endif ?>
<!-- STEP2: /Display Record -->

<!-- STEP3: Display Uploads from 'upload' (Paste this where you want your uploads displayed) -->
<!-- Upload Program Fields : num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath -->
<!-- Upload Image Fields : isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight -->
<!-- Upload Info Fields : info1, info2, info3, info4, info5 -->
<?php if ($record): ?>
<?php foreach (getUploads($options['tableName'], 'upload', $record['num']) as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<?php endif ?>
<!-- STEP3: /Display Uploads from 'upload' -->

<div style="float: right; font-size: 10px; color: #999999">
<a href='http://www.interactivetools.com/'>Content Management</a> by interactivetools.com<br/><br/>
</div>

</body>

</html>

I 'know' this is totally wrong but I'm going round in ever decreasing circles trying to understand why??


Thanks, Nigel

[b][url]http://www.Itsnoprob.co.uk[/url][/b]

[b]Personal Service on the Net![/b]

(This post was edited by Itsnoprob on Mar 16, 2009, 9:42 AM)


ross
Staff / Moderator


Mar 16, 2009, 11:10 AM

Post #4 of 10 (2056 views)
Shortcut
Re: [Itsnoprob] Help needed, please, to get started with Search... [In reply to] Can't Post

Hi Nigel

Thanks for getting that extra code up there. For now though, my first thought is going to be the same as Kenny's.

You can actually use your main FAQ page as the results page instead of having two different pages. This will cut down on all the extra work you end up having to do while maintaining two pages that actually just do the same thing.

So the first change you want to make is on Search.php. Change the forms action to your main FAQ page like this:

<form method="GET" action="/Content_Management_System_FAQs.php">

Get that going first and then we'll have a closer look from there.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/



Itsnoprob
User

Mar 16, 2009, 1:38 PM

Post #5 of 10 (2049 views)
Shortcut
Re: [ross] Help needed, please, to get started with Search... [In reply to] Can't Post

Hi Ross,

Initial change made as requested to http://www.itsnoprob.co.uk/Content_Management_System_FAQs.php, although this is a multi-page section and answers are on http://www.itsnoprob.co.uk/faqPage.php

No apparent difference in terms of end result???

Thanks for any help you can give.

Nigel

[b][url]http://www.Itsnoprob.co.uk[/url][/b]

[b]Personal Service on the Net![/b]

(This post was edited by Itsnoprob on Mar 16, 2009, 2:26 PM)


Itsnoprob
User

Mar 17, 2009, 3:46 AM

Post #6 of 10 (2027 views)
Shortcut
Re: [Itsnoprob] Help needed, please, to get started with Search... [In reply to] Can't Post

I have been having a think about this....

The online documentation is pretty clear about setting up a simple 'keyword' search box.

Perhaps the easiest way to 'sort me out' would be if someone would be good enough to supply example code for a results page that works rather than trying to sort out the mess I've got myself into????

Many thanks,

Nigel

[b][url]http://www.Itsnoprob.co.uk[/url][/b]

[b]Personal Service on the Net![/b]


ross
Staff / Moderator


Mar 17, 2009, 7:04 AM

Post #7 of 10 (2013 views)
Shortcut
Re: [Itsnoprob] Help needed, please, to get started with Search... [In reply to] Can't Post

Hi Nigel

Thanks for getting back in touch. We are talking about two different pages now though, and I am not quite sure how you have this setup.

Are you saying one page lists all the questions and the other page lists all the answers?

Also, it looks like the account you are using to connect CMS Builder to your database has been changed so your pages don't actually work right now. You'll need to contact your webhost and ask them to adjust the account so it can access the database again.

Let me know and we'll go from there. Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/



Itsnoprob
User

Mar 17, 2009, 7:26 AM

Post #8 of 10 (2009 views)
Shortcut
Re: [ross] Help needed, please, to get started with Search... [In reply to] Can't Post

Yes to the first question, Ross.

I have been trying to fix today and got even more screwed up - the system should now be up and running again

Cheers,

Nigel

[b][url]http://www.Itsnoprob.co.uk[/url][/b]

[b]Personal Service on the Net![/b]


Dave
Staff / Moderator


Mar 17, 2009, 11:09 AM

Post #9 of 10 (1998 views)
Shortcut
Re: [Itsnoprob] Help needed, please, to get started with Search... [In reply to] Can't Post

Hi Nigel,

I noticed on your search_results.php code you posted that you're using a older version of CMS Builder. I'd recommend upgrading or if you already have upgraded then re-creating the code from the code generator.

>supply example code for a results page that works

There's almost no difference between a regular results page like you have here that lists all records:
http://www.itsnoprob.co.uk/Content_Management_System_FAQs.php

And a "search" results page. The only difference is when you a submit a search form with specially named fields (as described in the search docs here: http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html) it limits the results.

Here's an example link that searches for news:
http://www.itsnoprob.co.uk/Content_Management_System_FAQs.php?answer_keyword=news

So to create a search results page you just create a regular list page and point your search form at it.

Hope that helps, let me know if ou have more questions.

Dave Edis - Senior Developer
interactivetools.com
 


Itsnoprob
User

Mar 18, 2009, 2:32 AM

Post #10 of 10 (1983 views)
Shortcut
Re: [Dave] Help needed, please, to get started with Search... [In reply to] Can't Post

Thank you very much!

I cannot believe, now that you've shown me, what a meal I was making out of this!

Thanks again,

Nigel

[b][url]http://www.Itsnoprob.co.uk[/url][/b]

[b]Personal Service on the Net![/b]