Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
What is this unexpected T_STRING "h" on line 39?
I Don't see any problem in the code, why is the string "h"?
I Think Its due to the java script option for orientation in the code
which i set to "h" or horizontal
<?php
include "system.php";
$usersystem = $_SESSION['username'];
$passw = $_SESSION['password'];
$query= "SELECT * FROM users WHERE username = '$usersystem' AND password = '$passw'";
$autoexec= $mysqli->query($query);
$earnings = $autoexec['earnings'];
$completed = $autoexec['completed'];
if ($_SESSION['loggedin'] !=1){
header ('Location: index.php);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Highest Paying GPT Site in the Industry!</title>
<meta name="keywords" content="GPT, Surveys, free money, free cash, free stuff" />
<meta name="description" content="A New Innovative GPT Site" />
<link href="css/templatemo_style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js">
/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<script type="text/javascript">
ddsmoothmenu.init({
mainmenuid: "templatemo_menu", //menu DIV id
orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu', //class added to menu's outer DIV
//customtheme: ["#1c5a80", "#18374a"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})
</script>
<link rel="stylesheet" type="text/css" media="all" href="css/jquery.dualSlider.0.2.css" />
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="js/jquery.timers-1.2.js" type="text/javascript"></script>
<script src="js/jquery.dualSlider.0.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#carousel").dualSlider({
auto:true,
autoDelay: 6000,
easingCarousel: "swing",
easingDetails: "easeOutBack",
durationCarousel: 1000,
durationDetails: 600
});
});
</script>
</head>
<body>
<div id="templatemo_header_wrapper">
<div id="templatemo_header">
<div id="site_title">Great GPT Site</div>
<div id="templatemo_menu" class="ddsmoothmenu">
<ul>
<li>Home</li>
<li>How?
</li>
<li>Register
</li>
<li>Login</li>
<li>Contact Us</li>
</ul>
<br style="clear: left" />
</div> <!-- end of templatemo_menu -->
</div> <!-- END of templatemo_header -->
</div> <!-- END of templatemo_header_wrapper -->
<div id="templatemo_slider_wrapper">
<div id="templatemo_slider">
<div id="carousel">
<div class="panel"><!-- /details_wrapper -->
<p></p>
<h6></h6>
<p></p>
<h2>Welcome To Your Account! <?php echo "$username" ?></h2>
<h6><em> Statistics</h6>
<br />
<h6><em>Earnings: <?php echo "$earnings" ?><em></h6>
<br />
<h6><em>Completed Offers: <?php echo "$completed" ?></h6>
<p> </p>
<h6><em>Next Payment: End of next Month </h6>
<h6><em><a href=offers.php>Offers List</a></em></h6>
<p> </p>
<h5></h5>
<p> </p>
<p> </p>
<p> </p>
<h6></h6>
<p> </p>
<br />
<h6><em></h6>
<p> l</p>
<p> </p>
</div>
<!-- /panel -->
<h6> Welcome to <?php echo $title?> </h6>
<div id="slider-image-frame">
<div class="backgrounds">
<div class="item item_1">
<img src="images/slider/02.jpg" alt="Image 01" />
</div><!-- /item -->
<div class="item item_2">
<img src="images/slider/03.jpg" alt="Image 02" />
</div><!-- /item -->
<div class="item item_3">
<img src="images/slider/01.jpg" alt="Image 03" />
</div><!-- /item -->
</div><!-- /backgrounds -->
</div>
</div>
</div> <!-- END of templatemo_slider -->
</div> <!-- END of templatemo_slider_wrapper -->
<div id="templatemo_main">
<div class="homepage_post col half float_l">
<h2>Latest News Bulletin</h2>
<div class="post_meta">By Mark | Feburary 2, 2014</div>
<h6><img src="images/templatemo_image_02.jpg" class="image_fl imgage-with-frame" alt="Image 02"/> </h6>
<h6><em>New Offer Wall Added</em></h6>
<h6>New Offer Wall By BLVD Media has been released, check it out!</h6>
<h6>Offer Wall</h6>
</div>
<div class="col half float_r">
<h2>Note From the admin</h2>
<p>I've Recently Noticed alot of people have been requesting to know what the payment schedule is NOTE PAYMENTS ARE DETERMINED BY OUR ADVERTISERS Our Schedule is NET-30. This can change at any time</p>
<ul class="templatemo_list">
<li class="flow">Paypal is Preffered Method</li>
<li class="flow">Amazon is also Supported</li>
</ul>
</div>
<p> </p>
<div class="cleaner h40"></div>
<div class="cleaner"></div>
</div>
<!-- END of templatemo_main -->
<div id="templatemo_footer_wrapper">
<div id="templatemo_footer">
Copyright © 2014 <?php echo $title ?></div> <!-- END of templatemo_footer -->
</div> <!-- END of templatemo_footer_wrapper -->
<script type='text/javascript' src='js/logging.js'></script>
</body>
</html>
You are missing an ' in this line:
header ('Location: index.php);
It should be:
header ('Location: index.php');
you missed a quote ' in header ('Location: index.php). It should be :
<?php
include "system.php";
$usersystem = $_SESSION['username'];
$passw = $_SESSION['password'];
$query= "SELECT * FROM users WHERE username = '$usersystem' AND password = '$passw'";
$autoexec= $mysqli->query($query);
$earnings = $autoexec['earnings'];
$completed = $autoexec['completed'];
if($_SESSION['loggedin']!=1){
header ('Location: index.php');
// --^
}
?>
Related
I have coded a working page but did not incorporate webpage responsiveness which I now need desperately! Is there a single line of code that will make the entire webpage responsive or do I need to make each element responsive?
I have tried to include the following code but to no success:
<meta name="viewport" content="width=device-width, initial-scale=1">
Here is the full code:
<?php
session_start();
$customer = $_SESSION['id_login'];
$order = $_SESSION['id_login'];
if (!isset($_SESSION['mysesi']) && !isset($_SESSION['mytype'])=='customer')
{
echo "<script>window.location.assign('LoginAndReg.php')</script>";
}
?>
<?php
include("admin/php/myFunctions.php");
#mysql_connect("localhost","root","") or die("Could not connect to database");
#mysql_select_db("bookstore") or die("Could not select database");
$displayImages = "";
if((isset($_GET['cat']) ? $_GET['cat'] : '') == "children")
$sqlSelProd = #mysql_query("select * from tblproduct where prod_cat = '$_GET[cat]'") or die(mysql_error());
else if((isset($_GET['cat']) ? $_GET['cat'] : '') == "Horror")
$sqlSelProd = #mysql_query("select * from tblproduct where prod_cat = '$_GET[cat]'") or die(mysql_error());
else if((isset($_GET['cat']) ? $_GET['cat'] : '') == "Thriller")
$sqlSelProd = #mysql_query("select * from tblproduct where prod_cat = '$_GET[cat]'") or die(mysql_error());
else
$sqlSelProd = #mysql_query("select * from tblproduct") or die(mysql_error());
if(mysql_num_rows($sqlSelProd) >= 1){
while($getProdInfo = mysql_fetch_array($sqlSelProd)){
$prodNo = $getProdInfo["prod_no"];
$prodID = $getProdInfo["prod_id"];
$prodName = $getProdInfo["prod_name"];
$prodPrice = $getProdInfo["prod_price"];
$displayImages .= '<div class="col col_14 product_gallery">
<img src="images/product/'.$prodNo.'.jpg" alt="Product '.$prodNo.'" width="170" height="150" />
<h3>'.$prodName.'</h3>
<p class="product_price">R '.$prodPrice.'</p>
Add to Cart</div>';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Responsive code -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Great selling Book Store</title>
<link href="css/slider.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<script language="javascript" type="text/javascript">
function clearText(field)
{
if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;
}
</script>
</head>
<body id="home">
<div id="main_wrapper">
<div id="main_header">
<div id="site_title"><h1>Book Store</h1></div>
<div id="header_right">
<div id="main_search">
<form action="products.php" method="get" name="search_form">
<input type="text" value="Search" name="keyword" onfocus="clearText(this)" onblur="clearText(this)" class="txt_field" />
<input type="submit" name="Search" value="" alt="Search" id="searchbutton" title="Search" class="sub_btn" />
<p>Welcome, <?php echo $_SESSION['mysesi'] ?></p> Log Out
<?php echo $customer ?>
<?php echo $order ?>
</form>
</div>
</div> <!-- END -->
</div> <!-- END of header -->
<div id="main_menu" class="ddsmoothmenu">
<ul>
<li>Home</li>
<li>Books</li>
<li>Cart</li>
<li>Checkout</li>
<li>About</li>
</ul>
<br style="clear: left" />
</div> <!-- end of menu -->
<div id="main_middle">
<img src="images/image_book.png" alt="Image 01" width="500" height="170" />
<h1>Great Selling book Store</h1>
<p>Great Selling book Store is a country wide book store.</p>
Browse All books
</div> <!-- END of middle -->
<div id="main_top"></div>
<div id="main">
<div id="sidebar">
<h3>Categories</h3>
<ul class="sidebar_menu">
<li>Children</li>
<li>Horror</li>
<li>Thriller</li>
</ul>
</div> <!-- END of sidebar -->
<div id="content">
<h2>Products</h2>
<?php echo $displayImages; ?>
</div> <!-- END of content -->
<div class="cleaner"></div>
</div> <!-- END of main -->
<div id="main_footer">
<div class="cleaner h40"></div>
<center>
Copyright © 2048 DigitalNinja
</center>
</div> <!-- END of footer -->
</div>
<script type='text/javascript' src='js/logging.js'></script>
</body>
</html>
I would recommend using bootstrap it's easy to use and it can make your page responsive by just adding some classes to your file.
I think this is what you've been looking for:
How to get just the responsive grid from Bootstrap 3?
I am running a code that's supposed to pull a questionnaire from a database for evaluation by a user with a valid session.
However, the page returns a blank incomplete page while running this php code.
Am I missing something here?
<?php
session_start();
try
{
if(!isset($_SESSION['logged-in']))
{
header("Location: ../index.php");
}
}
catch(Exception $e)
{
}
// php classes
require_once("../classes/database.php");
require_once("../classes/questionnaire.php");
require_once("../classes/competency.php");
require_once("../classes/candidate.php");
require_once("../classes/participant.php");
require_once("../classes/progress.php");
require_once("../classes/user.php");
require_once("../classes/page.php");
// candidate details
if($_SESSION['usertype'] == 'candidate') // if user is doing a self evaluation
{
$candidatename = User::getName($_SESSION['id']);
$candidateusername = $_SESSION['username'];
// questionnaire object
$q = new Questionnaire(Questionnaire::getQuestionnaireName($_SESSION['id']));
}
else if($_SESSION['usertype'] == 'participant') // if user is evaluating their candidate
{
$candidatename = User::getName(Participant::getCandidateID(NULL, $_SESSION['id']));
$candidateusername = Participant::getCandidate($_SESSION['id']);
// questionnaire object
$q = new Questionnaire(Questionnaire::getQuestionnaireName(Participant::getCandidateID(NULL, $_SESSION['id'])));
}
$candidateID = User::getUID($candidateusername);
// objects
$page = new Page('evaluation');
$user = new User($_SESSION['username']);
// page height
$pagename = $page->name;
$page->setHeight(0, true, $q->numCompetencies());
?>
This is the HTML has to be output
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../css/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="../css/ie.css" />
<link rel="stylesheet" type="text/css" href="../css/custom.css" />
<link rel="stylesheet" type="text/css" href="../css/evaluation.css" />
<link rel="stylesheet" type="text/css" href="../css/progress-bar.css" />
<link rel="stylesheet" type="text/css" href="../css/error.css" />
<!-- JAVASCRIPT -->
<script type="text/javascript" language="javascript" src="../js/slide/help.js"></script>
<script type="text/javascript" language="javascript" src="../js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" language="javascript" src="../js/slide/evaluation.js"></script>
<script type="text/javascript" language="javascript" src="../js/slide/questionnaire.js"></script>
<script type="text/javascript" language="javascript" src="../js/validation/validateevaluation.js"></script>
<script type="text/javascript" language="javascript" src="../js/instructions.js"></script>
</head>
<body onload="viewCompetency('#st1')">
<!-- WEBSITE -->
<!-- BANNER -->
<div class="banner">
<div class="container">
<!-- logo div -->
<div class="span-5 logo"></div>
<!-- menu div -->
<!-- main menu -->
</div>
</div>
<div class="topseparator"></div>
<!-- PAGE CONTENT -->
<div class="container indexdesktop">
<?php include("../common/minidashboard.php"); ?>
<!-- desktop content -->
<div class="span-24" style="height: <?php print $page->height.'px'; ?>">
<!-- CONTENT MODULEBOX -->
<div class="modulebox-classy">
<div class="pageheading"><h3><span class="blue">REDMA 360 </span><span class="grey">EVALUATION</span></h3></div>
<div class="contentwide">
<div class="iconswide" id="addcand"></div>
<p>Kindly give very candid feedback to the person whose name appears below (candidate)</p>
<!-- INSTRUCTIONS -->
<p> </p>
<div class="instructions" id="instructionswidth-evaluation">
<div class="instructions-heading" onclick="showInstructions()"><div class="instructions-icon"></div>INSTRUCTIONS</div>
<div class="instructions-content" id="instructions-content">
<p>Click the <span class="italic">Accordian Menu</span> to show the competency you want to evaluate. Give a rating on the drop-down select box according to the <span class="italic">Scoring Key</span> below. When you have completed scoring <span class="italic">ALL</span> competencies in the <span class="italic">Questionnaire</span>, a <span class="strong italic">Done</span> button will show. Click <span class="strong italic">Done</span> to complete your evaluation.</p>
<p><h5 class="strong white">SCORING KEY:</h5><ol><li>Demonstrates <span class="strong italic">almost none</span> of the behaviour</li><li>Demonstrates <span class="strong italic">some</span> of the behaviour</li><li>Demonstrates <span class="strong italic">about half</span> of the behaviour</li><li>Demonstrates <span class="strong italic">majority</span> of the behaviour</li><li>Demonstrates the behaviour <span class="strong italic">fully</span></li></ol></p> </div>
</div>
</div>
<div class="contentwide" id="evaluationwidth">
<!-- Display Questionnaire -->
<h3>Welcome to Redma360 Evaluation</h3>
<h4 class="grey"><span class="blue">QUESTIONNAIRE:</span> <?php print Questionnaire::getQuestionnaireName($user->username);?><br />
<?php
print '<span class="blue">CANDIDATE:</span> '.strtoupper($candidatename);
if($user->usertype == 'participant') // if user is evaluating their candidate
{
print '<br /><span class="blue">PARTICIPANT ('.Participant::getPartType($user->username).'):</span> '.strtoupper($user->name);
}
?>
</h4>
<!-- Evaluation Accordian -->
<div class="evaluation-container">
<form action="evaluationaction.php" name="saveForm" id="saveForm" method="post" >
<?php $competenciesEvaluatedArr = Questionnaire::displayEvaluationCompetencies($q->getName(), User::getUID($candidateusername), $user->id); ?>
<input type="hidden" name="saveButton" id="saveButton" />
</form>
</div>
<?php
if($user->competenciesdone == $q->numCompetencies())
{
?>
<div class="evaluationthankyou" id="evaluationthankyou">Thank you!</div>
<div class="evaluationsubmitbutton" id="evaluationsubmitbutton">
<form action="evaluationdone.php" name="doneForm" method="post" >
<input type="image" name="doneButton" src="../images/button-done-large.png" />
</form>
</div>
<?php
}
?>
</div>
<!-- progress bar -->
<div class="sidebar-progress" id="sideprogress-evaluation">
<div class="content" id="progress">
<!-- sidebar heading -->
<div class="sidebar-subheading-color-blue" id="evaluation-sidebar-heading">See the progress and number of competencies answered so far below. </div>
<!-- progress bar -->
<div class="content">
<?php Progress::getProgressBar(User::getNumGraded(User::getUID($_SESSION['username'])), Questionnaire::getNumCompetencies($q->getID())); ?>
<p> </p>
</div>
<div class="modulebox-display">
<h4>Competencies Answered So Far</h4>
<table class="competenciesevaluated">
<thead>
<tr>
<th>Competency</th>
</tr>
</thead>
<tbody>
<?php
foreach($competenciesEvaluatedArr as $arr)
{
print '<tr>
<td>'.$arr.'</td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- FOOTER -->
<?php include("../common/footer.php"); ?>
</body>
Add exit(0), after the header(....), it may solve your problem.
try
{
if(!isset($_SESSION['logged-in']))
{
header("Location: ../index.php");
exit(0);//Add this line
}
}
catch(Exception $e)
{
}
Turns out that I was missing a class in the included questionnaire.php file.
Putting error reporting to to my PHP file was very helpful.
Thanks
I'm having trouble with creating some sort of indicator on a webpage.
This should show me if something is turned on or off.
My project concerns on making a "automatic" terrarium controller, with sensors, relays and a raspberry. I'm able to show the sensor readings on a website, updating every minute (using jQuery).
At certain times, some relays are activated (which still has to be done, relay arrived today) and I want to see on the site if relay 1 is activated or not and again, updated automatically when this changes. The program to activate some relays is in python, and will also write a txt-file, containing a "0" or a "1" (for "off" and "on").
Then, using for instance a switch (e.g. switch) which should show the state of the relay, according to the txt file.
But, I don't seem to get it working.
Using PHP If and Else statements, ends up showing both even when using simple images as "indicators" of the relay.
<?php
$myfile = fopen("./statusUV.txt", "r") or die("Unable to open file!");
$status= fread($myfile);
if ($status == 1){
print ('<img src=./images/on.png />');
}
else{
print ('<img src=./images/on.png />');
}
But, how can different div's been shown, in case of this switch?
Oh, and I have to say, I'm new to PHP, HTML, Python, jQuery etc.
The "button" doesn't have to be clickable, it just have to show the state of the relay (or the output in the file).
If more information is needed, please, let me know!
Thanks in advance!
<!DOCTYPE HTML>
<html>
<head>
<title>UV</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700' rel='stylesheet' type='text/css'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-panels.min.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-desktop.css" />
</noscript>
<?php
$myfile = fopen("./statusUV.txt", "r") or die("Unable to open file!");
$status= fread($myfile);
fclose($myfile);
switch(intval($status)){
case 0 : $img = "<img src='./images/off.png' />"; break;
default : $img = "<img src='./images/on.png' />";break;
}
?>
</head>
<body class="left-sidebar">
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<div id="header">
<div class="container">
<!-- Nav -->
<nav id="nav">
<ul>
<li class="active">Data</li>
<li>UV timer</li>
<li>Heat Timer</li>
<li>Led Timer</li>
<li>Sproeier Timer</li>
<li>Apparaten</li>
</ul>
</nav>
</div>
<div id="logo-wrapper">
<div class="container">
<!-- Logo -->
<div id="logo">
<h1>Timer<span class="tagline"> voor Sproeier</span></h1>
</div>
</div>
</div>
</div>
<!-- /Header -->
<!-- Main -->
<div id="main-wrapper">
<div class="divider"> </div>
<div id="main">
<div class="container">
<div class="row">
<div id="sidebar" class="4u">
<?php
if (isset($img)){
echo $img;
echo $status;
}?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="divider"> </div>
<!-- /Wrapper -->
<div id="copyright">
<div class="container">
<p style="font-size:11px">Design: TEMPLATED Images: Unsplash (CC0)</p>
</div>
</div>
</body>
</html>
Assume the var $status = 1 or 0 in the text file.
Your code must be like that :
<html>
<head>
<?php
$myfile = fopen("./statusUV.txt", "r") or die("Unable to open file!");
$status = fread($myfile);
fclose($myfile);
switch(intval($status)){
case 1 : $img = "<img src='./images/on.png' />"; break;
default : $img = "<img src='./images/off.png' />"; break;
}
?>
</head>
<body>
<?php
if (isset($img)){
echo $img;
}?>
</body>
</html>
Some PHP-problems has been solved by reseting the server. Apparently that would fix the strange code appearing on the site.
Now, after testing various things, it appears that $status remains empty. After trying various techniques, I found that fgets($myfile) would do the trick, instead of the fread($myfile)! Thanks everyone for helping!
Not sure if I really need my specific code for the example since this is a pretty simple scenario. I've got a php file:
<html>
<?php
*Some code hat pulls data from a database. This involves queries, for loops, etc.
?>
</html>
The problem only happens on Google Chrome: the page starts loading, processes the PHP and THEN gets to closing the tag. This causes an ugly slide-down type effect where the next page looks like it's loading over the previous one.
That's how it looks for a moment in Chrome, and I know I'm doing something in a very unorthodox way. I really don't know the conventions of php yet, but I'm learning fast.
What should I be doing different? I prefer not to close the tag before the php code, because then things will be out of place and everything after the php, of course, won't be contained in the html tag.
EDIT: Forgot to mention that it happens during the redirect after you log in!
EDIT:
<?php
require 'autoload.php';
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;
use Parse\ParseRelation;
use Parse\ParseSessionStorage;
session_start();
ParseClient::initialize( $app_id, $rest_key, $master_key );
$currentUser = ParseUser::getCurrentUser();
if ($currentUser) {
} else {
header("Location: http://rev-u.co/login");
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href='http://fonts.googleapis.com/css?family=Noticia+Text' rel='stylesheet' type='text/css'>
<script src="//www.parsecdn.com/js/parse-1.3.2.min.js">
</script>
<link rel="stylesheet" href="/css/normalize.css">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/home.css">
<link rel="stylesheet" href="/css/responsive.css">
<link href='http://fonts.googleapis.com/css?family=Raleway:400' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Slabo+27px' rel='stylesheet' type='text/css'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<script src="/js/star-rating.min.js" type="text/javascript">
</script>
<link href="/css/star-rating.min.css" media="all" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="/js/bootstrap.js">
</script>
<script type="text/javascript" src="/js/centralpage.js">
</script>
<meta name="viewport" content="width=device-width">
</head>
<header>
<div class="logo">
<h1 class="brand">
Rev-u
</h1>
</div>
<div class="topbuttons">
<form action="/logout.php">
<button type="submit" class="btn btn-primary" id="login">
Logout
</button>
</form>
<button class="btn btn-secondary" id="profilebutton">
My Profile
</button>
<a href="index">
<button class="btn btn-secondary active" id="homebutton">
Home
</button>
</a>
</div>
</header>
<div class="wrapper">
<div class="recentfeedcontainer">
<h3>
Recent Reviews:
</h3>
<div class="loadercontainer">
<div id="circularG" class="recentloader">
<div id="circularG_1" class="circularG">
</div>
<div id="circularG_2" class="circularG">
</div>
<div id="circularG_3" class="circularG">
</div>
<div id="circularG_4" class="circularG">
</div>
<div id="circularG_5" class="circularG">
</div>
<div id="circularG_6" class="circularG">
</div>
<div id="circularG_7" class="circularG">
</div>
<div id="circularG_8" class="circularG">
</div>
</div>
</div>
<?php
$url;
$currentfriend;
$friendname;
// $currentUser
$relation = $currentUser->getRelation("FriendRelations");
$results = $relation->getQuery()->find();
if (count($results) != 0)
{
for ($i = 0; $i < count($results); $i++)
{
$object = $results[$i];
if ($results[$i]->get("profilePicture") != null)
{
$url = $results[$i]->get("profilePicture")->getUrl();
}
else
{
$url = "img/batmanfacebook.jpg";
}
$currentfriend = $results[$i]->get("username");
if ($results[$i]->get("name") != null) $friendname = $results[$i]->get("name");
else $friendname = $currentfriend;
$query = new ParseQuery("Reviews");
$query->equalTo("User", $currentfriend);
$query->descending("createdAt");
$result = $query->first();
// $review = $result->
get("text");
// $rate = $result->
get("Rating");
if (count($result) > 0) echo '
<div id = "reviewitem" class=reviewitem_"' . $i . '">
<input id="input-id' . $i . '" type="number" class="rating" min=0 max=5 step=1 data-size="xs" data-show-caption="false" data-show-clear="false" readonly="false">
<div id = "reviewimgcontainer" class="reviewimgcontainer_' . $i . '">
<img src="' . $url . '">
<h5>
<a href="/u/' . $currentfriend . '">
' . $friendname . '
</a>
</h5>
</div>
<p>
' . $result->get("text") . '
</p>
</div>
';
}
?>
<script type="text/javascript">
$('.loadercontainer').addClass('hidden');
</script>
<?php
}
?>
</div>
</div>
<div class="friendscontainer">
<h3>
Following
</h3>
<ul>
</ul>
<div class="loadercontainer">
<div id="circularG">
<div id="circularG_1" class="circularG">
</div>
<div id="circularG_2" class="circularG">
</div>
<div id="circularG_3" class="circularG">
</div>
<div id="circularG_4" class="circularG">
</div>
<div id="circularG_5" class="circularG">
</div>
<div id="circularG_6" class="circularG">
</div>
<div id="circularG_7" class="circularG">
</div>
<div id="circularG_8" class="circularG">
</div>
</div>
</div>
</div>
<div class="friendstab">
<img style="border-radius:5px; box-shadow: 0px 0.5px 1.2px 0.5px;
margin-top:235px; width:40px; height:40px" src="img/friends.png">
</div>
</html>
PHP gets executed on the server and then the result is sent to the browser. The browser never sees any PHP code. You must have done something different wrong. Maybe it's better to share your full code with us.
Always do Database Queries and intense loops BEFORE any output goes to the client. You're codes general structure should look like this ...
<?php
// Some code hat pulls data from a database. This involves queries, for loops, etc.
?>
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>blah</title>
</head>
<body>
<p>I'm the content</p>
</body>
</html>
Really should be voting to close this as too broad, but some hints might point you in the right direction...
Look at your network waterfall (developer tools). That will tell you if the delay really does occur in the HTML generation. It is rather unusual that you would get a chunked response unless you did an explicit flush (there are sometimes good reasons for doing this). It certainly has nothing to do with where you put your closing tags. If it is your PHP where the problem lies, use a profiler to isolate the problem.
I would like to kindly ask you to help me understand how does the view part "see" the layout part in the zend framework.
In my way of thinking(and I'm thinking like a noob) there should be a root that directs the view (index.phtml) to the layout (designer.phtml) right?
Below is not my code, I'm just trying to make sense of it.
This is the view part of the code, the root of the file is /applications/xampp/xamppfiles/htdocs/mts/applications/modules/designer/views/scripts/index/ index.phtml
<div style="width:100%; margin-bottom:20px; margin-top:5px;">
<span style="padding-left:10px; font-size:18px;">Designer <img alt="(?)" src="/style/images/help-8.png"/></span>
</div>
<?= $this->leftmenu; ?>
<div id="picFrame" style="text-align: center"></div>
<div id="middle_admin_content">
<fieldset>
<legend id="bookTitleLegend">Please select a book first</legend>
<div id="fileBox"><div id="innerBox"></div></div>
<div id="uploadSuccess" class="statusBox" style="display: none; background-color: #D9F5CB"><span>File Uploaded Successfully</span></div>
<div id="uploadFailed" class="statusBox" style="display: none; background-color: #EBB9B9"><span>File Upload Failed</span></div>
<div id="aboutTheBook" style="display: none">
<form id="aboutTheBookForm" action="" method="post">
<textarea name="about_the_book" id="about_the_book" cols="60" rows="10"></textarea>
<input type="submit" value="Save Text" name="saveCoverText"/>
<input type="hidden" value="" name="bookid" id="bookidField"/>
</form>
</div>
</fieldset>
</div>
This is the layout part of the code, the root of the file is
/applications/xampp/xamppfiles/htdocs/mts/applications/layouts/scripts/designer.phtml
<?php echo $this->doctype() ?>
<html>
<head>
<title>InTech - Design</title>
<?php
echo $this->headTitle() . "\n";
echo $this->headMeta() . "\n";
?>
<?
echo $this->headStyle() . "\n";
echo $this->headLink() . "\n";
echo $this->headScript(). "\n";
?>
<?
/*
$jsContainer = $this->Minify_Container();
$jsContainer->appendFile('/js/jquery-1.4.2.min.js');
$jsContainer->appendFile('/js/jquery-ui-1.8.2.custom.min.js');
$jsContainer->appendFile('/js/jquery.autocomplete.js');
$jsContainer->appendFile('/js/jquery.bgiframe.min.js');
$jsContainer->appendFile('/js/jquery.idTabs.min.js');
$jsContainer->appendFile('/js/jquery/jquery.form.js');
$jsContainer->appendFile('/js/uploadify/jquery.uploadify.v2.1.4.min.js');
$jsContainer->appendFile('/js/designer/designer.js');
$jsContainer->appendFile('/js/scrollpane/jquery.jscrollpane.min.js');
$jsContainer->appendFile('/js/scrollpane/jquery.mousewheel.js');
echo $this->Minify($jsContainer, 'js');
$cssContainer = $this->Minify_Container();
$cssContainer->appendStylesheet('style/ui.all.css');
$cssContainer->appendStylesheet('js/jquery-ui-1.8.2.custom.css');
$cssContainer->appendStylesheet('style/site_css/designer_style.css');
$cssContainer->appendStylesheet('js/scrollpane/jquery.jscrollpane.css');
echo $this->Minify($this->headLink(), 'css');
echo $this->Minify($cssContainer, 'css');
*
*/
?>
<!-- MINIFIED ABOVE ------------------------->
<link rel="shortcut icon" href="/style/site_images/favicon.ico" type="image/x-icon" />
<link type="text/css" href="/style/ui.all.css" rel="stylesheet" />
<link type="text/css" href="/js/jquery-ui-1.8.2.custom.css" rel="stylesheet" />
<link type="text/css" href="/style/site_css/designer_style.css" rel="stylesheet" />
<link type="text/css" href="/js/scrollpane/jquery.jscrollpane.css" rel="stylesheet" />
<!--<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>-->
<script type="text/javascript" src="/assets/modules/manager/basic/js/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="/assets/modules/manager/basic/js/plugins/jquery.form.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.2.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="/js/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="/js/jquery.idTabs.min.js"></script>
<!--<script type="text/javascript" src="/js/jquery/jquery.form.js"></script>-->
<script type="text/javascript" src="/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="/js/designer/designer.js"></script>
<script type="text/javascript" src="/js/scrollpane/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="/js/scrollpane/jquery.mousewheel.js"></script>
<!-- -->
</head>
<body>
<div id="dialog" style="display:none; font-size:12px; background-color:#ffffff;">
<div id="dialog_left" style="float:left; width:150px">
</div>
<div id="dialog_right">
</div>
</div>
<div id="dialogDelete" style="display: none">Delete Item?</div>
<!-- HEADER SITE AREA :: START -->
<div id="header">
<?php
$front = Zend_Controller_Front::getInstance();
$module = $front->getRequest()->getModuleName();
echo $this->render('header-designer.phtml', array(
'authenticated' => $this->authenticated
));
?>
</div>
<!-- HEADER SITE AREA :: END -->
<!-- CONTENT :: START -->
<div id="contentAdmin">
<div id="helpDialog" style="display: none"></div>
<?php echo $this->layout()->content ?>
</div>
<!-- CONTENT :: END -->
<!-- FOOTER SITE AREA :: START -->
<div id="footer">
<?php echo $this->render('footer.phtml', array(
'authenticated' => $this->authenticated
)) ?>
</div>
<!-- FOOTER SITE AREA :: START -->
</body>
</html>
The specific mechanics of how all this implemented involves bootstrapping application resources and registering late-running front-controller plugins.
But the short answer is the "system" knows how to find/render the view-script associated to the requested action and how to find/render your layout script with the view-script content injected.
Remember, at some point, you bootstrapped a Layout resource, probably in configs/application.ini.
You also bootstrapped a View resource - either explicitly or implicitly - which knows how to render your headTitle(), headMeta(), headScript(), etc (all rendered using view-helpers), as well as the layout.
So, there's really no mystery that the "system" is aware of all this stuff.