puesto de consulta dentro de una función en php
- northstjarna
- Beginner


- Registrado: Nov 14, 2006
- Mensajes: 58
- Loc: Chertsey, UK
- Status: Offline
Hola tratando de poner una consulta dentro de una función no está seguro de su posible hacer esto en php. ¿Puede hacerlo en ColdFusion.
Básicamente quiero llamar a una consulta recursiva que se puede seleccionar a través de un documento de identidad.
Su diciéndome que no puedo hacer esto dentro de una función.
Advertencia: mysql_select_db (): suministrado no es argumento válido un recurso de MySQL-Link en la Biblioteca....
¿Cómo voy a ser capaz de lograr esto? Tal vez en una clase?
Cualquier ayuda, gracias
Andi
Básicamente quiero llamar a una consulta recursiva que se puede seleccionar a través de un documento de identidad.
Código: [ Select ]
function getmenu($menu_id){
/* get the top most level menu */
mysql_select_db($database_eggbox, $eggbox);
$query_top_menu = "select * from menu where menu_parent_menu_id = $menu_id";
$top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
$row_top_menu = mysql_fetch_assoc($top_menu);
$totalRows_top_menu = mysql_num_rows($top_menu);
/* loop and echo */
}
getmenu(0);
/* get the top most level menu */
mysql_select_db($database_eggbox, $eggbox);
$query_top_menu = "select * from menu where menu_parent_menu_id = $menu_id";
$top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
$row_top_menu = mysql_fetch_assoc($top_menu);
$totalRows_top_menu = mysql_num_rows($top_menu);
/* loop and echo */
}
getmenu(0);
- function getmenu($menu_id){
- /* get the top most level menu */
- mysql_select_db($database_eggbox, $eggbox);
- $query_top_menu = "select * from menu where menu_parent_menu_id = $menu_id";
- $top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
- $row_top_menu = mysql_fetch_assoc($top_menu);
- $totalRows_top_menu = mysql_num_rows($top_menu);
- /* loop and echo */
- }
- getmenu(0);
Su diciéndome que no puedo hacer esto dentro de una función.
Advertencia: mysql_select_db (): suministrado no es argumento válido un recurso de MySQL-Link en la Biblioteca....
¿Cómo voy a ser capaz de lograr esto? Tal vez en una clase?
Cualquier ayuda, gracias
Andi
- Anonymous
- Bot


- Registrado: 25 Feb 2008
- Mensajes: ?
- Loc: Ozzuland
- Status: Online
Abril 26th, 2010, 3:46 pm
- joebert
- Sledgehammer


- Registrado: Feb 10, 2004
- Mensajes: 13455
- Loc: Florida
- Status: Offline
Usted necesidad de utilizar el "global" palabra clave para que el database_eggbox $ y otras variables relevantes visibles dentro de la función.
O bien, pasar las variables relevantes como argumentos en la función.
PHP Código: [ Select ]
function getmenu($menu_id)
{
global $database_eggbox, $eggbox;
// ...
}
{
global $database_eggbox, $eggbox;
// ...
}
- function getmenu($menu_id)
- {
- global $database_eggbox, $eggbox;
- // ...
- }
O bien, pasar las variables relevantes como argumentos en la función.
PHP Código: [ Select ]
function getmenu($menu_id, $database_eggbox, $eggbox){}
- northstjarna
- Beginner


- Registrado: Nov 14, 2006
- Mensajes: 58
- Loc: Chertsey, UK
- Status: Offline
Por supuesto, ahora.... Entendido de trabajo...
Sólo necesito un poco más el código para que funcione de forma recursiva ahora; o)
Gracias por su ayuda
Código: [ Select ]
mysql_select_db($database_eggbox, $eggbox);
function getmenu($menu_id){
/* get the top most level menu */
global $database_eggbox, $eggbox;
$query_top_menu = "select * from menu where menu_parent_menu_id = $menu_id";
$top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
$row_top_menu = mysql_fetch_assoc($top_menu);
$totalRows_top_menu = mysql_num_rows($top_menu);
do {
echo $row_top_menu['menu_text'];
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
}
function getmenu($menu_id){
/* get the top most level menu */
global $database_eggbox, $eggbox;
$query_top_menu = "select * from menu where menu_parent_menu_id = $menu_id";
$top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
$row_top_menu = mysql_fetch_assoc($top_menu);
$totalRows_top_menu = mysql_num_rows($top_menu);
do {
echo $row_top_menu['menu_text'];
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
}
- mysql_select_db($database_eggbox, $eggbox);
- function getmenu($menu_id){
- /* get the top most level menu */
- global $database_eggbox, $eggbox;
- $query_top_menu = "select * from menu where menu_parent_menu_id = $menu_id";
- $top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
- $row_top_menu = mysql_fetch_assoc($top_menu);
- $totalRows_top_menu = mysql_num_rows($top_menu);
- do {
- echo $row_top_menu['menu_text'];
- } while ($row_top_menu = mysql_fetch_assoc($top_menu));
- }
Sólo necesito un poco más el código para que funcione de forma recursiva ahora; o)
Gracias por su ayuda
- joebert
- Sledgehammer


- Registrado: Feb 10, 2004
- Mensajes: 13455
- Loc: Florida
- Status: Offline
Ahora que la pregunta se responde, debo mencionar que mediante una consulta recursiva no es generalmente una buena cosa que hacer.
Parece que usted está construyendo una jerarquía, que se puede hacer con una consulta y dos bucles, si utiliza una de sus llaves en item_id matriz y las referencias a su vez un arreglo unidimensional en una matriz virtual multi-dimensional.
Esto está tomado de otro sitio para su no ir a coincidir con su código, pero espero que el concepto aquí es fácil de ver.
Parece que usted está construyendo una jerarquía, que se puede hacer con una consulta y dos bucles, si utiliza una de sus llaves en item_id matriz y las referencias a su vez un arreglo unidimensional en una matriz virtual multi-dimensional.
Esto está tomado de otro sitio para su no ir a coincidir con su código, pero espero que el concepto aquí es fácil de ver.
PHP Código: [ Select ]
$category_lineage = array();
$result = $db->query('SELECT category_id, parent_id, label FROM ' . CATEGORIES_TABLE, MYSQLI_USE_RESULT);
while($row = $result->fetch_object())
{
$row->sub_categories = array();
$category_lineage[$row->category_id] = $row;
}
$result->close();
foreach($category_lineage as $key => $val)
{
if($val->parent_id)
{
$category_lineage[$val->parent_id]->sub_categories[$key] =& $category_lineage[$key];
}
}
$result = $db->query('SELECT category_id, parent_id, label FROM ' . CATEGORIES_TABLE, MYSQLI_USE_RESULT);
while($row = $result->fetch_object())
{
$row->sub_categories = array();
$category_lineage[$row->category_id] = $row;
}
$result->close();
foreach($category_lineage as $key => $val)
{
if($val->parent_id)
{
$category_lineage[$val->parent_id]->sub_categories[$key] =& $category_lineage[$key];
}
}
- $category_lineage = array();
- $result = $db->query('SELECT category_id, parent_id, label FROM ' . CATEGORIES_TABLE, MYSQLI_USE_RESULT);
- while($row = $result->fetch_object())
- {
- $row->sub_categories = array();
- $category_lineage[$row->category_id] = $row;
- }
- $result->close();
- foreach($category_lineage as $key => $val)
- {
- if($val->parent_id)
- {
- $category_lineage[$val->parent_id]->sub_categories[$key] =& $category_lineage[$key];
- }
- }
Strong with this one, the sudo is.
- northstjarna
- Beginner


- Registrado: Nov 14, 2006
- Mensajes: 58
- Loc: Chertsey, UK
- Status: Offline
Hola No quise decir cuando me refería recursivas como ésta.... ; O)
de nivel superior
nivel sub-
sub sub nivel
nivel sub-
de nivel superior
Esto funciona aunque no sé si es la forma más eficiente de hacerlo.
function getmenu($menu_level){
/* get the top most level menu */
global $database_eggbox, $eggbox;
$query_top_menu = "select * from menu where menu_parent_menu_id = 0 order by menu_display_order";
$top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
$row_top_menu = mysql_fetch_assoc($top_menu);
$totalRows_top_menu = mysql_num_rows($top_menu);
if ($menu_level <> 0) {
echo "<ul>";
do {
echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_top_menu['menu_text'] . "</a>";
$menuid = $row_top_menu['menu_id'];
$query_has_children = "select * from menu where menu_parent_menu_id = $menuid order by menu_display_order";
$has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
$row_has_children = mysql_fetch_assoc($has_children);
$totalRows_has_children = mysql_num_rows($has_children);
if($totalRows_has_children > 0){
getchildren($menuid,0);
} else {
echo "</li>";
}
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
echo "</ul>";
} elseif ($menu_level == 0) {
echo "<ul>";
do {
echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_top_menu['menu_text'] . "</a></li>";
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
echo "</ul>";
}
} // End Function
function getchildren ($menuid,$count) {
/* get the next level menu */
global $database_eggbox, $eggbox;
$query_child_menu = "select * from menu where menu_parent_menu_id = $menuid order by menu_display_order";
$child_menu = mysql_query($query_child_menu, $eggbox) or die(mysql_error());
$row_child_menu = mysql_fetch_assoc($child_menu);
$totalRows_child_menu = mysql_num_rows($child_menu);
do {
if($count == 0) {
echo "<ul>";
}
echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_child_menu['menu_text'] . "</a>";
$menuidd = $row_child_menu['menu_id'];
$query_has_childrens = "select * from menu where menu_parent_menu_id = $menuidd order by menu_display_order";
$has_childrens = mysql_query($query_has_childrens, $eggbox) or die(mysql_error());
$row_has_childrens = mysql_fetch_assoc($has_childrens);
$totalRows_has_childrens = mysql_num_rows($has_childrens);
if($totalRows_has_childrens > 0){
getchildren($menuidd,0);
} else {
"</li>";
}
if($count+1 == $totalRows_child_menu) {
echo "</ul>";
}
$count += 1;
} while ($row_child_menu = mysql_fetch_assoc($child_menu));
} // end function
Gracias por su perspicacia aunque...
de nivel superior
nivel sub-
sub sub nivel
nivel sub-
de nivel superior
Esto funciona aunque no sé si es la forma más eficiente de hacerlo.
Código: [ Select ]
function getmenu($menu_level){
/* get the top most level menu */
global $database_eggbox, $eggbox;
$query_top_menu = "select * from menu where menu_parent_menu_id = 0 order by menu_display_order";
$top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
$row_top_menu = mysql_fetch_assoc($top_menu);
$totalRows_top_menu = mysql_num_rows($top_menu);
if ($menu_level <> 0) {
echo "<ul>";
do {
echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_top_menu['menu_text'] . "</a>";
$menuid = $row_top_menu['menu_id'];
$query_has_children = "select * from menu where menu_parent_menu_id = $menuid order by menu_display_order";
$has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
$row_has_children = mysql_fetch_assoc($has_children);
$totalRows_has_children = mysql_num_rows($has_children);
if($totalRows_has_children > 0){
getchildren($menuid,0);
} else {
echo "</li>";
}
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
echo "</ul>";
} elseif ($menu_level == 0) {
echo "<ul>";
do {
echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_top_menu['menu_text'] . "</a></li>";
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
echo "</ul>";
}
} // End Function
function getchildren ($menuid,$count) {
/* get the next level menu */
global $database_eggbox, $eggbox;
$query_child_menu = "select * from menu where menu_parent_menu_id = $menuid order by menu_display_order";
$child_menu = mysql_query($query_child_menu, $eggbox) or die(mysql_error());
$row_child_menu = mysql_fetch_assoc($child_menu);
$totalRows_child_menu = mysql_num_rows($child_menu);
do {
if($count == 0) {
echo "<ul>";
}
echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_child_menu['menu_text'] . "</a>";
$menuidd = $row_child_menu['menu_id'];
$query_has_childrens = "select * from menu where menu_parent_menu_id = $menuidd order by menu_display_order";
$has_childrens = mysql_query($query_has_childrens, $eggbox) or die(mysql_error());
$row_has_childrens = mysql_fetch_assoc($has_childrens);
$totalRows_has_childrens = mysql_num_rows($has_childrens);
if($totalRows_has_childrens > 0){
getchildren($menuidd,0);
} else {
"</li>";
}
if($count+1 == $totalRows_child_menu) {
echo "</ul>";
}
$count += 1;
} while ($row_child_menu = mysql_fetch_assoc($child_menu));
} // end function
- function getmenu($menu_level){
- /* get the top most level menu */
- global $database_eggbox, $eggbox;
- $query_top_menu = "select * from menu where menu_parent_menu_id = 0 order by menu_display_order";
- $top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
- $row_top_menu = mysql_fetch_assoc($top_menu);
- $totalRows_top_menu = mysql_num_rows($top_menu);
- if ($menu_level <> 0) {
- echo "<ul>";
- do {
- echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_top_menu['menu_text'] . "</a>";
- $menuid = $row_top_menu['menu_id'];
- $query_has_children = "select * from menu where menu_parent_menu_id = $menuid order by menu_display_order";
- $has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
- $row_has_children = mysql_fetch_assoc($has_children);
- $totalRows_has_children = mysql_num_rows($has_children);
- if($totalRows_has_children > 0){
- getchildren($menuid,0);
- } else {
- echo "</li>";
- }
- } while ($row_top_menu = mysql_fetch_assoc($top_menu));
- echo "</ul>";
- } elseif ($menu_level == 0) {
- echo "<ul>";
- do {
- echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_top_menu['menu_text'] . "</a></li>";
- } while ($row_top_menu = mysql_fetch_assoc($top_menu));
- echo "</ul>";
- }
- } // End Function
- function getchildren ($menuid,$count) {
- /* get the next level menu */
- global $database_eggbox, $eggbox;
- $query_child_menu = "select * from menu where menu_parent_menu_id = $menuid order by menu_display_order";
- $child_menu = mysql_query($query_child_menu, $eggbox) or die(mysql_error());
- $row_child_menu = mysql_fetch_assoc($child_menu);
- $totalRows_child_menu = mysql_num_rows($child_menu);
- do {
- if($count == 0) {
- echo "<ul>";
- }
- echo "<li><a href='index.php?' title='opens in same window' target='_self' >" . $row_child_menu['menu_text'] . "</a>";
- $menuidd = $row_child_menu['menu_id'];
- $query_has_childrens = "select * from menu where menu_parent_menu_id = $menuidd order by menu_display_order";
- $has_childrens = mysql_query($query_has_childrens, $eggbox) or die(mysql_error());
- $row_has_childrens = mysql_fetch_assoc($has_childrens);
- $totalRows_has_childrens = mysql_num_rows($has_childrens);
- if($totalRows_has_childrens > 0){
- getchildren($menuidd,0);
- } else {
- "</li>";
- }
- if($count+1 == $totalRows_child_menu) {
- echo "</ul>";
- }
- $count += 1;
- } while ($row_child_menu = mysql_fetch_assoc($child_menu));
- } // end function
Gracias por su perspicacia aunque...
- joebert
- Sledgehammer


- Registrado: Feb 10, 2004
- Mensajes: 13455
- Loc: Florida
- Status: Offline
Sí, veo lo que está haciendo. Usted parece estar en algún tipo de plazo, sin embargo, lo que significa que no tienen tiempo para nada repetición del trabajo, así que no perderá ninguno de nuestro tiempo hablando por un oído y sale por el otro. 
Strong with this one, the sudo is.
- northstjarna
- Beginner


- Registrado: Nov 14, 2006
- Mensajes: 58
- Loc: Chertsey, UK
- Status: Offline
- joebert
- Sledgehammer


- Registrado: Feb 10, 2004
- Mensajes: 13455
- Loc: Florida
- Status: Offline
¿Por qué el cepillado lo que tengo que decir que fuera?
¿Cuáles son los puntos suspensivos para sustituir?
¿Cuáles son sus intenciones!
Quote:
Gracias por su perspicacia aunque...
¿Cuáles son los puntos suspensivos para sustituir?
Quote:
Gracias por su comprensión, sin embargo, [imbécil]
Quote:
Gracias por su comprensión, sin embargo, [pero no entiendo algo]
Quote:
Gracias por su comprensión, sin embargo, [vamos a ver cuánto tiempo puedo troll]
¿Cuáles son sus intenciones!
Strong with this one, the sudo is.
- northstjarna
- Beginner


- Registrado: Nov 14, 2006
- Mensajes: 58
- Loc: Chertsey, UK
- Status: Offline
Hola,
Soy un desarrollador coldsufion para mis habilidades se han convertido en un php ropey poco tengo miedo...
Mi pregunta original era cómo poner una consulta dentro de una función. Usted amablemente me enseño como hacer eso así que gracias.
Lo sentimos, no estoy cepillando lo que dijiste. Me mearly te agradece. Puedo ver lo que estaba haciendo y que es útil como yo puede intentar que ..
La enfermedad publicar el código en su totalidad más adelante para que pueda ver. No lo tengo conmigo ahora mismo, y estoy todavía trabajando en ello...Ahora tengo que hacer que el menú colapsable y expandible que es lo complicado que viene.
Yo soy el idiota sí...: O)
Soy un desarrollador coldsufion para mis habilidades se han convertido en un php ropey poco tengo miedo...
Mi pregunta original era cómo poner una consulta dentro de una función. Usted amablemente me enseño como hacer eso así que gracias.
Quote:
¿Por qué el cepillado lo que tengo que decir que fuera?
Lo sentimos, no estoy cepillando lo que dijiste. Me mearly te agradece. Puedo ver lo que estaba haciendo y que es útil como yo puede intentar que ..
Quote:
¿Cuáles son los puntos suspensivos para sustituir?
La enfermedad publicar el código en su totalidad más adelante para que pueda ver. No lo tengo conmigo ahora mismo, y estoy todavía trabajando en ello...Ahora tengo que hacer que el menú colapsable y expandible que es lo complicado que viene.
Yo soy el idiota sí...: O)
- northstjarna
- Beginner


- Registrado: Nov 14, 2006
- Mensajes: 58
- Loc: Chertsey, UK
- Status: Offline
Ok bebé pasteles que te prometí, pero el código de la banda ancha se redujo. Pero aquí es todo lo que finalmente...Sistema totalmente recursivo menú colapsable. Si crees que puede mejorar en él, por favor hágamelo saber que yo todavía creo que hay una mejor manera de hacerlo. Mis conocimientos de php son aún bastante fibroso ya que vengo de un fondo CF...Pero Ho hum aquí está...
Código: [ Select ]
mysql_select_db($database_eggbox, $eggbox);
/* get the home page at start*/
$query_default_url = "select * from menu where menu_text = 'Home' order by menu_display_order";
$default_url = mysql_query($query_default_url, $eggbox) or die(mysql_error());
$row_default_url = mysql_fetch_assoc($default_url);
$totalRows_default_url = mysql_num_rows($default_url);
if (isset($_GET['menu_id'])) {
$urlmenu_id = $_GET['menu_id'];
} else {
$urlmenu_id = $row_default_url['menu_id'];
}
///////////////////////////////////////////////////////////////
/////////////////////* functions */////////////////////////////
///////////////////////////////////////////////////////////////
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
/* get breadcrumb function */
function getbreadcrumb($arraycount,$parentmenuid){
/* get the current level menu */
global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
$query_last_breadcrumb = "select * from menu where menu_id = $parentmenuid order by menu_display_order";
$last_breadcrumb = mysql_query($query_last_breadcrumb, $eggbox) or die(mysql_error());
$row_last_breadcrumb = mysql_fetch_assoc($last_breadcrumb);
$totalRows_last_breadcrumb = mysql_num_rows($last_breadcrumb);
$array_menu[$arraycount][0] = $row_last_breadcrumb['menu_id'];
$array_menu[$arraycount][1] = $row_last_breadcrumb['page_id'];
$array_menu[$arraycount][2] = $row_last_breadcrumb['menu_text'];
$array_menu[$arraycount][3] = $row_last_breadcrumb['menu_parent_menu_id'];
if($array_menu[$arraycount][0] != "") {
getbreadcrumb($arraycount+1,$array_menu[$arraycount][3]);
}
if($arraycount == count){
echo $array_menu[$arraycount][2];
} else {
$menuid = $array_menu[$arraycount][0];
echo "<li><a href='index.php?menu_id=$menuid' title='opens in same window' target='_self' >" . $array_menu[$arraycount][2] . "</a> : </li>";
}
mysql_free_result($last_breadcrumb);
} // end function
/* get menu functions */
function getmenu($menu_level,$menuid){
/* get the top most level menu */
global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
$query_top_menu = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
$top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
$row_top_menu = mysql_fetch_assoc($top_menu);
$totalRows_top_menu = mysql_num_rows($top_menu);
if ($menu_level == 0) { // Top menu for nav bar only
echo "<ul>";
do {
$menuid = $row_top_menu['menu_id'];
if($urlmenu_id == $menuid) {
$selectedclass = "class='selected'";
} else {
$selectedclass = "";
}
if($row_top_menu['menu_alt_location'] != "") {
// Alternative location like google
if(substr($row_top_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_top_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_top_menu['menu_alt_location'];}
$title = "opens in new window";
$target = "_blank";
} else {
// site menu
$menuurl = "index.php?menu_id=$menuid";
$title = "opens in same window";
$target = "_self";
} // End if
echo "<li><a href='$menuurl' title='$target' target='$target' $selectedclass >" . $row_top_menu['menu_text'] . "</a></li>";
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
echo "</ul>";
} elseif ($menu_level == 1) {
if($totalRows_top_menu > 0) { // full side menu and you don't want a top menu
echo "<ul>";
$count = 0;
do {
$menuid = $row_top_menu['menu_id'];
if($urlmenu_id == $menuid) {
$selectedclass = "class='selected'";
} else {
$selectedclass = "";
}
if($row_top_menu['menu_alt_location'] != "") {
// Alternative location like google
if(substr($row_top_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_top_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_top_menu['menu_alt_location'];}
$title = "opens in new window";
$target = "_blank";
} else {
// Site menu
$menuurl = "index.php?menu_id=$menuid";
$title = "opens in same window";
$target = "_self";
} // End if
echo "<li><a href='$menuurl' title='$title' target='$target' >" . $row_top_menu['menu_text'] . "</a>";
$query_has_children = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
$has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
$row_has_children = mysql_fetch_assoc($has_children);
$totalRows_has_children = mysql_num_rows($has_children);
if($totalRows_has_children > 0 && $array_menu[sizeof($array_menu)-2][0] == $menuid){
getchildren($menuid,0,3);
echo "</li>";
} else {
echo "</li>";
}
$count += 1;
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
echo "</ul>";
} // End if
mysql_free_result($has_children);
} elseif ($menu_level == 2) { // Second level menu based on top level menu
if($totalRows_top_menu > 0) {
$count = 0;
do {
$menuid = $row_top_menu['menu_id'];
$query_has_children = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
$has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
$row_has_children = mysql_fetch_assoc($has_children);
$totalRows_has_children = mysql_num_rows($has_children);
if($totalRows_has_children > 0 && $array_menu[sizeof($array_menu)-2][0] == $menuid){
getchildren($menuid,0,3);
}
$count += 1;
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
} // End if
mysql_free_result($has_children);
} // End if function for menu levels
mysql_free_result($top_menu);
} // End Function
function getchildren ($menuid,$count,$count_level) {
/* get the next level menu */
global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
$query_child_menu = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
$child_menu = mysql_query($query_child_menu, $eggbox) or die(mysql_error());
$row_child_menu = mysql_fetch_assoc($child_menu);
$totalRows_child_menu = mysql_num_rows($child_menu);
do {
if($count == 0) {
echo "<ul>";
}
$menuidd = $row_child_menu['menu_id'];
if($urlmenu_id == $menuidd) {
$selectedclass = "class='selected'";
} else {
$selectedclass = "";
}
if($row_child_menu['menu_alt_location'] != "") {
// Alternative location like google
if(substr($row_child_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_child_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_child_menu['menu_alt_location'];}
$title = "opens in new window";
$target = "_blank";
} else {
// site menu
$menuurl = "index.php?menu_id=$menuidd";
$title = "opens in same window";
$target = "_self";
} // End if
echo "<li><a href='$menuurl' title='$title' target='$target' $selectedclass >" . $row_child_menu['menu_text'] . "</a>";
$query_has_childrens = "select * from menu where menu_parent_menu_id = $menuidd and menu_display = 1 order by menu_display_order";
$has_childrens = mysql_query($query_has_childrens, $eggbox) or die(mysql_error());
$row_has_childrens = mysql_fetch_assoc($has_childrens);
$totalRows_has_childrens = mysql_num_rows($has_childrens);
if($totalRows_has_childrens > 0 && $array_menu[sizeof($array_menu)-$count_level][0] == $menuidd){
getchildren($menuidd,0,$count_level+1);
echo "</li>";
} else {
echo "</li>";
}
if($count+1 == $totalRows_child_menu) {
echo "</ul>";
}
$count += 1;
} while ($row_child_menu = mysql_fetch_assoc($child_menu));
mysql_free_result($has_childrens);
mysql_free_result($child_menu);
} // end function
/* get content */
$query_page_info = "select menu_id, pages.* from pages inner join menu on pages.page_id = menu.page_id where menu.menu_id = $urlmenu_id";
$page_info = mysql_query($query_page_info, $eggbox) or die(mysql_error());
$row_page_info = mysql_fetch_assoc($page_info);
$totalRows_page_info = mysql_num_rows($page_info);
function getcontent($content){
global $row_page_info;
$content = $row_page_info[$content];
return $content;
} // End function
function getcolumns() {
global $database_eggbox, $eggbox, $row_page_info, $urlmenu_id;
$query_top_top_menu = "select * from menu where menu_parent_menu_id = $urlmenu_id and menu_display = 1 order by menu_display_order";
$top_top_menu = mysql_query($query_top_top_menu, $eggbox) or die(mysql_error());
$row_top_top_menu = mysql_fetch_assoc($top_top_menu);
$totalRows_top_top_menu = mysql_num_rows($top_top_menu);
if($row_page_info['page_lhs_content'] == "" && $row_page_info['page_rhs_content'] == "" && $totalRows_top_top_menu == 0) {
$collhsrhs = "-noLHSRHS";
} elseif($row_page_info['page_rhs_content'] == "" ) {
$collhsrhs = "-noRHS";
} elseif ($row_page_info['page_lhs_content'] == "" || $row_top_top_menu == 0) {
$collhsrhs = "-noLHS";
} else {
$collhsrhs = "";
}
return $collhsrhs;
}
mysql_free_result($page_info);
/* get the home page at start*/
$query_default_url = "select * from menu where menu_text = 'Home' order by menu_display_order";
$default_url = mysql_query($query_default_url, $eggbox) or die(mysql_error());
$row_default_url = mysql_fetch_assoc($default_url);
$totalRows_default_url = mysql_num_rows($default_url);
if (isset($_GET['menu_id'])) {
$urlmenu_id = $_GET['menu_id'];
} else {
$urlmenu_id = $row_default_url['menu_id'];
}
///////////////////////////////////////////////////////////////
/////////////////////* functions */////////////////////////////
///////////////////////////////////////////////////////////////
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
/* get breadcrumb function */
function getbreadcrumb($arraycount,$parentmenuid){
/* get the current level menu */
global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
$query_last_breadcrumb = "select * from menu where menu_id = $parentmenuid order by menu_display_order";
$last_breadcrumb = mysql_query($query_last_breadcrumb, $eggbox) or die(mysql_error());
$row_last_breadcrumb = mysql_fetch_assoc($last_breadcrumb);
$totalRows_last_breadcrumb = mysql_num_rows($last_breadcrumb);
$array_menu[$arraycount][0] = $row_last_breadcrumb['menu_id'];
$array_menu[$arraycount][1] = $row_last_breadcrumb['page_id'];
$array_menu[$arraycount][2] = $row_last_breadcrumb['menu_text'];
$array_menu[$arraycount][3] = $row_last_breadcrumb['menu_parent_menu_id'];
if($array_menu[$arraycount][0] != "") {
getbreadcrumb($arraycount+1,$array_menu[$arraycount][3]);
}
if($arraycount == count){
echo $array_menu[$arraycount][2];
} else {
$menuid = $array_menu[$arraycount][0];
echo "<li><a href='index.php?menu_id=$menuid' title='opens in same window' target='_self' >" . $array_menu[$arraycount][2] . "</a> : </li>";
}
mysql_free_result($last_breadcrumb);
} // end function
/* get menu functions */
function getmenu($menu_level,$menuid){
/* get the top most level menu */
global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
$query_top_menu = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
$top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
$row_top_menu = mysql_fetch_assoc($top_menu);
$totalRows_top_menu = mysql_num_rows($top_menu);
if ($menu_level == 0) { // Top menu for nav bar only
echo "<ul>";
do {
$menuid = $row_top_menu['menu_id'];
if($urlmenu_id == $menuid) {
$selectedclass = "class='selected'";
} else {
$selectedclass = "";
}
if($row_top_menu['menu_alt_location'] != "") {
// Alternative location like google
if(substr($row_top_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_top_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_top_menu['menu_alt_location'];}
$title = "opens in new window";
$target = "_blank";
} else {
// site menu
$menuurl = "index.php?menu_id=$menuid";
$title = "opens in same window";
$target = "_self";
} // End if
echo "<li><a href='$menuurl' title='$target' target='$target' $selectedclass >" . $row_top_menu['menu_text'] . "</a></li>";
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
echo "</ul>";
} elseif ($menu_level == 1) {
if($totalRows_top_menu > 0) { // full side menu and you don't want a top menu
echo "<ul>";
$count = 0;
do {
$menuid = $row_top_menu['menu_id'];
if($urlmenu_id == $menuid) {
$selectedclass = "class='selected'";
} else {
$selectedclass = "";
}
if($row_top_menu['menu_alt_location'] != "") {
// Alternative location like google
if(substr($row_top_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_top_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_top_menu['menu_alt_location'];}
$title = "opens in new window";
$target = "_blank";
} else {
// Site menu
$menuurl = "index.php?menu_id=$menuid";
$title = "opens in same window";
$target = "_self";
} // End if
echo "<li><a href='$menuurl' title='$title' target='$target' >" . $row_top_menu['menu_text'] . "</a>";
$query_has_children = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
$has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
$row_has_children = mysql_fetch_assoc($has_children);
$totalRows_has_children = mysql_num_rows($has_children);
if($totalRows_has_children > 0 && $array_menu[sizeof($array_menu)-2][0] == $menuid){
getchildren($menuid,0,3);
echo "</li>";
} else {
echo "</li>";
}
$count += 1;
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
echo "</ul>";
} // End if
mysql_free_result($has_children);
} elseif ($menu_level == 2) { // Second level menu based on top level menu
if($totalRows_top_menu > 0) {
$count = 0;
do {
$menuid = $row_top_menu['menu_id'];
$query_has_children = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
$has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
$row_has_children = mysql_fetch_assoc($has_children);
$totalRows_has_children = mysql_num_rows($has_children);
if($totalRows_has_children > 0 && $array_menu[sizeof($array_menu)-2][0] == $menuid){
getchildren($menuid,0,3);
}
$count += 1;
} while ($row_top_menu = mysql_fetch_assoc($top_menu));
} // End if
mysql_free_result($has_children);
} // End if function for menu levels
mysql_free_result($top_menu);
} // End Function
function getchildren ($menuid,$count,$count_level) {
/* get the next level menu */
global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
$query_child_menu = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
$child_menu = mysql_query($query_child_menu, $eggbox) or die(mysql_error());
$row_child_menu = mysql_fetch_assoc($child_menu);
$totalRows_child_menu = mysql_num_rows($child_menu);
do {
if($count == 0) {
echo "<ul>";
}
$menuidd = $row_child_menu['menu_id'];
if($urlmenu_id == $menuidd) {
$selectedclass = "class='selected'";
} else {
$selectedclass = "";
}
if($row_child_menu['menu_alt_location'] != "") {
// Alternative location like google
if(substr($row_child_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_child_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_child_menu['menu_alt_location'];}
$title = "opens in new window";
$target = "_blank";
} else {
// site menu
$menuurl = "index.php?menu_id=$menuidd";
$title = "opens in same window";
$target = "_self";
} // End if
echo "<li><a href='$menuurl' title='$title' target='$target' $selectedclass >" . $row_child_menu['menu_text'] . "</a>";
$query_has_childrens = "select * from menu where menu_parent_menu_id = $menuidd and menu_display = 1 order by menu_display_order";
$has_childrens = mysql_query($query_has_childrens, $eggbox) or die(mysql_error());
$row_has_childrens = mysql_fetch_assoc($has_childrens);
$totalRows_has_childrens = mysql_num_rows($has_childrens);
if($totalRows_has_childrens > 0 && $array_menu[sizeof($array_menu)-$count_level][0] == $menuidd){
getchildren($menuidd,0,$count_level+1);
echo "</li>";
} else {
echo "</li>";
}
if($count+1 == $totalRows_child_menu) {
echo "</ul>";
}
$count += 1;
} while ($row_child_menu = mysql_fetch_assoc($child_menu));
mysql_free_result($has_childrens);
mysql_free_result($child_menu);
} // end function
/* get content */
$query_page_info = "select menu_id, pages.* from pages inner join menu on pages.page_id = menu.page_id where menu.menu_id = $urlmenu_id";
$page_info = mysql_query($query_page_info, $eggbox) or die(mysql_error());
$row_page_info = mysql_fetch_assoc($page_info);
$totalRows_page_info = mysql_num_rows($page_info);
function getcontent($content){
global $row_page_info;
$content = $row_page_info[$content];
return $content;
} // End function
function getcolumns() {
global $database_eggbox, $eggbox, $row_page_info, $urlmenu_id;
$query_top_top_menu = "select * from menu where menu_parent_menu_id = $urlmenu_id and menu_display = 1 order by menu_display_order";
$top_top_menu = mysql_query($query_top_top_menu, $eggbox) or die(mysql_error());
$row_top_top_menu = mysql_fetch_assoc($top_top_menu);
$totalRows_top_top_menu = mysql_num_rows($top_top_menu);
if($row_page_info['page_lhs_content'] == "" && $row_page_info['page_rhs_content'] == "" && $totalRows_top_top_menu == 0) {
$collhsrhs = "-noLHSRHS";
} elseif($row_page_info['page_rhs_content'] == "" ) {
$collhsrhs = "-noRHS";
} elseif ($row_page_info['page_lhs_content'] == "" || $row_top_top_menu == 0) {
$collhsrhs = "-noLHS";
} else {
$collhsrhs = "";
}
return $collhsrhs;
}
mysql_free_result($page_info);
- mysql_select_db($database_eggbox, $eggbox);
- /* get the home page at start*/
- $query_default_url = "select * from menu where menu_text = 'Home' order by menu_display_order";
- $default_url = mysql_query($query_default_url, $eggbox) or die(mysql_error());
- $row_default_url = mysql_fetch_assoc($default_url);
- $totalRows_default_url = mysql_num_rows($default_url);
- if (isset($_GET['menu_id'])) {
- $urlmenu_id = $_GET['menu_id'];
- } else {
- $urlmenu_id = $row_default_url['menu_id'];
- }
- ///////////////////////////////////////////////////////////////
- /////////////////////* functions */////////////////////////////
- ///////////////////////////////////////////////////////////////
- if (!function_exists("GetSQLValueString")) {
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
- {
- $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
- $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
- switch ($theType) {
- case "text":
- $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
- break;
- case "long":
- case "int":
- $theValue = ($theValue != "") ? intval($theValue) : "NULL";
- break;
- case "double":
- $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
- break;
- case "date":
- $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
- break;
- case "defined":
- $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
- break;
- }
- return $theValue;
- }
- }
- /* get breadcrumb function */
- function getbreadcrumb($arraycount,$parentmenuid){
- /* get the current level menu */
- global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
- $query_last_breadcrumb = "select * from menu where menu_id = $parentmenuid order by menu_display_order";
- $last_breadcrumb = mysql_query($query_last_breadcrumb, $eggbox) or die(mysql_error());
- $row_last_breadcrumb = mysql_fetch_assoc($last_breadcrumb);
- $totalRows_last_breadcrumb = mysql_num_rows($last_breadcrumb);
- $array_menu[$arraycount][0] = $row_last_breadcrumb['menu_id'];
- $array_menu[$arraycount][1] = $row_last_breadcrumb['page_id'];
- $array_menu[$arraycount][2] = $row_last_breadcrumb['menu_text'];
- $array_menu[$arraycount][3] = $row_last_breadcrumb['menu_parent_menu_id'];
- if($array_menu[$arraycount][0] != "") {
- getbreadcrumb($arraycount+1,$array_menu[$arraycount][3]);
- }
- if($arraycount == count){
- echo $array_menu[$arraycount][2];
- } else {
- $menuid = $array_menu[$arraycount][0];
- echo "<li><a href='index.php?menu_id=$menuid' title='opens in same window' target='_self' >" . $array_menu[$arraycount][2] . "</a> : </li>";
- }
- mysql_free_result($last_breadcrumb);
- } // end function
- /* get menu functions */
- function getmenu($menu_level,$menuid){
- /* get the top most level menu */
- global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
- $query_top_menu = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
- $top_menu = mysql_query($query_top_menu, $eggbox) or die(mysql_error());
- $row_top_menu = mysql_fetch_assoc($top_menu);
- $totalRows_top_menu = mysql_num_rows($top_menu);
- if ($menu_level == 0) { // Top menu for nav bar only
- echo "<ul>";
- do {
- $menuid = $row_top_menu['menu_id'];
- if($urlmenu_id == $menuid) {
- $selectedclass = "class='selected'";
- } else {
- $selectedclass = "";
- }
- if($row_top_menu['menu_alt_location'] != "") {
- // Alternative location like google
- if(substr($row_top_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_top_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_top_menu['menu_alt_location'];}
- $title = "opens in new window";
- $target = "_blank";
- } else {
- // site menu
- $menuurl = "index.php?menu_id=$menuid";
- $title = "opens in same window";
- $target = "_self";
- } // End if
- echo "<li><a href='$menuurl' title='$target' target='$target' $selectedclass >" . $row_top_menu['menu_text'] . "</a></li>";
- } while ($row_top_menu = mysql_fetch_assoc($top_menu));
- echo "</ul>";
- } elseif ($menu_level == 1) {
- if($totalRows_top_menu > 0) { // full side menu and you don't want a top menu
- echo "<ul>";
- $count = 0;
- do {
- $menuid = $row_top_menu['menu_id'];
- if($urlmenu_id == $menuid) {
- $selectedclass = "class='selected'";
- } else {
- $selectedclass = "";
- }
- if($row_top_menu['menu_alt_location'] != "") {
- // Alternative location like google
- if(substr($row_top_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_top_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_top_menu['menu_alt_location'];}
- $title = "opens in new window";
- $target = "_blank";
- } else {
- // Site menu
- $menuurl = "index.php?menu_id=$menuid";
- $title = "opens in same window";
- $target = "_self";
- } // End if
- echo "<li><a href='$menuurl' title='$title' target='$target' >" . $row_top_menu['menu_text'] . "</a>";
- $query_has_children = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
- $has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
- $row_has_children = mysql_fetch_assoc($has_children);
- $totalRows_has_children = mysql_num_rows($has_children);
- if($totalRows_has_children > 0 && $array_menu[sizeof($array_menu)-2][0] == $menuid){
- getchildren($menuid,0,3);
- echo "</li>";
- } else {
- echo "</li>";
- }
- $count += 1;
- } while ($row_top_menu = mysql_fetch_assoc($top_menu));
- echo "</ul>";
- } // End if
- mysql_free_result($has_children);
- } elseif ($menu_level == 2) { // Second level menu based on top level menu
- if($totalRows_top_menu > 0) {
- $count = 0;
- do {
- $menuid = $row_top_menu['menu_id'];
- $query_has_children = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
- $has_children = mysql_query($query_has_children, $eggbox) or die(mysql_error());
- $row_has_children = mysql_fetch_assoc($has_children);
- $totalRows_has_children = mysql_num_rows($has_children);
- if($totalRows_has_children > 0 && $array_menu[sizeof($array_menu)-2][0] == $menuid){
- getchildren($menuid,0,3);
- }
- $count += 1;
- } while ($row_top_menu = mysql_fetch_assoc($top_menu));
- } // End if
- mysql_free_result($has_children);
- } // End if function for menu levels
- mysql_free_result($top_menu);
- } // End Function
- function getchildren ($menuid,$count,$count_level) {
- /* get the next level menu */
- global $database_eggbox, $eggbox, $urlmenu_id, $array_menu;
- $query_child_menu = "select * from menu where menu_parent_menu_id = $menuid and menu_display = 1 order by menu_display_order";
- $child_menu = mysql_query($query_child_menu, $eggbox) or die(mysql_error());
- $row_child_menu = mysql_fetch_assoc($child_menu);
- $totalRows_child_menu = mysql_num_rows($child_menu);
- do {
- if($count == 0) {
- echo "<ul>";
- }
- $menuidd = $row_child_menu['menu_id'];
- if($urlmenu_id == $menuidd) {
- $selectedclass = "class='selected'";
- } else {
- $selectedclass = "";
- }
- if($row_child_menu['menu_alt_location'] != "") {
- // Alternative location like google
- if(substr($row_child_menu['menu_alt_location'],0,4) == "http") { $menuurl = $row_child_menu['menu_alt_location']; } else { $menuurl = "http://" . $row_child_menu['menu_alt_location'];}
- $title = "opens in new window";
- $target = "_blank";
- } else {
- // site menu
- $menuurl = "index.php?menu_id=$menuidd";
- $title = "opens in same window";
- $target = "_self";
- } // End if
- echo "<li><a href='$menuurl' title='$title' target='$target' $selectedclass >" . $row_child_menu['menu_text'] . "</a>";
- $query_has_childrens = "select * from menu where menu_parent_menu_id = $menuidd and menu_display = 1 order by menu_display_order";
- $has_childrens = mysql_query($query_has_childrens, $eggbox) or die(mysql_error());
- $row_has_childrens = mysql_fetch_assoc($has_childrens);
- $totalRows_has_childrens = mysql_num_rows($has_childrens);
- if($totalRows_has_childrens > 0 && $array_menu[sizeof($array_menu)-$count_level][0] == $menuidd){
- getchildren($menuidd,0,$count_level+1);
- echo "</li>";
- } else {
- echo "</li>";
- }
- if($count+1 == $totalRows_child_menu) {
- echo "</ul>";
- }
- $count += 1;
- } while ($row_child_menu = mysql_fetch_assoc($child_menu));
- mysql_free_result($has_childrens);
- mysql_free_result($child_menu);
- } // end function
- /* get content */
- $query_page_info = "select menu_id, pages.* from pages inner join menu on pages.page_id = menu.page_id where menu.menu_id = $urlmenu_id";
- $page_info = mysql_query($query_page_info, $eggbox) or die(mysql_error());
- $row_page_info = mysql_fetch_assoc($page_info);
- $totalRows_page_info = mysql_num_rows($page_info);
- function getcontent($content){
- global $row_page_info;
- $content = $row_page_info[$content];
- return $content;
- } // End function
- function getcolumns() {
- global $database_eggbox, $eggbox, $row_page_info, $urlmenu_id;
- $query_top_top_menu = "select * from menu where menu_parent_menu_id = $urlmenu_id and menu_display = 1 order by menu_display_order";
- $top_top_menu = mysql_query($query_top_top_menu, $eggbox) or die(mysql_error());
- $row_top_top_menu = mysql_fetch_assoc($top_top_menu);
- $totalRows_top_top_menu = mysql_num_rows($top_top_menu);
- if($row_page_info['page_lhs_content'] == "" && $row_page_info['page_rhs_content'] == "" && $totalRows_top_top_menu == 0) {
- $collhsrhs = "-noLHSRHS";
- } elseif($row_page_info['page_rhs_content'] == "" ) {
- $collhsrhs = "-noRHS";
- } elseif ($row_page_info['page_lhs_content'] == "" || $row_top_top_menu == 0) {
- $collhsrhs = "-noLHS";
- } else {
- $collhsrhs = "";
- }
- return $collhsrhs;
- }
- mysql_free_result($page_info);
Página 1 de 1
Para responder a este tema que necesita para ingresar o registrarse. Es gratis.
Publicar Información
- Total de mensajes en este tema: 10 mensajes
- Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 319 invitados
- No puede abrir nuevos temas en este Foro
- No puede responder a temas en este Foro
- No puede editar sus mensajes en este Foro
- No puede borrar sus mensajes en este Foro
- No puede enviar adjuntos en este Foro
