So is there a built in way to handle this stuff? I just want the stupid html out of my way in the main script.
All help appreciated
Moderator: General Moderators
Code: Select all
<?php
if($cookies){?>
<b>heloo</b>
<?php } ?>Yeah, thats a good method.thetooth wrote:the way i do it is insted of putting the echo command i end the php block and enter my html and then open it up againCode: Select all
<?php if($cookies){?> <b>heloo</b> <?php } ?>
How about...aditya2071990 wrote:I like this method, but I need to output the html based on a condition, like if(logged in){ then show the html } so if I simply end the php tags, the html shows up anyway... any other methods?
Code: Select all
<?php
...
if($_SESSION['logged_in']) include("inc/logged_in.php"); else include("inc/logged_out.php");
...
?>Code: Select all
<?php
...
if($someVariable)
{
?>
<p>Some variable equals true!</p>
<?php
}else{
?>
<p>Some variable equals false!</p>
<?php
...
?>Code: Select all
require('Smarty.class.php');
$smarty = new Smarty();
$var1 = 'Hello World';
$smarty->assign('var1', $var1);
$smarty->display('index.html');
Code: Select all
<!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>Untitled Document</title>
</head>
<body>
<p>{$var1}</p>
</body>
</html>