probably easy solved problem with list-menu?
Posted: Mon Dec 28, 2009 5:23 pm
Hi!
Im using a forum that is called e107 (http://www.e107.org) which is build in php.
Im editing this plugin:
http://plugins.keal.me.uk/plugins/recip ... ecipes.php
and run into a problem.
In the "Select Category" (see picture below) I succeded to list all the posts from a single author instead of categories by editing this code:
into:
what i basically did was to replace the recipe_category with recipe_author.
The function works but the problem is that now I get a list that looks like this:

as you can see the authors are repeating eachother. I just want the different authors to be displayed once.
I was thinking to solve it by count the project_author in the project_author and if they where more than 1 i just displayed one but since im not very good in php I run into problems. This is what I tried anyway:
I know that would never work and the echo text and everything is not the right way but maybe if someone want to help to dig a bit deeper into this?
Heres a picture from the database from phpmyadmin:

thanks a lot! any help what so ever would be very much apreciated!!!
Im using a forum that is called e107 (http://www.e107.org) which is build in php.
Im editing this plugin:
http://plugins.keal.me.uk/plugins/recip ... ecipes.php
and run into a problem.
In the "Select Category" (see picture below) I succeded to list all the posts from a single author instead of categories by editing this code:
Code: Select all
$recipemenu_selcat = '
<select class="tbox" name="recipemenu_select" onchange="this.form.submit()">
<option value="" >' . RCPEMENU_111 . '</option>';
if ($sql->db_Select('recipemenu_category', '*', ' order by recipe_category_name', 'nowhere', false))
{
while ($recipemenu_row = $sql->db_Fetch())
{
extract($recipemenu_row);
$recipemenu_selcat .= "<option value='{$recipe_category_id}' ";
if ($recipe_category_id == $recipemenu_recipecat)
{
$recipemenu_selcat .= ' selected="selected"';
$recipe_catdesc = $recipe_category_description;
$recipemenu_catname = $recipe_category_name;
$recipemenu_where = "recipe_category='$recipemenu_recipecat'";
if ($recipemenu_row['recipe_category_icon'] && file_exists('images/caticons/' . $recipemenu_row['recipe_category_icon']))
{
$recipemenu_caticon = '<img src="images/caticons/' . $recipemenu_row['recipe_category_icon'] . '" style="border:0;" alt="" />';
}
}
$recipemenu_selcat .= '>' . $tp->toFORM($recipe_category_name) . '</option>';
} // while
}
else
{
$recipemenu_selcat .= '<option value="0">' . RCPEMENU_4 . '</option>';
}
$recipemenu_selcat .= '</select>';Code: Select all
// START CODE
$recipemenu_selcat = '
<select class="tbox" name="recipemenu_select" onchange="this.form.submit()">
<option value="" >' . RCPEMENU_111 . '</option>';
if ($sql->db_Select('recipemenu_recipes', '*', ' order by recipe_author', 'nowhere', false))
{
while ($recipemenu_row = $sql->db_Fetch())
{
extract($recipemenu_row);
$recipemenu_selcat .= "<option value='{$recipe_author}' ";
if ($recipe_author == $recipemenu_recipecat)
{
$recipemenu_selcat .= ' selected="selected"';
$recipe_catdesc = $recipe_author_description;
$recipemenu_catname = $recipe_author;
$recipemenu_where = "recipe_author='$recipemenu_recipecat'";
if ($recipemenu_row['recipe_author_icon'] && file_exists('images/caticons/' . $recipemenu_row['recipe_author_icon']))
{
$recipemenu_caticon = '<img src="images/caticons/' . $recipemenu_row['recipe_author_icon'] . '" style="border:0;" alt="" />';
}
}
$recipemenu_bortmedborjan = explode(".", $recipemenu_row['recipe_author'], 2);
$recipemenu_lank = $tp->toFORM($recipemenu_bortmedborjan[1], false);
$recipemenu_selcat .= '>' . $recipemenu_lank . '</option>';
} // while
}
else
{
$projectmenu_selcat .= '<option value="0">' . RCPEMENU_4 . '</option>';
}
$projectmenu_selcat .= '</select>';
// END CODE The function works but the problem is that now I get a list that looks like this:

as you can see the authors are repeating eachother. I just want the different authors to be displayed once.
I was thinking to solve it by count the project_author in the project_author and if they where more than 1 i just displayed one but since im not very good in php I run into problems. This is what I tried anyway:
Code: Select all
$text = "";
$count_project_author = $sql->db_Count("projectmenu_projects", "*", "project_author", ?????);
if($count_project_author > 1)
echo $text;Heres a picture from the database from phpmyadmin:

thanks a lot! any help what so ever would be very much apreciated!!!
