Loop within a Loop PHP - php

Ok, this is my first time using Stack so I apologize in advance for anything I do incorrectly.
The Situation:
I have a class project to rewrite HTML code in PHP. Here is a snippet of the HTML code.
<div class="col-small-6 col-med-6 col-lg-4 albumContainer">
<img src="_images/elephant_king_cover_240x240.png" alt="">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">Elephant King</a></h2>
</div>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">
<ol>
<li>Elephant King</li>
<li>Joy & Sorrow</li>
<li>Traverse</li>
<li>Tres Capos</li>
<li>Timepiece</li>
<li>Adventures in Sawyerland</li>
<li>Be Still</li>
<li>Overtime</li>
<li>Bongolo</li>
<li>Coronation</li>
<li>Anchor</li>
</ol>
<h3>available at:</h3>
iTunes
Amazon
United Interests
</div>
</div>
</div>
</div>
</div><!-- end albumContainer -->
The structure repeats with different content.
The Problem:
When I run my SQl/PHP I am getting all of the information I am asking for, but it is not rendering properly. I get all of my information over and over again for as many different song titles there are (the ordered list).
I want everything to run one time for each section and for the song titles to be the content for the accordion. Here is the SQL/PHP code I have been messing around with.
<?php
require('mysqli_connect_remote.php');
$q = "SELECT Album_Art, Concat(Title, ' ', Release_Date) AS Title, destination, direction, Songs.Name FROM Albums Inner JOIN Songs ON Albums.Album_id=Songs.Album_id ";
$result = mysqli_query($dbcon, $q);
if ($result){
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
echo '<div class="col-small-6 col-med-6 col-lg-4 albumContainer">';
echo '<img src=' . $row['Album_Art'] . 'alt="">';
echo '<div class="panel-group" id="accordion">';
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
echo '<h2 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href=' . $row['direction'] . '>' . $row['Title'] . '</a></h2></div><div id=' . $row['destination'] . ' class="panel-collapse collapse"><div class="panel-body">';
echo '<ol> <li>' . $row['Name'] . '</li> </ol> </div></div></div></div></div>';
}
// <h3>available at:</h3>
// <a href=' . ['Location'] . '>iTunes</a>
// <a href=' . ['Location2'] . '>Amazon</a>
// <a href=' . ['Location3'] . '>United Interests</a>
// ';}
mysqli_free_result ($result);
} else {
echo '<p class="error">The current users could not be retrieved. We apologize for any inconvenience.</p>';
echo '<p>' . mysqli_error($dbcon) . '<br><br />Query: ' . $q . '</p>';
}
mysqli_close($dbcon);
?>
Any insights on how to make this work for me would be most appreciated.

First, if you're doing loops in loops, or if-statements in loops, or loops in if-statements, indent better to where its clear what's in what. Sounds trivial, but it makes all the difference in the world.
And I would suggest losing the Egyptian brackets. You know, the ones that look like someone walking like an Egyptian. That is, start putting opening brackets on a new line so the opening and closing brackets line up which makes it easy to see when a bracket is missing.
I have re-indented your code without changing anything:
if ($result)
{
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
echo '<div class="col-small-6 col-med-6 col-lg-4 albumContainer">';
echo '<img src=' . $row['Album_Art'] . 'alt="">';
echo '<div class="panel-group" id="accordion">';
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
echo '<h2 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href=' . $row['direction'] . '>' . $row['Title'] . '</a></h2></div><div id=' . $row['destination'] . ' class="panel-collapse collapse"><div class="panel-body">';
echo '<ol> <li>' . $row['Name'] . '</li> </ol> </div></div></div></div></div>';
}
/*<h3>available at:</h3>
<a href=' . ['Location'] . '>iTunes</a>
<a href=' . ['Location2'] . '>Amazon</a>
<a href=' . ['Location3'] . '>United Interests</a>
';}*/
mysqli_free_result ($result);
}
else
{
echo '<p class="error">The current users could not be retrieved. We apologize for any inconvenience.</p>';
echo '<p>' . mysqli_error($dbcon) . '<br><br />Query: ' . $q . '</p>';
}
mysqli_close($dbcon);
?>
Now you can actually see what's going on. Initially when I re-indented the first time I missed one of your closing brackets that was hiding at the end of a long long line and thought you were missing the closing bracket of the loop.
And it seems the problem is actually with your SQL query. Throwing a distinct in there might solve it:
$q = "SELECT DISTINCT Album_Art, Concat(Title, ' ', Release_Date) AS Title, destination, direction, Songs.Name FROM Albums Inner JOIN Songs ON Albums.Album_id=Songs.Album_id ";

Related

while looping w3-quarter in w3-row-padding

Here is the problem that while looping the php in while loop in w3-row-padding of w3 responsive layout . The layout breaks
Here is the source code
<?php
$r=0;
while($r<ceil($fetch_row_count/4))
{ ?>
<div class="w3-row-padding w3-padding-16 w3-center" style="clear:both" id="food">
<?php
while($row=mysqli_fetch_array($res))
{
?>
<div class="w3-quarter">
<img src="admin/uploads/<?php echo $row['image']; ?>" alt="noodles" style="width:50%">
<h3><?php echo $row['title']; ?></h3>
<p><?php echo $row['description']; ?> </p>
</div>
<?php
}
$r++;
}
?>
</div>
Thanks for reply and comments in advance
That bottom div was not being added for each of your padded containers.
The way the code is written you are adding a padded container and then adding your w3-quarter div for each of your result sets and then repeating that a bunch of times with what looks like to me the same set of data in each one.
What you are probably trying to accomplish is just making one padded div and then echo out your result set with the w3-quarter divs inside of it.
Here is your original way with the bottom div corrected:
<?php
$r=0;
while($r<ceil($fetch_row_count/4)) {
echo
'<div class="w3-row-padding w3-padding-16 w3-center" style="clear:both" id="food">';
while($row=mysqli_fetch_array($res)){
echo
'<div class="w3-quarter">' .
'<img src="admin/uploads/' . $row['image'] . '" alt="noodles" style="width:50%">' .
'<h3>' . $row['title'] . '</h3>' .
'<p>' . $row['description'] . '</p>' .
'</div>';
}
$r++;
echo
'</div>';
}
?>
Here is the way I think you are trying to do it: (Just guessing)
<?php
echo
'<div class="w3-row-padding w3-padding-16 w3-center" style="clear:both" id="food">';
$r = 0;
while($row=mysqli_fetch_array($res)){
echo
'<div class="w3-quarter">' .
'<img src="admin/uploads/' . $row['image'] . '" alt="noodles" style="width:50%">' .
'<h3>' . $row['title'] . '</h3>' .
'<p>' . $row['description'] . '</p>' .
'</div>';
$r++;
//I would not actually try to control how many results you add like this.
//I would get the results from a better formatted query.
if($r < ceil($fetch_row_count/4)){
break;
}
}
echo
'</div>';
?>

The foreach loop is skipping the first 2 of 3 items

I was wondering whether you guys could help me figure out why this isn't generating the HTML correctly. The variable $wholeTeam is returned from $wpdb->get_results(...) and is confirmed to be of length 3 (because echo count($wholeTeam) is spitting that number out and I've directly looked in the MySQL db to make sure there are 3 rows). For some reason, only the last of the 3 is being generated; the first 2 aren't.
<h2>Current members <span class="title-count"> <?php echo count($wholeTeam) ?> </span></h2>
<div class="row">
<?php
$sandwichTop = '<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3"><img src="/assets/';
$sandwichBottom = '/><button type="button" class="edit-mem-btn wp-core-ui button-primary">Edit</button></div>';
foreach ($wholeTeam as $thisMember)
$sandwichMiddle = $thisMember->picfn . '" id="memberid-' . $thisMember->id . '"';
echo $sandwichTop . $sandwichMiddle . $sandwichBottom;
?>
</div>
gets generated as
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
<img src="/assets/thepic.png" id="memberid-3"/>
<button type="button" class="edit-mem-btn wp-core-ui button-primary">Edit</button></div>
</div>
</div>
Code
foreach ($wholeTeam as $thisMember)
$sandwichMiddle = $thisMember->picfn . '" id="memberid-' . $thisMember->id . '"';
echo $sandwichTop . $sandwichMiddle . $sandwichBottom;
is equivalent to:
foreach ($wholeTeam as $thisMember) {
$sandwichMiddle = $thisMember->picfn . '" id="memberid-' . $thisMember->id . '"';
}
echo $sandwichTop . $sandwichMiddle . $sandwichBottom;
That's why you echo only once. If you want to echo every foreach iteration:
foreach ($wholeTeam as $thisMember) {
$sandwichMiddle = $thisMember->picfn . '" id="memberid-' . $thisMember->id . '"';
echo $sandwichTop . $sandwichMiddle . $sandwichBottom;
}

Combine site content with external site rss

I'm currently running a classified ads site and planning to display my own content combined with and external site rss.
So here is what i got right now after the db query for the jobs ads,
while ($row = mysqli_fetch_array($results, MYSQLI_ASSOC)){
echo '<div class="media margin-none">
<a class="pull-left bg-inverse innerAll text-center" href="#"><img src="'.$foto.'" share_alt="" width="100" height="100"></a>
<div class="media-body innerAll">
<h4 class="media-heading innerT">
'. $remuneracion .' ' . substr(ucfirst(strtolower($row['title'])), 0, 53) . ' <small class="pull-right label label-default"><i class="fa fa-fw fa-calendar-o"></i> ' . $row['date_created'] . '</small></h4>
<p>' . substr(ucfirst(strtolower($row['description'])), 0, 80) . ' ...</p>';
echo '</div>
</div>
<div class="col-separator-h"></div>';
}
echo pagination($statement,$per_page,$page, $url_filtros, $filtros);
?>
it is the while loop that i use to display ads from my database, what could be the best way to display (in this same loop?) other site's rss feed?
Thanks

issues with php if statement

ok so i am pretty new to php. i am making a site listing different attractions, i have a details page where i display information for each attraction stored in a mysql database. i'm trying to write an if statement so an icon will show if the relevant attraction has for example disabled facilities and so on. I have a tables attractions, type, facilities and faciliteslink in the database.
In the facilitieslink i have the columns:
AttractionID
FacilityID
in the Facility table i have:
FacilityID
FalilityName
in the attractions table i have:
AttractionID
name
summary ect...
also here is the if statement and queries i was trying to make
$myQuery = "SELECT Attraction.*, Type.TypeName ";
$myQuery .= "FROM Attraction ";
$myQuery .= "INNER JOIN Type ON Attraction.Type = Type.TypeID ";
$myQuery .= "WHERE AttractionID=" .$_GET['ID'];
//run query
$result = $con->query($myQuery);
if (!$result) die('Query error: ' . mysqli_error($result));
?>
<?php
$myQuery .= "INNER JOIN Type ON Attraction.AttractionID = facilitieslink.FacilityID ";
?>
<?php
//display attractions row by row
while($row = mysqli_fetch_array($result))
{
echo '<div class=" sixteen columns" id="attraction-details">';
echo '<h3>Attractions/<a href="details.php?ID=' . $row['AttractionID'] . '">' . $row['Name'] . '</a></h3>';
echo ' <div class="eight columns" id="big-a-image1">';
echo ' <img src="'. $row['ImageUrl'] . '"/>';
echo ' </div>';
echo ' <div class="eight columns" id="big-a-image2">';
echo ' <img src="'. $row['ImageUrl2'] . '"/>';
echo ' </div>';
echo ' <div class="eight columns" id="big-a-image3">';
echo ' <img src="'. $row['ImageUrl3'] . '"/>';
echo ' </div>';
echo ' <div class="eight columns" id="big-a-image4">';
echo ' <img src="'. $row['ImageUrl4'] . '"/>';
echo ' </div>';
echo' <div class="two columns" id="m-thumb1">';
echo' <img src="'. $row['ImageUrl'] . '"/>';
echo' </div>';
echo' <div class="two columns" id="m-thumb2">';
echo' <img src="'. $row['ImageUrl2'] . '"/>';
echo' </div>';
echo' <div class="two columns" id="m-thumb3">';
echo' <img src="'. $row['ImageUrl3'] . '"/>';
echo' </div>';
echo' <div class="two columns" id="m-thumb4">';
echo' <img src="'. $row['ImageUrl4'] . '"/>';
echo' </div>';
echo ' <div class="eight columns" id="a-description">';
echo' <h4> Attraction Description </h4>';
echo ' <p class="para"> ' . $row['Description'] . ' </p></a>';
echo ' </div>';
echo' <div class="two columns" id="thumb1">';
echo' <img src="'. $row['ImageUrl'] . '"/>';
echo' </div>';
echo' <div class="two columns" id="thumb2">';
echo' <img src="'. $row['ImageUrl2'] . '"/>';
echo' </div>';
echo' <div class="two columns" id="thumb3">';
echo' <img src="'. $row['ImageUrl3'] . '"/>';
echo' </div>';
echo' <div class="two columns" id="thumb4">';
echo' <img src="'. $row['ImageUrl4'] . '"/>';
echo' </div>';
// everything else works apart from this
$id = $row["AttractionID"];
if ($row['FacilityID'] == 1){
echo' <img src="'. $row['icon'] . '"/>';
}
else
echo'</div>';
echo' <div class="eight columns" id="directions">';
echo' <h3>Directions</h3>';
echo' <p class="para"> ' . $row['Address'] . ' </p>';
echo' </div>';
echo' <div class="eight columns" id="video">';
echo' <h3>Video</h3>';
echo' ' . $row['VideoEmbed'] . ' ';
echo' </div>';
echo' <div class="eight columns" id="contact">';
echo' <h3 id="con"> Contact </h3>';
echo' <p class="para"> ' . $row['Long'] . ' </p>';
echo' </div>';
echo' <div class="eight columns" id="opening-times">';
echo' <h3 id="open"> Opening times </h3>';
echo ' <p class="para"> ' . $row['OpeningHours'] . ' </p>';
echo' </div>';
}
?>
Regarding your main question:
"would i store the icon in this table or 1 of the others?"
Which table is "this table"? You already mentioned 3 Tables now (Attraction, Facility and Type)
What shall this Icon show? The answer to this question can tell you, where the data belongs to: Types or attraction. Can every attraction have another icon? or does the Type tell you, which icon you have to choose?
You try to join the Type by FacilityID and another time by TypeID. Are both unique in your table Type? Otherwise you're going to get multiple rows for the same Attraction. Due to your Edit i now know you want to join a third table: Facility. You have to write INNER JOIN facilitylink ON Attraction.FacilityId = facilitylink.FacilityID INNER JOIN Facility ON facilityLink.FacilityId = Facility.FacilityId to solve your problem with a join. But beware that you may get above mentioned multiple rows of attraction. Furthermore, due to the properties of an inner join, you will loose information on attraction which don't have a facility. Maybe you should switch the first INNER JOIN into a LEFT JOIN, what will produce NULL assignments to unknown Facilities. Don't forget to add the Information you additionally need (Icon, FacilityId) to the SELECT-Part. I suggest you to search further information on how to write select-statements and what effect which Statement parts will have.
The Syntax of your SQL-Statement is messed up because you append (PHP-Operator .=) a Join-Part after the Where-part. You don't execute the manipulated query, is the Manipulation needed in this case? Change the position of appending the Join-Part before the Query-Command and adjust the Order to get a correct SELECT-Statement.
You're appending a user generated input without proper escaping to the query (.$_GET['ID']). This is a very common beginners failure. Please Take a look into the topic "SQL Injection" and prevent this by using "prepared statements"
Your Appending the content of $row['icon'] directly into the generated HTML. Is the Content given by the users or do you generate/declare it? In the first case you should escape it with htmlspecialchars($row['icon'])
you're not starting the php file properly. I think you cut of some code, but just in case: all php Code need to be behind a <?php. the ?>will command the interpreter to stop interpreting php-code at all. A new <?php will start the interpreter again.
<p> HTML-Code here
<?php
echo "PHP-Code here";
echo "more PHP-Code here";
echo "much more PHP-Code here";
?> </p><p>some more html code </p><?php echo "and some PHP-Code again";
echo "but this time until the Ent of the File!";
This also means, that you have some redundant code in your example:
?>
<?php
Hopefully i have directed you in the right direction.
EDIT: Edited some of the Sentences above due to your Edit.
You should check if this query is good because i'm not sure about it.
The code whould go like this... Assuming the table is "attraction"
// Define query
$query = "SELECT * FROM `facilitieslinks` WHERE `AttractionID` = '".$_GET['ID']."'";
// Create connection
$con=mysqli_connect("localhost","&&&&&YOURUSERNAME&&&&&","&&&&&YOURPASSWORD&&&&&","&&&&&YOURDATABASE&&&&&");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//Execute the query to the DB
$result = mysqli_query($con,$query);
//Process data
while($row = mysqli_fetch_array($result))
{
$id = $row['AttractionID'];
if ($row['FacilityID']==1)
{
echo "<img src=\"".$row['icon'].\"">";
}
}
// Close the connection
mysqli_close($con);

Dynamic Bootstrap Tabs using PHP/MySQL

So I've been tackling this problem for a while now and I can't seem to get it to work. I have a category table and a link in my database. I'm trying to display the "category" title as the tab and the "link" as my tab content.
Let me share my code and I'll explain the problem:
<ul class="nav nav-tabs" id="lb-tabs">
<?php $sqlCat = $db->query('SELECT `tab_title` FROM `category`'); ?>
<?php
foreach ($sqlCat as $row):
echo '<li><a href="#' . $row['tab_title'] . '" data-toggle="tab">' .
$row['tab_title'] . ' </a></li>';
endforeach;
?>
</ul>
<div class="tab-content">
<?php foreach ($sqlCat as $row2):
$tab = $row2['tab_title'];?>
<div class="tab-pane active" id="<?php $row['tab_title']; ?>">
<div class="links">
<ul class="col">
<?php
$items = $db->prepare('SELECT u_links.title, u_links.link, u_links.tid, category.id, category.tab_title
FROM u_links, category
WHERE category.id = u_links.tid
ORDER BY category.id ');
$items->execute();
while ($r = $items->fetch(PDO::FETCH_ASSOC)) {
echo '<li>' . $r['title'] . '</li>';
}
?>
</ul>
</div>
</div><!-- /tab-pane -->
<?php endforeach; ?>
</div>
This current code is not displaying the content in the "tab-content" div. I've tried different ways like this for example:
$tab = '';
$content = '';
$link = '';
$tab_title = null;
while($row = $items->fetch(PDO::FETCH_ASSOC)) {
$link = '<li>' . $row['title'] . '</li>';
if ($tab_title != $row['tab_title']) {
$tab_title = $row['tab_title'];
$tab .= '<li><a href="#' . $row['tab_title'] . '" data-toggle="tab">' .
$row['tab_title'] . ' </a></li>';
$content .= '<div class="tab-pane active" id="' . $row['tab_title'] . '"><div
class="links"><ul class="col">' . $link . '</ul></div></div><!-- /tab-pane //
support -->';
}
}
With this code I either get as too many tabs(as many items within the category) which I only want one tab for many items(links). Or I'll only get one link per section and doesn't output that row from the database.
If anyone can help me out with this, it will be much appreciated! :) Thank you.
Ok, so I think the issue is how you set your .tab-pane id's. Right now there is but no "echo" so nothing is being output there.
I put together a working demo, I did change some part of your code, but very minor stuff which I tried to comment:
<!-- START OF YOUR CODE -->
<ul class="nav nav-tabs" id="lb-tabs">
<?php
// I just made an array with some data, since I don't have your data source
$sqlCat = array(
array('tab_title'=>'Home'),
array('tab_title'=>'Profile'),
array('tab_title'=>'Messages'),
array('tab_title'=>'Settings')
);
//set the current tab to be the first one in the list.... or whatever one you specify
$current_tab = $sqlCat[0]['tab_title'];
?>
<?php
foreach ($sqlCat as $row):
//set the class to "active" for the active tab.
$tab_class = ($row['tab_title']==$current_tab) ? 'active' : '' ;
echo '<li class="'.$tab_class.'"><a href="#' . urlencode($row['tab_title']) . '" data-toggle="tab">' .
$row['tab_title'] . ' </a></li>';
endforeach;
?>
</ul><!-- /nav-tabs -->
<div class="tab-content">
<?php foreach ($sqlCat as $row2):
$tab = $row2['tab_title'];
//set the class to "active" for the active content.
$content_class = ($tab==$current_tab) ? 'active' : '' ;
?>
<div class="tab-pane <?php echo $content_class;?>" id="<?php echo $tab; //-- this right here is from yoru code, but there was no "echo" ?>">
<div class="links">
<ul class="col">
<?php
// Again, I just made an array with some data, since I don't have your data source
$items = array(
array('title'=>'Home','tab_link'=>'http://home.com'),
array('title'=>'Profile','tab_link'=>'http://profile.com'),
array('title'=>'Messages','tab_link'=>'http://messages.com'),
array('title'=>'Settings','tab_link'=>'http://settings.com'),
array('title'=>'Profile','tab_link'=>'http://profile2.com'),
array('title'=>'Profile','tab_link'=>'http://profile3.com'),
);
// you have a while loop here, my array doesn't have a "fetch" method, so I use a foreach loop here
foreach($items as $item) {
//output the links with the title that matches this content's tab.
if($item['title'] == $tab){
echo '<li>' . $item['title'] . ' - '. $item['tab_link'] .'</li>';
}
}
?>
</ul>
</div>
</div><!-- /tab-pane -->
<?php endforeach; ?>
</div><!-- /tab-content -->
<!-- END OF YOUR CODE -->
This help me a lot. I have two static tabs for content creation which drive the dynamic tabs. It is definitely still a little rough but at least the concept is working.
<ul class="nav nav-tabs">
<li class="active">Clusters</li>
<li>Activities</li>
<?php
$sql = "<insert query here>";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $rowtab = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
$tab_class = ($rowtab['tab_title']==$current_tab) ? 'active' : '' ;
$nospaces = str_replace(' ', '', $rowtab['tab_title']);
echo '<li class="'.$tab_class.'"><a href="#' . urlencode($nospaces) . '" data-toggle="tab">' .
$rowtab['tab_title'] . '</a></li>';
}
?>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
Tab1 Content
</div>
<div class="tab-pane" id="tab2">
Tab2 Content
</div>
<?php
$sql = "<insert query here>";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $rowtab = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
$tab = $rowtab['tab_title'];
$nospaces = str_replace(' ', '', $rowtab['tab_title']);
$content_class = ($tab==$current_tab) ? 'active' : '' ;
echo '<div class="tab-pane'. $content_class.'" id="'.$nospaces.'">';
echo 'You are looking at the '.$tab.' tab. Dynamic content will go here.';
echo '</div><!-- /.tab-pane -->';
}
?>
</div>
foreach ($files as $file):
$filename = preg_replace("/\.html$/i", "", $file);
$title = preg_replace("/\-/i", " ", $filename);
$documentation = 'usage/'.$type.'/'.$file;
$tab1 = 'usage/'.$type.'/'.$file;
echo '<div class="sg-markup sg-section">';
echo '<div class="sg-display">';
echo '<h2 class="sg-h2"><a id="sg-'.$filename.'" class="sg-anchor">'.$title.'</a></h2>';
//TAb Set up
echo '<div class="row"><div class="col-md-12">';
echo '<ul class="nav nav-tabs" role="tablist">';
echo '<li role="presentation" class="active">Visual</li>';
echo '<li role="presentation">Rules</li>';
echo '</ul>';
echo '</div>';
echo '</div>';
//Visual Tab Content
echo '<div class="row"><div class="col-md-12">';
echo '<div class="tab-content">';
echo '<div role="tabpanel" class="tab-pane active" id="Visual">';
echo '<h3 class="sg-h3">Visual</h3>';
include('markup/'.$type.'/'.$file);
//View Source
echo '<div class="sg-markup-controls"><a class="btn btn-primary sg-btn sg-btn--source" href="#">View Source</a> <a class="sg-btn--top" href="#top">Back to Top</a> </div>';
echo '<div class="sg-source sg-animated">';
echo '<a class="btn btn-default sg-btn sg-btn--select" href="#">Copy Source</a>';
echo '<pre class="prettyprint linenums"><code>';
echo htmlspecialchars(file_get_contents('markup/'.$type.'/'.$file));
echo '</code></pre>';
echo '</div><!--/.sg-source-->';
echo '</div>';
//Documentation Tab Content
if (file_exists($documentation)) {
echo '<div role="tabpanel" class="tab-pane" id="Rules">';
echo '<h3 class="sg-h3">Rules</h3>';
include($documentation);
//View Source
echo '<a class="sg-btn--top" href="#top">Back to Top</a>';
echo '</div>';
}
//Documentation Tab1 Content
echo '<div role="tabpanel" class="tab-pane" id="Tab1">';
echo '<h3 class="sg-h3">Tab1</h3>';
include($tab1);
echo '<a class="sg-btn--top" href="#top">Back to Top</a>';
echo '</div>';
//Documentation Tab2 Content
echo '<div role="tabpanel" class="tab-pane" id="Tab2">';
echo '<h3 class="sg-h3">Tab2</h3>';
// include($tab2);
echo '<a class="sg-btn--top" href="#top">Back to Top</a>';
echo '</div>';
echo '</div>'; //End Tab Content
echo '</div>'; //End Column
echo '</div>'; //End Row
//echo '<div class="row"><div class="col-md-12">';
//echo '<h3 class="sg-h3">Example</h3>';
//include('markup/'.$type.'/'.$file);
//echo '</div>';
// if (file_exists($documentation)) {
// echo '<div class="col-md-12"><div class="well sg-doc">';
// echo '<h3 class="sg-h3">Rules</h3>';
// include($documentation);
// echo '</div></div></div>';
// }
echo '</div><!--/.sg-display-->';
//echo '</div><!--/.colmd10-->';
echo '</div><!--/.sg-section-->';
endforeach;
}

Categories