Hi i had an issue reported for my script (https://github.com/joshf/Indication/issues/6) about echo statements printing rather than excecuting
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Indication</title>
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="resources/bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
}
</style>
<link href="resources/bootstrap/css/bootstrap-responsive.css" type="text/css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<!-- Nav start -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">Indication</a>
</div>
</div>
</div>
<!-- Nav end -->
<!-- Content start -->
<div class="container">
<div class="page-header">
<h1><? echo WEBSITE; ?></h1>
</div>
<div class="alert alert-error"><h4 class="alert-heading">Error</h4><p>ID cannot be blank.</p><p><a class="btn btn-danger" href="javascript:history.go(-1)">Go Back</a></p></div></div></body></html>
Notice the echo WEBSITE
The PHP code is
die("<div class=\"alert alert-error\"><h4 class=\"alert-heading\">Error</h4><p>ID does not exist.</p><p><a class=\"btn btn-danger\" href=\"javascript:history.go(-1)\">Go Back</a></p></div></div></body></html>");
!
Is this a code issue or a configuration issue, im unable to reproduce it
This is probably because you are using php short tag <?..?>. Please avoid using them and switch to long one <?php....?>
Probably you have turned off short tags in the server.
It is not a good idea to use
<? /* something */ ?>
<?=echo $something;?>
Because in some servers short tags are disabled.
Try:
<?php echo WEBSITE; ?>
Related
webdevprocess.html
[This page is used solely for the search bar at the bottom of the page. Any search term can be entered and then a search engine can be selected from the drop down menu.]
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Web Development Process</title>
<meta name="Web Development Process" content="Simple Responsive Template is a template for responsive web design. Mobile first, responsive grid layout, toggle menu, navigation bar with unlimited drop downs, responsive slideshow">
<meta name="keywords" content="">
<!-- Mobile viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<!-- CSS-->
<!-- Google web fonts. You can get your own bundle at http://www.google.com/fonts. Don't forget to update the CSS accordingly!-->
<link href='http://fonts.googleapis.com/css?family=Droid+Serif|Ubuntu' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="js/flexslider/flexslider.css">
<link rel="stylesheet" href="css/basic-style.css">
<!-- end CSS-->
<!-- JS-->
<script src="js/libs/modernizr-2.6.2.min.js"></script>
<script type="text/javascript" src="mypiechart.js"></script>
<script type="text/javascript" src="canvasjs.min.js"></script>
<!-- end JS-->
</head>
<body>
<body id="home">
<!-- header area -->
<header class="wrapper clearfix">
<div id="banner">
<div id="logo"><img src="images/logo.jpg" alt="logo"></div>
</div>
<!-- main navigation -->
<nav id="topnav" role="navigation">
<div class="menu-toggle">Menu</div>
<ul class="srt-menu" id="menu-main-navigation">
<li class="current">Home page</li>
<!-- <li>Internal page demo</li> -->
<li>Client/Server Technology
<ul>
<li>
Client/Server Technology
</li>
<li>Domain Names and Hosting</li>
</ul>
</li>
<li>
JavaScript Pages
<ul>
<li>Web Development Process</li>
</ul>
</li>
<li>
PHP Pages
</li>
</ul>
</nav><!-- end main navigation -->
</header><!-- end header -->
<!-- main content area -->
<div id="main" class="wrapper">
<!-- content area -->
<section id="content" class="wide-content">
<div class="row">
<h1>What Is The Web Development Process?</h1>
<p>A web development process,or web design and development process, is a systematic process or methodology, used tp desgn and build web sites. Just as planing goes into the design
of cars, buildings, or homes, so too is the planning and design and development process required for web sites. A good process helps ensure customer requirements are delivered in a quality
, timely and cos-effective manner.</p>
<h1>SDLC and Project Management</h1>
<p>The web design and development process can be thought of as a type of software development life cycle (SDLC) and project management methodology. The waterfall model depicted
below is a long-standing, traditional SDLC that is characterized by sequential steps. Agile is a newer method that is intended to more quickly respond to changing customer and
product requirements using an incremental process with frequent releases and customer feedback.</p>
<h3>Traditional Waterfall SDLC Methodology (PNG image)</h3>
<p><img src="waterfall.png" alt="Waterfall SDLC"></p>
<p>Source: WikiPedia</p>
<h3>Agile Methodology (GIF image)</h3>
<p><img src="images/agile.png" alt="Agile Methodology"></p>
<h3>Web Development Phases (HTML/JavaScript image)</h3>
<div id="chartContainer" style="height: 450px; width: 95%;"></div>
<script>
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title: {
text: "Web Development Process"
},
data: [{
type: "pie",
startAngle: 240,
yValueFormatString: "##0.00\"%\"",
indexLabel: "{label} {y}",
dataPoints: [
{y: 20.00 , label: "Testing"},
{y: 10.00, label: "Promotion"},
{y: 25.00, label: "Analysis"},
{y: 20.00, label: "Design"},
{y: 25.00, label: "Construction"}
]
}]
});
chart.render();
}
</script>
<br>
<form action="search.php" method="get">
<table>
<tr>
<th colspan="2">Search Sites</th>
</tr>
<tr>
<td>Site to Search:</td>
<td>
<select name="site">
<option value="google">Google Web
<option value="googlei">Google Images
<option value="duck">DuckDuckGo
<option value="wiki">WikiPedia
</select>
</td>
</tr>
<tr>
<td>Search term(s):</td>
<td>
<input type="text" name="terms" size="25" maxlength="25">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit" class-"centercell">
</td>
</tr>
</table>
</form>
<br>
</div><!-- end row -->
</section><!-- end content area -->
</div><!-- #end div #main .wrapper -->
<!-- footer area -->
<footer>
<div id="colophon" class="wrapper clearfix">
Author: Janae Roland
</div>
<!--You can NOT remove this attribution statement from any page, unless you get the permission from prowebdesign.ro--><div id="attribution" class="wrapper clearfix" style="color:#666; font-size:11px;">Site built with Simple Responsive Template by Prowebdesign.ro</div><!--end attribution-->
</footer><!-- #end footer area -->
<!-- jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.9.0.min.js">\x3C/script>')</script>
<script defer src="js/flexslider/jquery.flexslider-min.js"></script>
<!-- fire ups - read this file! -->
<script src="js/main.js"></script>
</body>
</html>
search.php
[This program is supposed to send the search terms entered to large search engines (google,google images,duck duck go,wikipedia) but I am receiving a syntax error, "
Notice: Use of undefined constant FIlTER_SANITIZE_STRING - assumed 'FIlTER_SANITIZE_STRING' in /home/jsroland/public_html/search.php on line 13
Warning: filter_input() expects parameter 3 to be long, string given in /home/jsroland/public_html/search.php on line 13"]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="keywords" content="Rock,Paper,Scissors">
<meta name="description" content="A function that sends data to large search engines,through the WebDev search bar.">
<link rel="stylesheet" href="style.css" type="text/css">
<title>Search</title>
</head>
<body>
<?php
$site = substr(filter_input(INPUT_GET, 'site', FIlTER_SANITIZE_STRING),0,8);
$terms = substr(filter_input(INPUT_GET, 'terms', FILTER_SANITIZE_STRING),0,25);
if ($site == "google")
header('Location: http://www.google.com/#g=' . $terms);
else if ($site == "googlei")
header('Location: http://www.google.com/search?tbm=isch&g=' . $terms);
else if ($site == "duck")
header('Location: https://duckduckgo.com/?q=&ia=web' . $terms);
else if ($site == "wiki")
header('Location: https://en.wikipedia.org/wiki/' . $terms);
?>
</body>
</html>
The minimal correct urls for search engines would be as follows:
for general Google search: https://www.google.com/search?q='<search
terms>',
for Google image search:
https://www.google.com/search?tbm=isch&q='<search terms>',
for
DuckDuckGo: https://duckduckgo.com/?ia=web&q='<search terms>',
for
Wikipedia: https://en.wikipedia.org/wiki/<search terms>.
where <search terms> are the terms to search for.
Please also mind quotation marks in the first three cases. The final code would look something like this.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="keywords" content="Rock,Paper,Scissors">
<meta name="description" content="A function that sends data to large search engines,through the WebDev search bar.">
<link rel="stylesheet" href="style.css" type="text/css">
<title>Search</title>
</head>
<body>
<?php
$site = substr(filter_input(INPUT_GET, 'site', FIlTER_SANITIZE_STRING),0,8);
$terms = substr(filter_input(INPUT_GET, 'terms', FILTER_SANITIZE_STRING),0,25);
if ($site == "google")
header("Location: https://www.google.com/search?q='$terms'");
else if ($site == "googlei")
header("https://www.google.com/search?tbm=isch&q='$terms'");
else if ($site == "duck")
header("Location: https://duckduckgo.com/?ia=web&q='$terms'");
else if ($site == "wiki")
header("Location: https://en.wikipedia.org/wiki/$terms");
?>
</body>
</html>
Hey i don't understand my website doesn't work i have don't do anything so i will explain
I got a 0 in top on my page now!
Google Chrome Explorator:Screenshot
https://validator.w3.org/nu/?doc=http%3A%2F%2Fwww.wisementrade.com%2F
View/header.php: https://pastebin.com/7GqFYR75
View/homepage.php: https://pastebin.com/3htmFSmw
View/footer.php: https://pastebin.com/b3X9KScg
Controller/View.php: https://pastebin.com/cxCdcdEQ
Chrome viewer code: https://pastebin.com/Q8VYja5u
I have check the encode UTF-8 and i have re encode UTF-8 with my sublime text but nothing change ... please need help
EDIT: FIXED
I guess unclosed HTML tag cause this problerm. I found a few unclosed HTML tag in your View/header.php. Close it. try this.
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!--o-->
<?php
//Session
$customer_id = $this->session->userdata('customer_id');
$user_type = $this->session->userdata('user_type');
$statement = $this->session->userdata('timezone');
?>
<!--o-->
<link rel="icon" type="image/png" href="<?php echo base_url('images/favicon.png'); ?>" />
<meta name="author" content="Wise Men Trade" />
<meta name="copyright" content="Copyright Notice ©2015 WisemenTrade Limited and licensors. All rights reserved." />
<meta name="robots" content="all" />
<!--o-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script language="JavaScript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Bootstrap CSS -->
<link href="<?php echo base_url("css/bootstrap.min.css"); ?>" rel="stylesheet"/>
<!-- Basic CSS -->
<link href="<?php echo base_url("css/style.css"); ?>" rel="stylesheet"/>
<!-- Responsive CSS -->
<link href="<?php echo base_url("css/responsive.css"); ?>" rel="stylesheet"/>
<!-- Important Owl stylesheet -->
<link rel="stylesheet" href="<?php echo base_url("css/owl-carousel/owl.carousel.css"); ?>"/>
<!-- Default Theme -->
<link rel="stylesheet" href="<?php echo base_url("css/owl-carousel/owl.theme.css"); ?>"/>
<!-- MS DROP DOWN -->
<link rel="stylesheet" href="<?php echo base_url('css/msdropdown/flags.css'); ?>"/>
<link rel="stylesheet" href="<?php echo base_url('css/msdropdown/dd.css'); ?>"/>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62333409-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
</head>
<body>
<!--top-header-->
<header>
<div class="header_block">
<!-- left -->
<div class="block_left">
<a href="<?php echo base_url(); ?>">
<img src="<?php echo base_url("images/log_wmt.png"); ?>" class="logo" width="130" height="130" alt="Logo Wise Men Trade" />
</a>
</div>
</div>
</header>
also in your Controller/View.php have a few unclosed div (<div id="container"> and <div class="block_content">). check it and close it.
the last, make sure at the end of your Controller/View.php have a :
</body> <!-- end of body -->
</html> <!-- end of html -->
According to the documentation (https://www.codeigniter.com/user_guide/general/views.html), you could load multiple views in your controller, I think it doesn't work if you load it in the view, so you should have something like this:
<?php
class Page extends CI_Controller {
public function index()
{
$data['page_title'] = 'Your title';
$this->load->view('header');
$this->load->view('menu');
$this->load->view('content', $data);
$this->load->view('footer');
}
}
I have some big problems including my header in subfolder. I have a folder structure like this:
[![Folder structure][1]][1]
I would like to include my header in the innovatian-project.php. As I see it, I have to go back three folders to get to the root:
AU -> Courses -> Document Root
I have tried with the following:
<?php include '../../../resources/includes/header.php'?>
<?php include(__DIR__.'/resources/includes/header.php'); ?>
<?php include($_SERVER['DOCUMENT_ROOT'].'/header.php'); ?>
<?php include($_SERVER['DOCUMENT_ROOT'].'/resources/includes/header.php'); ?>
<?php include('../../resources/includes/header.php'); ?>
But none of this is working. I have tried so many things, that I cannot even remember anymore. Does anybody have an idea on what I can do? The path to the innovation-project is here:
<?php include 'resources/includes/header.php' ?>
<body id="services">
<?php include 'resources/includes/navbar.php' ?>
<!-- start intro section -->
<section class="intro">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<div class="intro-content">
<h1>Mine kompetencer <strong>strongest </strong></h1>
<h2>areas, where I can add the most value to a company </h2>
Mine kompetencer er baseret på
</div>
</div>
</div>
</div>
</section>
<!-- end intro section -->
UPDATE
When I use the following code, the header, nav and footer is called. But the CSS is not called:
<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/header.php' ?>
<body id="services">
<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/navbar.php' ?>
<!-- start intro section -->
<section class="intro">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<div class="intro-content">
<h1>Mine kompetencer <strong>strongest </strong></h1>
<h2>areas, where I can add the most value to a company </h2>
Mine kompetencer er baseret på
</div>
</div>
</div>
</div>
</section>
<!-- end intro section -->
<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/footer.php' ?>
UPDATE 2 WHERE I CALL THE CSS IN header.php
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Favicon -->
<link rel="shortcut icon" href="images/favicon.ico">
<!-- Stylesheets -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.css">
<link rel="stylesheet" href="css/owl.theme.css">
<link rel="stylesheet" href="css/owl.carousel.css">
<link rel="stylesheet" href="css/supersized.css">
<link rel="stylesheet" href="css/nivo-theme.css">
<link rel="stylesheet" href="css/nivo-lightbox.css">
<!-- Main Stylsheets -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/responsive.css">
<!-- Theme Color Stylesheet -->
<link rel="stylesheet" href="css/theme_color.css">
<!-- Google Font -->
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700' rel='stylesheet' type='text/css'>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<?php include_once("analyticstracking.php") ?>
</head>
<?php include($_SERVER['DOCUMENT_ROOT'].'/resources/includes/header.php'); ?>
See your php.ini about
allow_url_include
What is in your router file?
You have to go up 2 folders.
<?php include('../../resources/includes/header.php'); ?>
UPDATE
Change these lines in header.php: <link rel="stylesheet" href="css/bootstrap.min.css">
like <link rel="stylesheet" href="http://<?php echo $_SERVER['HTTP_HOST'] ?>/Portfolio_da/css/bootstrap.min.css">
I have a little template and in this template I have a query from database.
The name of the page is test.php and the code is:
This is the main page where i echo the content is named test.php
<?php include "components/header.php"; ?>
<div class="container">
<!-- Jumbotron -->
<?php
if (isset($_GET['user']))
{
$user = $_GET['user'];
}
else
{
die("Not found");
}
$result = mysqli_query($con, "SET NAMES utf8");
$query = "SELECT * FROM users WHERE fk_music=".$user;
$res = mysqli_query($con, $query);
$row = mysqli_fetch_assoc($res);
echo $row['text'];?>
</div>
<?php include "components/footer.php"; ?>
Now with the echo $row['text'] I have to echo all the content from the page, and in header.php are the data like <html><header><title></title></header> etc. How can I put a title foreach data from database dynamic?
There is the code from header.php
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>???</title>
<!-- Bootstrap core CSS -->
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="http://getbootstrap.com/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<link rel="stylesheet" href="/css/media-queries.css">
<link rel="stylesheet" href="/style.css">
<!--Hover categorii -->
<script src="/js/hover.js"></script>
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="/../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="http://getbootstrap.com/assets/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
Now in database i have two rows id of the post and the row named text where is stored the HTML of all the page
Here is an example with content existing in row['text']
<p class='style-title'>HERE IS THE THE TEXT I WANT TO PUT IT IN <title> </p>
<div class='jumbotron'>
<img class='img-responsive' src='/img/img.png'/>
</div>
<div class='row'>
<div class="col-lg-10 ">
<img class='img-responsive' src='/img/50.png' align='left' />
<p class='some-class'>Lorm ipsum</p>
This has been stumping me all day. I'm using a mysql based SESSION on my php file. All of the other browsers, except IE, are displaying my pages with the appropriate CSS files and they look fine (more specifically, it is changing my hover effects on my menu and changing the alignment of my footer). I've tested the file without the SESSION code in IE and it works fine. What is causing IE to change my layout when the SESSION is added?? Very frustrated. I'm sure you can tell I'm a php beginner from this message. Please help. Thank you.
James
<?php
session_start();
if(#$_SESSION['auth'] != yes)
{
header("location: http://www.setdesign-la.com/login_reg.php");
exit();
}
echo "<center><a href='logOut.php'>Log Out</a></center>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Bagelmania | bagels and spreads | delicious coffee | sandwiches
<link rel="shortcut icon" href="bm.ico">
<link rel="stylesheet" type="text/css" href="http://www.setdesign-la.com/bagelmaniaStyle.css"/>
<link rel="stylesheet" type="text/css" href="http://www.setdesign-la.com/bagelmaniaMainMenu.css"/>
<link rel="stylesheet" type="text/css" href="http://www.setdesign-la.com/bagelmaniaFooter.css"/>
</head>
<body>
<div id="topFade"></div>
<div id="banner">
<div id="bannerContainer">
<div id="bannerContent">
<div id="bannerFlower">
</div>
<!-- END BannerFlower -->
<div id="bannerPar">
</div> <!-- END bannerPar -->
</div><!-- END bannerContent -->
</div><!-- END bannerContainer -->
</div><!-- END banner -->
<div id="menuWrapper">
<div id="menuContainer">
<div id="centeredmenu">
-Home
-Affiliate Marketing
-SEO
-Training
-Articles
-Tacos
-Yum
</div> <!-- END centeredmenu -->
</div> <!-- END menuContainer -->
</div> <!-- END menuWrapper -->
<div id="wrapper">
<div id="container">
The reason is probably that you are outputting HTML before you are declaring the doctype. That causes IE to switch to quirks mode.
Solution: Move this line
echo "<center><a href='logOut.php'>Log Out</a></center>\n";
into the HTML document.