| Author |
Message |
hinksta Worker


Joined: Dec 23, 2005 Posts: 226 Location: UK
|
Posted:
Wed Nov 29, 2006 1:37 pm |
|
I've made a database search programe and I'm trying to get it to work as a nuke module.
So far it loads ok but when I do a search it returns Sorry, that module file was not found.
here's the search: action=\"modules.php?name=MySearch\"
if i hover over the search btn i see: modules.php?name=MySearch
but the returned link is: modules.php?search=searchterm
it should be: modules.php?name=MySearch&search=searchterm |
|
|
|
 |
fkelly Moderator

Joined: Aug 30, 2005 Posts: 3186 Location: near Albany NY
|
Posted:
Wed Nov 29, 2006 1:45 pm |
|
It would probably be easier if you posted the code for your button. But maybe this will help: there is a search button in the anagram theme.php (we were debugging it for RN2.10 yesterday). Look in the themeheader function for it and you should be able to clone something that works from it. |
|
|
|
 |
evaders99 Former Moderator in Good Standing

Joined: Apr 30, 2004 Posts: 3221
|
Posted:
Wed Nov 29, 2006 1:52 pm |
|
Make sure the form uses POST and not GET |
|
|
|
 |
hinksta Worker


Joined: Dec 23, 2005 Posts: 226 Location: UK
|
Posted:
Wed Nov 29, 2006 2:07 pm |
|
that was fast, thanks it was the GET, saw it in anagram theme.php, the search is now working.
For my next problem, It has a paging system that also has the same error and i'm guessing it's the GET again. Any clues
| Code: | if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
if(isset($_GET['search']))
{
$search = $_GET['search'];
} |
|
|
|
|
 |
fkelly Moderator

Joined: Aug 30, 2005 Posts: 3186 Location: near Albany NY
|
Posted:
Wed Nov 29, 2006 2:31 pm |
|
The first search button in anagram was a post and it worked. Historically the second one (which was intended for topics) was a get and it never worked. Until you see RN2.10 that is. If you are doing a $_GET as in your code that won't work. If you pass 'page' via a POST then you'll need to a $_POST['page'] and likewise for the search. |
|
|
|
 |
hinksta Worker


Joined: Dec 23, 2005 Posts: 226 Location: UK
|
Posted:
Wed Nov 29, 2006 2:35 pm |
|
I changed it to this but makes no difference
| Code: | if(isset($_POST["page"])) {
$pageNum = ($_POST["page"]);
}
if(isset($_POST["search"])) {
$search = ($_POST["search"]);
} |
|
|
|
|
 |
fkelly Moderator

Joined: Aug 30, 2005 Posts: 3186 Location: near Albany NY
|
Posted:
Wed Nov 29, 2006 2:47 pm |
|
I think you need single quotes around page and search. I've never tried it with double. |
|
|
|
 |
hinksta Worker


Joined: Dec 23, 2005 Posts: 226 Location: UK
|
Posted:
Wed Nov 29, 2006 3:07 pm |
|
Got it, Changed the quotes and changed
| Code: | $self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " $page ";
}
else
{
$nav .= " <a href=\"$self?page=$page&search=$search\">$page</a> ";
}
} |
to | Code: | $self = "modules.php?name=$module_name";
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " $page ";
}
else
{
$nav .= " <a href=\"$self&page=$page&search=$search\">$page</a> ";
}
} |
Thanks for your help, I may be back later when I start trying to limit the number of page links.  |
|
|
|
 |
hinksta Worker


Joined: Dec 23, 2005 Posts: 226 Location: UK
|
Posted:
Wed Nov 29, 2006 6:02 pm |
|
It' not as fixed as i thought...
The paging has stopped going to - Sorry, that module file was not found
but now all numbered page links go to page 1, not the corresponding page number. |
|
|
|
 |
hinksta Worker


Joined: Dec 23, 2005 Posts: 226 Location: UK
|
Posted:
Wed Nov 29, 2006 7:12 pm |
|
I put this code back and it works,
| Code: | if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
if(isset($_GET['search']))
{
$search = $_GET['search'];
} |
anyone know much about limiting the number of page links? |
|
|
|
 |
|
|
|
|