Jump to content

help making a code box


CyDrive

Recommended Posts

Pretty simple. Ill start you off. You could do something like this:

<?php

function codedefine($content)
{?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#666666"><?= $content; ?></td>
	</tr>
	</table>
<?php
}
$text = "hello";
echo codedefine($text);

?>

Sorry i cannot find the edit post button so....

 

I have implemented the code as you said but it dosent work. Though let me explain what im trying to do. I have a tutorial page on my site. The tutorials are read from a database as we'll as the content of the tutorial.  I have evrything done but the actual displaying of the tutorials contents where i will also be able to store code. Here is the page that displays the tutorial.

 

<?
function code($content)
{?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">	
<tr>
<td bgcolor="#666666"><?echo $content; ?></td>
</tr>
</table>
<?
}
include("header.php");
$tut = $_GET['tutorial'];
$database = "usersystem";
$connection = mysql_connect($host, $user,$passwor) or die ("Could not connect to server."); 
$db = mysql_select_db($database, $connection) or die ("Could not select database.");
$ret = mysql_query("SELECT * FROM tutorial");
$disp = mysql_result($ret,$tut,'content');
echo $disp;
include("footer.php");
?>

 

Now say it pulls this from the database.

 

<? code("<html>"); ?>

 

it would display it like this.

 

"); ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.