Tabs vullen met SQL gegevens
Chilion - 25/11/2008 09:19
MySQL interesse
Heren, ik heb een probleempje,
Ik wil een pagina creëren, waarbij elke persoon zijn eigen pagina heeft. Ik wil dat dat tabs worden die vanuit de database hun naam krijgen. De tabs moeten naast elkaar staan, en ik wil op de tab moeten klikken voor dat ik de volgende pagina zie.
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--Database openen, PHP openen, query -->
<?php
include('dbconfig.php');
databaseconnect();
$medewerkerquery = ("SELECT * FROM medewerkers WHERE status='1' ORDER BY naam");
$resultaatmedewerker = mysql_query($medewerkerquery);
while ($row = mysql_fetch_array($resultaatmedewerker))
{
echo '<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex=0>';
echo $row['naam'];
echo '</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent"> Le Output!</div>
</div>
</div>';
echo '
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script> ';
}
?>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--Database openen, PHP openen, query -->
<?php
include ( 'dbconfig.php' ) ;
databaseconnect( ) ;
$medewerkerquery = ( "SELECT * FROM medewerkers WHERE status='1' ORDER BY naam" ) ;
{
echo '<div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex=0>' ;
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent"> Le Output!</div>
</div>
</div>' ;
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script> ' ;
}
?>
Ik heb nu deze code (hierboven) en het werkt ongeveer, alleen krijg ik de tabs onder elkaar. Hoe doe ik dat?
Chilion
10 antwoorden
Gesponsorde links
Chilion - 25/11/2008 09:37 (laatste wijziging 25/11/2008 09:45)
MySQL interesse
@charset "UTF-8";
/* SpryTabbedPanels.css - Revision: Spry Preview Release 1.4 */
/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
/* Horizontal Tabbed Panels
*
* The default style for a TabbedPanels widget places all tab buttons
* (left aligned) above the content panel.
*/
.TabbedPanels {
margin: 0px;
padding: 0px;
float: left;
clear: none;
width: 100%; /* IE Hack to force proper layout when preceded by a paragraph. (hasLayout Bug)*/
}
.TabbedPanelsTabGroup {
margin: 0px;
padding: 0px;
}
.TabbedPanelsTab {
position: relative;
top: 1px;
float: left;
padding: 4px 10px;
margin: 0px 1px 0px 0px;
font: bold 0.7em sans-serif;
background-color: #DDD;
list-style: none;
border-left: solid 1px #CCC;
border-bottom: solid 1px #999;
border-top: solid 1px #999;
border-right: solid 1px #999;
-moz-user-select: none;
-khtml-user-select: none;
cursor: pointer;
}
.TabbedPanelsTabHover {
background-color: #CCC;
}
.TabbedPanelsTabSelected {
background-color: #EEE;
border-bottom: 1px solid #EEE;
}
.TabbedPanelsTab a {
color: black;
text-decoration: none;
}
.TabbedPanelsContentGroup {
clear: both;
border-left: solid 1px #CCC;
border-bottom: solid 1px #CCC;
border-top: solid 1px #999;
border-right: solid 1px #999;
background-color: #EEE;
}
.TabbedPanelsContent {
padding: 4px;
}
.TabbedPanelsContentVisible {
}
.VTabbedPanels .TabbedPanelsTabGroup {
float: left;
width: 10em;
height: 20em;
background-color: #EEE;
position: relative;
border-top: solid 1px #999;
border-right: solid 1px #999;
border-left: solid 1px #CCC;
border-bottom: solid 1px #CCC;
}
.VTabbedPanels .TabbedPanelsTab {
float: none;
margin: 0px;
border-top: none;
border-left: none;
border-right: none;
}
.VTabbedPanels .TabbedPanelsTabSelected {
background-color: #EEE;
border-bottom: solid 1px #999;
}
.VTabbedPanels .TabbedPanelsContentGroup {
clear: none;
float: left;
padding: 0px;
width: 30em;
height: 20em;
}
@ charset "UTF-8" ;
/* SpryTabbedPanels.css - Revision: Spry Preview Release 1.4 */
/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
/* Horizontal Tabbed Panels
*
* The default style for a TabbedPanels widget places all tab buttons
* (left aligned) above the content panel.
*/
. TabbedPanels {
margin: 0px;
padding: 0px;
float: left;
clear: none;
width: 100 %; /* IE Hack to force proper layout when preceded by a paragraph. (hasLayout Bug)*/
}
. TabbedPanelsTabGroup {
margin: 0px;
padding: 0px;
}
. TabbedPanelsTab {
position: relative;
top: 1px;
float: left;
padding: 4px 10px;
margin: 0px 1px 0px 0px;
font: bold 0. 7em sans- serif;
background- color: #DDD;
list- style: none;
border- left: solid 1px #CCC;
border- bottom: solid 1px #999;
border- top: solid 1px #999;
border- right: solid 1px #999;
- moz- user- select: none;
- khtml- user- select: none;
cursor: pointer;
}
. TabbedPanelsTabHover {
background- color: #CCC;
}
. TabbedPanelsTabSelected {
background- color: #EEE;
border- bottom: 1px solid #EEE;
}
. TabbedPanelsTab a {
color: black;
text- decoration: none;
}
. TabbedPanelsContentGroup {
clear: both;
border- left: solid 1px #CCC;
border- bottom: solid 1px #CCC;
border- top: solid 1px #999;
border- right: solid 1px #999;
background- color: #EEE;
}
. TabbedPanelsContent {
padding: 4px;
}
. TabbedPanelsContentVisible {
}
. VTabbedPanels . TabbedPanelsTabGroup {
float: left;
width: 10em;
height: 20em;
background- color: #EEE;
position: relative;
border- top: solid 1px #999;
border- right: solid 1px #999;
border- left: solid 1px #CCC;
border- bottom: solid 1px #CCC;
}
. VTabbedPanels . TabbedPanelsTab {
float: none;
margin: 0px;
border- top: none;
border- left: none;
border- right: none;
}
. VTabbedPanels . TabbedPanelsTabSelected {
background- color: #EEE;
border- bottom: solid 1px #999;
}
. VTabbedPanels . TabbedPanelsContentGroup {
clear: none;
float: left;
padding: 0px;
width: 30em;
height: 20em;
}
Chilion - 25/11/2008 10:28 (laatste wijziging 25/11/2008 10:29)
MySQL interesse
Dus zo? Dat is wel leuk, want het werkt. Maar voor 1 medewerker. Ik krijg maar 1 naam, en dus maar 1 tab.
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--Database openen, PHP openen, query -->
<?php
include('dbconfig.php');
databaseconnect();
$medewerkerquery = ("SELECT * FROM medewerkers WHERE status='1' ORDER BY naam");
$resultaatmedewerker = mysql_query($medewerkerquery);
while ($row = mysql_fetch_array($resultaatmedewerker))
{
echo '<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex=0>';
echo $row['naam'];
echo '</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent"> Le Output!</div>';
}
echo'
</div>
</div>';
echo '
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script> ';
?>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--Database openen, PHP openen, query -->
<?php
include ( 'dbconfig.php' ) ;
databaseconnect( ) ;
$medewerkerquery = ( "SELECT * FROM medewerkers WHERE status='1' ORDER BY naam" ) ;
{
echo '<div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex=0>' ;
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent"> Le Output!</div>' ;
}
</div>
</div>' ;
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script> ' ;
?>
Giant - 25/11/2008 12:21 (laatste wijziging 25/11/2008 12:22)
PHP beginner
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--Database openen, PHP openen, query -->
<?php
include('dbconfig.php');
databaseconnect();
$medewerkerquery = ("SELECT * FROM medewerkers WHERE status='1' ORDER BY naam");
$resultaatmedewerker = mysql_query($medewerkerquery);
echo '<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">';
while ($row = mysql_fetch_array($resultaatmedewerker))
{
echo '<li class="TabbedPanelsTab" tabindex=0>';
echo $row['naam'];
echo '</li>';
}
echo'
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent"> Le Output!</div>
</div>
</div>';
echo '
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script> ';
?>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--Database openen, PHP openen, query -->
<?php
include ( 'dbconfig.php' ) ;
databaseconnect( ) ;
$medewerkerquery = ( "SELECT * FROM medewerkers WHERE status='1' ORDER BY naam" ) ;
echo '<div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup">' ;
{
echo '<li class="TabbedPanelsTab" tabindex=0>' ; }
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent"> Le Output!</div>
</div>
</div>' ;
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script> ' ;
?>
zo zou die het moeten doen.
EDIT:
ff een typefoutje in de code herstelt
Chilion - 25/11/2008 12:29
MySQL interesse
Ja, kijk, dat is wel leuk, maar nu heeft alleen de eerste tab content. En kan ik niet zien welke tab geselecteerd is. Ook zijn de tabs niet meer clickable.
rredspike1 - 25/11/2008 13:58
Lid
zalig zijn zij, die niet gezien hebben, maar toch geloven!
Giant - 25/11/2008 16:47 (laatste wijziging 25/11/2008 16:48)
PHP beginner
@chillion,
je moet die tabindex ook omhoog gooien!
EDIT:
Wat heb ik toch met die typefouten :S
Gesponsorde links
Dit onderwerp is gesloten .