- Joined
- Aug 20, 2008
- Messages
- 93
- Reaction score
- 0
I want to translate a whole html template into php without echoing every single line. How should I do this?
Sorry I don't really get your question. Can you explain it with an example perhaps?
So basically what you're trying is that when you go to ?p=proness, you want to show support.php, but not included inside the index.php. Instead you want the index.php not to show? is that correct?
<?php
//instead of
if($foo == $bar)
{
//echo echo echo
}
//do this
if($foo == $bar)
{
?>
<!-- insert html -->
<?
}
?>
echo "
<h3>html here and other stuff</h3>
";
I have the perfect solution
Yellowpipe - HTML converter: HTML to PHP, HTML to Javascript, HTML to ASP
use that. HTML --> JS / PHP / ASP
<?php
echo "<h1>Hello</h1>\n";
echo "\n";
echo "What are you doing right now, omg?\n";
?>
<?PHP
echo "<h1>Hello</h1> What are you doing right now, omg?";
?>
<?php
$section = $_GET['p'];
if($section == support) {
include 'support.php';
}
?>
Not sure of your question either.. But are you saying you want support.php to be shown on the index.html page if ?p=support ?
If so you could just insert the following into your <div> </div>(or where ever you want it..) content area in index.html
PHP:<?php $section = $_GET['p']; if($section == support) { include 'support.php'; } ?>
<?php
$section = $_GET['p'];
if($section == 'support')
include('support.php');
else
include('index.php');
?>
<?php
$section = $_GET['p'];
//The pages that are not allowed to be reached by the visitor
$forbidden = array('config.php', 'settings.php');
if(!in_array($section, $forbidden) && file_exists($section.'.php'))
include($section.'.php');
else
include('index.php');
?>
or if you want to do it much more fun like:
PHP:<?php $section = $_GET['p']; //The pages that are not allowed to be reached by the visitor $forbidden = array('config.php', 'settings.php'); if(!in_array($section, $forbidden) && file_exists($section.'.php')) include($section.'.php'); else include('index.php'); ?>
Whao, i've never thought about doing that.. I'm gonna use that more often now. :]
//The pages that are not allowed to be reached by the visitor
$forbidden = array('config', 'settings');