Page search

14 posts by 2 authors in: Forums > CMS Builder
Last Post: January 16, 2008   (RSS)

Re: [Djulia] Page search

By Dave - January 14, 2008

You have multiple viewers on one page right (one to show the menu, one to show the pages)?

What happens is the viewers get the search keywords from the url. So if you have mypage.php?title_keyword=house then all the viewers on the page will only show records matching that.

You can tell a viewer to ignore the keywords and show only specified records by specifying your own where option. This is the WHERE statement that is used in the MySQL query. It could be 'num = 3' or 'title = "something"' or to show everything all the time '1' since that's always true.

To show all the menu options all the time try this:

$options['where'] = '1';

Hope that helps.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Page search

By Djulia - January 14, 2008

Hi Dave,

In fact, I use this code to obtain the menu on the page of search.

<!-- show menu -->
<ul id="navlist">
<?php
foreach ($listRows as $menuRecord):
$pageLink = "/.../{$menuRecord['filename']}/";
$isSelected = $requestedPage == $menuRecord['filename'];
?>

<?php if ($isSelected): ?>
<li><a href="<?php echo $pageLink; ?>"><?php echo $menuRecord['title'] ?></a></b></li>
<?php else: ?>
<li><a href="<?php echo $pageLink; ?>"><?php echo $menuRecord['title'] ?></a></li>
<?php endif ?>
<?php endforeach ?>
</ul>
<!-- /show menu -->


But if I place "where" on 1, the search does not function.
All the recordings are shown.

An idea ?

Thank you for your assistance.

Djulia

Re: [Djulia] Page search

By Dave - January 14, 2008

Right, I remember, because we wrote that custom code for you and we weren't thinking about search way back then. Ok, I remember.

Let me research that a little bit and get back to you with the best solution.

Can you attach your schema file so I can recreate it locally? It's /data/schema/demo.ini.php
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Page search

By Djulia - January 14, 2008

Here my file.

Thank,

Djulia
Attachments:

demo-ini.php 5K

Re: [Dave] Page search

By Djulia - January 14, 2008 - edited: January 14, 2008

Just for information.

There is an error 404 which is caused by admin.php :
"admin.php?menu=demo&action=edit&num=5"

Error : /tinymce3/plugins/fullscreen/editor_plugin.js

Djulia

Re: [Djulia] Page search

By Dave - January 15, 2008

Hi Djuila,

Try this for showing your menu all the time:

<!-- show menu -->
<ul id="navlist">
<?php

require_once "../lib/viewer_functions.php";
$options = array();
$options['tableName'] = 'demo';
$options['titleField'] = 'title';
$options['viewerUrl'] = 'demoPage.php';
$options['perPage'] = '9999';
$options['orderBy'] = 'title';
$options['pageNum'] = '1';
$options['where'] = '1';
list($searchRows, $searchDetails) = getListRows($options);

foreach ($searchRows as $menuRecord):
$menuLink = "{$_SERVER['PHP_SELF']}/{$menuRecord['filename']}/";
$isSelected = $requestedPage == $menuRecord['filename'];
?>

<?php if ($isSelected): ?>
<li><a href="<?php echo $menuLink; ?>"><?php echo $menuRecord['title'] ?></a></b></li>
<?php else: ?>
<li><a href="<?php echo $menuLink; ?>"><?php echo $menuRecord['title'] ?></a></li>
<?php endif ?>
<?php endforeach ?>
</ul>
<!-- /show menu -->


>There is an error 404 which is caused by admin.php
>Error : /tinymce3/plugins/fullscreen/editor_plugin.js

Thanks, we'll include those in the next version and I've attached them to this post. You can upload them to /tinymce3/plugins/fullscreen/

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
Attachments:

fullscreen.zip 3K

Re: [Dave] Page search

By Djulia - January 15, 2008

Thank you, that functions perfectly. [:)]

But, I have another problem with the link
/search.php?content_keyword=un&page=2

It does not function.

It always seems to give the first found recording.

&page=2 is the good value ?

Thank you for your answer.

Djulia

Re: [Djulia] Page search

By Dave - January 15, 2008

It's because the page number is hardcoded at the top. That's what you wanted on the other pages but not on the search. Try changing it back to this and it will get the page number value from the url:

$options['pageNum'] = '';

Try change the pageNum value and see if that helps.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Page search

By Djulia - January 15, 2008

Yes, that functions.

But, there is a last problem.
The menu is not available on page 2.

I do not manage to find the origin of my problem in my file.

You have an idea ?

Djulia
Attachments:

demo-php.txt 5K