Jump to content

jmlab

Members
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

0 Neutral

About jmlab

  • Rank
    Member
  1. So, what is the best thing t do?
  2. This is the recursive menu function. Shouldn't be a function? Is because of this, that we can't "$_GET['id']? How can I solved this? <?php //call the recursive function to print category listing category_tree(0); //Recursive php function function category_tree($menuPai){ global $dbc; $q = "SELECT * FROM menuCAL WHERE idPai ='".$menuPai."'"; $r = mysqli_query($dbc, $q); while($btnMenu = mysqli_fetch_assoc($r)): $i = 0; if ($i == 0) echo '<ul class="menuCAL">'; echo '<li><a href="?page='.$btnMenu['id'],'">' . $btnMenu['GlyPrincipal'] . $btnMenu['GlySecundario'] . $btnMenu['menuNomePT'], '</a>'; category_tree($btnMenu['id']); echo '</li>'; $i++; if ($i > 0) echo '</ul>'; endwhile; } ?>
  3. Sorry, $menuPai is the tree menu function
  4. Is the category id from tree menu Is the "father id"
  5. Line 199 and 206 are the title and content in Portuguese (same for title and content in English). I already have that code in the index. Nothing happened. This is my debug panel:
  6. Or Im not even making it? Can u explain me please? This is how I see it in Back-office:
  7. Yes, I think so! That was my first thought! So the $_GET['id'] is not set because of the error you mentioned earlier, right?
  8. Am I not creating it here? <?php // SELECT QUERY if(isset($_GET['id'])) { $q = "SELECT * FROM menuCAL WHERE id = $_GET[id]"; $r = mysqli_query($dbc, $q); $opened = mysqli_fetch_assoc($r); } ?>
  9. Hello my good people I'm doing a content manager system in PHP and mySQLi, following a serie of video tutorials. But in my project I am using a tree menu. In the front office all works smoothly (the tree menu displays all results - menu and submenus - and each button carries the information of the respective page). The problem is in the back office. The menu is there, in the url appears its id page but the CRUD, I can not put it to work. ======= CODE START ======= <!-- Gestor de Conteúdos Start --> <div class="container-fluid"> <!-- Conteúdo Fluido Start --> <div class="row-fluid row-offcanvas row-offcanvas-left"> <?php // INSERT QUERY if(isset($_POST['enviado']) == 1) { $header = mysqli_real_escape_string($dbc, $_POST['header']); $url = mysqli_real_escape_string($dbc, $_POST['url']); $user = $_POST['user']; $idPai = $_POST['idPai']; $menuNomePT = mysqli_real_escape_string($dbc, $_POST['menuNomePT']); $conteudo_pagina_PT = mysqli_real_escape_string($dbc, $_POST['conteudo_pagina_PT']); $menuNomeEN = mysqli_real_escape_string($dbc, $_POST['menuNomeEN']); $conteudo_pagina_EN = mysqli_real_escape_string($dbc, $_POST['conteudo_pagina_EN']); $q = "INSERT INTO menuCAL (header, url, user, idPai, menuNomePT, conteudo_pagina_PT, menuNomeEN, conteudo_pagina_EN) VALUES ('$header', '$_POST[url]', $_POST[user], '$_POST[idPai], '$menuNomePT, '$conteudo_pagina_PT', '$menuNomeEN', '$conteudo_pagina_EN'"; $r = mysqli_query($dbc, $q); ?> <div> <?php if($r) { $message = '<p>A página foi adicionada!</p>'; } else { $message = '<p>A página não foi adicionada, devido ao seguinte erro: '.mysqli_error($dbc); $message .= '<p>' .$q.'</p>'; } ?> </div> <?php } ?> <!-- Menu CAL Start --> <div class="col-sm-3 sidebar-offcanvas"> <?php //call the recursive function to print category listing category_tree(0); //Recursive php function function category_tree($menuPai){ global $dbc; $q = "SELECT * FROM menuCAL WHERE idPai ='".$menuPai."'"; $r = mysqli_query($dbc, $q); while($btnMenu = mysqli_fetch_assoc($r)): $i = 0; if ($i == 0) echo '<ul class="menuCAL">'; echo '<li><a href="?page='.$btnMenu['id'],'">' . $btnMenu['GlyPrincipal'] . $btnMenu['GlySecundario'] . $btnMenu['menuNomePT'], '</a>'; category_tree($btnMenu['id']); echo '</li>'; $i++; if ($i > 0) echo '</ul>'; endwhile; } ?> </div> <!-- Menu CAL End --> <!-- Conteúdo Start --> <div class="span10"> <div class="col-sm-12"> <!-- Título Start --> <h1 class="page-header"> <i class="fa fa-file"></i> Adicionar Página </h1> <ol class="breadcrumb"> <li> <a href="#"><i class="fa fa-pencil"></i> Conteúdos</a> </li> <li class="active"> <i class="fa fa-file"></i> Nova página </li> </ol> <!-- Título End --> </div> <!-- Textos & Formulários Start --> <div class="row"> <div class="col-lg-12"> <p><?php if(isset($message)) { echo $message; } ?></p> <?php // SELECT QUERY if(isset($_GET['id'])) { $q = "SELECT * FROM menuCAL WHERE id = $_GET[id]"; $r = mysqli_query($dbc, $q); $opened = mysqli_fetch_assoc($r); } ?> <!-- Formulário Start --> <form action="adicionar_pagina.php" method="post" role="form"> <!-- Campo header Start --> <div class="form-group"> <label for="header">Header:</label> <input type="text" class="form-control" name="header" id="header" value="<?php echo $opened['header']; ?>" placeholder="Texto descritivo a colocar no topo do website"> </div> <!-- Campo header End --> <!-- Campo Label Start --> <div class="form-group"> <label for="url">URL:</label> <input type="text" class="form-control" name="url" id="url" value="<?php echo $opened['url']; ?>" placeholder="Texto a colocar na URL (SEO)"> </div> <!-- Campo Label End --> <!-- Campo User Start --> <div class="form-group"> <label for="user">Administrador:</label> <select class="form-control" name="user" id="user"> <option value="0">›› Nenhum administrador</option> <?php $q = "SELECT id FROM users ORDER BY first ASC"; $r = mysqli_query ($dbc, $q); while ($user_list = mysqli_fetch_assoc($r)) { $user_data = data_user($dbc, $user_list['id']); ?> <option value="<?php echo $user_data['id'] ?>" <?php if($user_data['id'] == $opened['id']) { echo 'selected';} ?>><?php echo $user_data['fullname']; ?></option> <?php } ?> </select> </div> <!-- Campo User Start --> <!-- Campo ID Menu Pai Start --> <div class="form-group"> <label for="idPai">Adicionar a:</label> <select class="form-control" name="idPai" id="idPai"> <option value="0">›› Seleccione onde adicionar a nova página:</option> <?php $q = "SELECT menuNomePT FROM menuCAL WHERE idPai = 0"; $r = mysqli_query ($dbc, $q); while ($submenus = mysqli_fetch_assoc($r)) { ?> <option value="<?php echo $submenus['idPai']; ?>"><?php echo $submenus['menuNomePT']; ?></option> <?php } ?> </select> </div> <!-- Campo ID Menu Pai Start --> <!-- Campo menuNomePT Start --> <div class="form-group"> <label for="menuNomePT">Título PT:</label> <input type="text" class="form-control" name="menuNomePT" id="menuNomePT" value="<?php echo $opened['menuNomePT']; ?>" placeholder="Insira o título em Português"> </div> <!-- Campo menuNomePT End --> <!-- Campo conteudo_pagina_PT Start --> <div class="form-group"> <label for="conteudo_pagina_EN">Conteúdos PT:</label> <textarea class="form-control" name="conteudo_pagina_PT" rows="12" id="conteudo_pagina_PT" placeholder="Insira os textos em Português"><?php echo $opened['conteudo_pagina_PT']; ?></textarea> </div> <!-- Campo conteudo_pagina_PT End --> <!-- Campo menuNomeEN Start --> <div class="form-group"> <label for="menuNomeEN">Título EN:</label> <input type="text" class="form-control" name="menuNomeEN" id="menuNomeEN" value="<?php echo $opened['menuNomePT']; ?>" placeholder="Insira o título em Inglês"> </div> <!-- Campo menuNomeEN End --> <!-- Campo conteudo_pagina_EN Start --> <div class="form-group"> <label for="conteudo_pagina_EN">Conteúdos EN:</label> <textarea class="form-control" name="conteudo_pagina_EN" rows="12" id="conteudo_pagina_EN" placeholder="Insira os textos em Inglês"><?php echo $opened['conteudo_pagina_PT']; ?></textarea> </div> <!-- Campo conteudo_pagina_EN End --> <button type="submit" class="btn btn-default adic_concluir">Gravar</button> <input type="hidden" name="enviado" value="1"> </div> </form> <!-- Formulário End --> </div> <!-- Debug Panel Start --> <?php if($debug == 1) { include('widgets/debug.php'); } ?> <!-- Debug Panel End --> </div> <!-- Textos & Formulários End --> </div> <!-- Conteúdo End --> </div> <!-- Conteúdo Fluido Start --> </div> <!-- Gestor de Conteúdos End --> ======= CODE END ======= I can not do the INSERT or UPDATE query, using the form so that the "user" and the "idPai" (a category id), can be created or changed in the database. I tried to echo the database result, but nothing append And in the second query (in red in the code), gives me an error (Undefined variable: opened in …). Obviously something is wrong, but i can't see what! :/ The database: Can Someone help me? Please !! Thank U
  10. Everything is working great!! Thank you!
  11. UPDATE Fixed the JS problem (There was an duplicate of the Gallery JS function in index.php and gallery.php)! And I think that everything is working now! Im gonna make some tests and I reply! Can't thank you enough!!!
  12. Hello Quick's! I have tested the code and it works partially (something is failing). It has to do with javascript. The code does not run. The photos run all at once (the javascript path maybe !?). Do you need to see anything more? More code? Another thing is that the website is responsive. If the CSS run in gallery.php, how will i control the gallery CSS in Index.php? Do you understand my question? Sorry
  13. Hello Quick's, Can you exemplify a code using include()? Its still a bitt difficult for me to understand the logic of the code In the code example, is the red text. I don't remember if I told that the path for the gallery is on a database table in a column called "gallery_url", that store the path "gallery.php". Thanks for the help!
  14. Hello, Thanks for the quick response I think that is better if I show the code that I'm using. <--- "index.php" ---> (This is the main file, where will be echo the "galeria.php") <?php ob_start(); require_once ('../includes/session.php'); include ('../includes/setup.php'); require_once ('../includes/functions.php'); ini_set('display_errors',0); ?> <?php find_selected_pagePT(true); ?> <?php if(!isset($layout_context)) { $layout_context = "public"; } ?> <!-- INÍCIO BODY --> <body> <!--[if lt IE 7]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p> <![endif]--> <!-- Add your site or application content here --> <!-- INÍCIO ESTRUTURA WEBSITE --> <!-- INÍCIO HEADER --> <?php include ('template/header.php'); ?> <!-- FIM HEADER --> <!-- INÍCIO CENTRAL --> <div id="central"> <div id="conteudo_info"> <!-- Início Textos (título & Conteúdos) --> <?php if ($current_page) { ?> <h1><?php echo htmlentities($current_page["menu_name"]); ?></h1> <?php echo $current_page["conteudo"]; ?> <!-- Fim Textos (título & Conteúdos) --> <!-- Início iFrame Externa --> <div class="calendar-container"> <iframe src="<?php echo $current_page["galeria_url"]; ?>" style=" border-width:0 " width="900" height="500" frameborder="0" scrolling="no"> </iframe> </div> <!-- Fim iFrame Externa --> <?php } else { ?> <!-- INÍCIO SLIDER GERAL --> <div id="cont-imageslider"> <div class="container"> <?php $q = "SELECT * FROM slides WHERE imageslider_id = 1"; $r = mysqli_query($dbc, $q); ?> <div id="imageslider"> <?php while ($artigo = mysqli_fetch_assoc($r)) { ?> <div data-iview:thumbnail="../uploads/sliders/<?=$artigo['imagem']; ?>" data-iview:image="../uploads/sliders/<?=$artigo['imagem']; ?>"> <div class="iview-caption caption5" data-x="50" data-y="230" data-width="auto" data-transition="expandDown"><?=$artigo['tituloPT']; ?></div> <div class="iview-caption caption6" data-x="50" data-y="310" data-width="auto" data-transition="wipeRight"><?=$artigo['descricaoPT']; ?></div> <div class="iview-caption caption7" data-x="50" data-y="370" data-width="auto" data-transition="wipeLeft"><a href="index.php?page=<?=$artigo['alink']; ?>">+INFO</a></div> </div> <?php } ?> </div> </div> <!-- FIM SLIDER GERAL --> <?php } ?> </div> </div> <!-- FIM CENTRAL --> <!-- INÍCIO FOOTER --> <?php include ('template/footer.php'); ?> <!-- FIM FOOTER --> ------------------------------------------------------------------------ <--- "galleria.php" ---> (This will be called when i click on "portfolio" Button in my Menu, and will echo in mine index.php) <?php ob_start(); require_once ('../includes/session.php'); include ('../includes/setup.php'); require_once ('../includes/functions.php'); ini_set('display_errors',0); ?> <!DOCTYPE html> <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]--> <!--[if IE 7]> <html class="ie7 oldie"> <![endif]--> <!--[if IE 8]> <html class="ie8 oldie"> <![endif]--> <!--[if gt IE 8]><!--> <html lang="pt-pt"> <!-- INÍCIO HEAD --> <head> <!-- METATAGS --> <meta charset="utf-8"> <meta name="Desenvolvido por" content="JMlabDesign"> <meta name="Desenvolvido por" content="JMlabDesign"> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> <link type="text/plain" rel="author" href="humans.txt" /> <meta name="description" content="Mais do que uma empresa de serviços, procura ser um parceiro que integra o seu conceito e o aplica ao longo da relação duradoura que estabelecemos consigo e com a sua empresa."> <meta name="keywords" content="modelos, formações, eventos, outsourcing, promoções, merchandising, trabalho temporário, hospedeiras."> <title></title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!-- METATAGS --> <!-- FONTS --> <link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700,700italic,400italic' rel='stylesheet' type='text/css'> <!-- FONTS --> <!-- FAVICON --> <link rel="shortcut icon" href="favicon.ico" /> <!-- FAVICON --> <!-- INÍCIO CSS --> <!-- CSS Global --> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/galeriastyle.css" /> <!-- CSS Global --> <!-- MEDIA QUERIES --> <!-- MEDIA QUERIES --> <!-- CSS imageslider & Galeria de Fotos --> <link rel="stylesheet" href="css/iview.css" /> <!-- CSS imageslider & Galeria de Fotos --> <!-- FIM CSS --> <!-- JS Geral --> <script src="../js/respond.min.js"></script> <script type="text/javascript" src="../js/jquery.js"></script> <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script> <!-- JS Geral --> <!-- INÍCIO JS --> <!--<script src="js/vendor/modernizr-2.6.2.min.js"></script> <script src="js/respond.min.js"></script> <script type="text/javascript" src="js/jquery.js"></script>--> <!-- Accordion Menu --> <script type="text/javascript" src="../js/accordion_code.js"></script> <!-- Accordion Menu --> <!-- Imageslider & Galeria de Fotos --> <!-- Slideshow JS --> <script src="js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="js/raphael-min.js"></script> <script type="text/javascript" src="js/jquery.easing.js"></script> <script src="js/iview.js"></script> <script> $(document).ready(function(){ $('#imageslider').iView({ pauseTime: 5000, pauseOnHover: true, directionNavHoverOpacity: 0, timer: "Bar", timerDiameter: "50%", timerPadding: 0, timerStroke: 7, timerBarStroke: 0, timerColor: "#FFF", timerY: 20, timerX: 20, timerPosition: "bottom-right", captionOpacity: 1 }); $('#galeria').iView({ pauseTime: 4000, pauseOnHover: true, directionNav: true, directionNavHide: false, controlNav: true, controlNavNextPrev: false, controlNavTooltip: false, directionNavHoverOpacity: 0, timer: "Pie", timerDiameter: 30, timerPadding: 0, timerStroke: 7, timerBarStroke: 0, timerColor: "#FFF", timerY: 20, timerX: 20, captionOpacity: 1 }); }); </script> <!-- Slideshow JS --> <!-- Imageslider & Galeria de Fotos --> <!-- FIM JS --> <!-- INÍCIO JAVASCRIPT --> <script type="text/javascript"> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> <!-- FIM JAVASCRIPT --> <!-- FIM HEAD --> <!-- INÍCIO CENTRAL --> <div id="central"> <div id="conteudo_info"> <div id="cont-galeria"> <div class="container"> <?php $q = "SELECT * FROM imagens WHERE galeria_id = 1"; $r = mysqli_query($dbc, $q); ?> <div id="galeria"> <?php while ($artigo = mysqli_fetch_assoc($r)) { ?> <div data-iview:thumbnail="../uploads/galerias/<?=$artigo['imagem']; ?>" data-iview:image="../uploads/galerias/<?=$artigo['imagem']; ?>"></div> <?php } ?> </div> </div> </div> </div> </div> <!-- FIM CENTRAL --> <!-- INÍCIO FOOTER --> <!-- FIM FOOTER --> Hope anybody can help me Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.