Jump to content

[SOLVED] How do i make this suitable for php?


paulman888888

Recommended Posts

I want to put this is my php code.

 

<table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
  <tr><td width="23%" rowspan="2"><table width="66%" border="1" bordercolor="#000000"><tr><td><center><img src="http://www.civage.com/team/images/paul.gif" alt="Demo" width="175" height="170" longdesc="demo" />
  </center></td></tr><tr><td><center>In Game Screenshot</center></td></tr></table></td>
  <td width="68%" height="38"><strong>Area T9</strong></td>
  <td width="9%"><img src="../Images/flag/UK.png" alt="English" width="65" height="34" longdesc="English"></td></tr><tr><td colspan="2"><p>Size: 9.4mb<br />
        Version: 1<br />
        Type: Beta<br />
        <a href="http://civage.com/downloads/index.php?act=view&id=7" target="_self" onMouseOver="MM_swapImage('Download','','../downloads/skins/old/images/download.gif',0)" onMouseOut="MM_swapImgRestore()"><img src="../downloads/skins/old/images/download.gif" alt="Download" name="Download" width="142" height="52" border="0"></a></p></td></tr>
  <tr>
    <td colspan="3"><center>
      Loads of mini games!
    </center>
    </td>
  </tr>
</table>

 

For my preloaded content but how do i get in the code?

 

<?php
function freeRTE_Preload($content) {
// Strip newline characters.
$content = str_replace(chr(10), " ", $content);
$content = str_replace(chr(13), " ", $content);
// Replace single quotes.
$content = str_replace(chr(145), chr(39), $content);
$content = str_replace(chr(146), chr(39), $content);
// Return the result.
return $content;
}
// Send the preloaded content to the function.
$content = freeRTE_Preload("THIS IS WHERE I WANT TO PUT THE FIRST CODE I GAVE YOU")

?>

 

Thankyou for the help

um...like this?

 

<?php
function freeRTE_Preload($content) {
// Strip newline characters.
$content = str_replace(chr(10), " ", $content);
$content = str_replace(chr(13), " ", $content);
// Replace single quotes.
$content = str_replace(chr(145), chr(39), $content);
$content = str_replace(chr(146), chr(39), $content);
// Return the result.
return $content;
}

ob_start();
?>
<table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
  <tr><td width="23%" rowspan="2"><table width="66%" border="1" bordercolor="#000000"><tr><td><center><img src="http://www.civage.com/team/images/paul.gif" alt="Demo" width="175" height="170" longdesc="demo" />
  </center></td></tr><tr><td><center>In Game Screenshot</center></td></tr></table></td>
  <td width="68%" height="38"><strong>Area T9</strong></td>
  <td width="9%"><img src="../Images/flag/UK.png" alt="English" width="65" height="34" longdesc="English"></td></tr><tr><td colspan="2"><p>Size: 9.4mb<br />
        Version: 1<br />
        Type: Beta<br />
        <a href="http://civage.com/downloads/index.php?act=view&id=7" target="_self" onMouseOver="MM_swapImage('Download','','../downloads/skins/old/images/download.gif',0)" onMouseOut="MM_swapImgRestore()"><img src="../downloads/skins/old/images/download.gif" alt="Download" name="Download" width="142" height="52" border="0"></a></p></td></tr>
  <tr>
    <td colspan="3"><center>
      Loads of mini games!
    </center>
    </td>
  </tr>
</table>
<?php
$contents = ob_get_clean();
$content = freeRTE_Preload($contents);
?>

 

or...you can have the HTML in a seperate file...i'm gonna call it template.html

<?php
function freeRTE_Preload($content) {
// Strip newline characters.
$content = str_replace(chr(10), " ", $content);
$content = str_replace(chr(13), " ", $content);
// Replace single quotes.
$content = str_replace(chr(145), chr(39), $content);
$content = str_replace(chr(146), chr(39), $content);
// Return the result.
return $content;
}
// Send the preloaded content to the function.
$content = freeRTE_Preload(file_get_contents('template.html');
?>

try using quotes around the table you want to enter i have created php pages with html in before and if you are asking what i think you are then it would be displayed like

 

'<table> etc etc

</table>'

 

i have used this method when generating an html based email to be sent out using php.

try using quotes around the table you want to enter i have created php pages with html in before and if you are asking what i think you are then it would be displayed like

 

'<table> etc etc

</table>'

 

i have used this method when generating an html based email to be sent out using php.

 

I cant use that because my HTML page has ' in them so it makes errors.

 

Anymore ideas?

 

Thankyou

that doesn't work. The editor doesn't load or appear.

 

this is the full code

 

<?php
function freeRTE_Preload($content) {
// Strip newline characters.
$content = str_replace(chr(10), " ", $content);
$content = str_replace(chr(13), " ", $content);
// Replace single quotes.
$content = str_replace(chr(145), chr(39), $content);
$content = str_replace(chr(146), chr(39), $content);
// Return the result.
return $content;
}
// Send the preloaded content to the function.
$content = freeRTE_Preload("THIS IS WHERE I WANT MY HTML CODE")

?>
<form method="post" action="addgame.php">
  <p>Name: 
    <label>
    <input type="text" name="Name" id="Name" />
    </label>
  </p>
  <p>
    <!-- Include the Free Rich Text Editor Runtime -->
    <script src="freerte_v1/js/richtext.js" type="text/javascript" language="javascript"></script>
    <!-- Include the Free Rich Text Editor Variables Page -->
    <script src="freerte_v1/js/config.js" type="text/javascript" language="javascript"></script>
    <!-- Initialise the editor -->
    <script>
initRTE('<?= $content ?>', 'example.css');
    </script>
    <input type="submit">
    </p>
</form>

I how that helps.

 

Please help

Thankyou

 

woah...back up a sec...where is the 'content' that is going inside the editor coming from?

 

the code you posted looks fine. try using real php tags instead of the short tags...

initRTE('<?php echo $content; ?>', 'example.css');

 

 

<?php
function freeRTE_Preload($content) {
// Strip newline characters.
$content = str_replace(chr(10), " ", $content);
$content = str_replace(chr(13), " ", $content);
// Replace single quotes.
$content = str_replace(chr(145), chr(39), $content);
$content = str_replace(chr(146), chr(39), $content);
// Return the result.
return $content;
}
// Send the preloaded content to the function.
$content = freeRTE_Preload("THIS IS WHERE I WANT MY HTML CODE")

?>
<form method="post" action="addgame.php">
  <p>Name: 
    <label>
    <input type="text" name="Name" id="Name" />
    </label>
  </p>
  <p>
    <!-- Include the Free Rich Text Editor Runtime -->
    <script src="freerte_v1/js/richtext.js" type="text/javascript" language="javascript"></script>
    <!-- Include the Free Rich Text Editor Variables Page -->
    <script src="freerte_v1/js/config.js" type="text/javascript" language="javascript"></script>
    <!-- Initialise the editor -->
    <script>
initRTE('<?php echo $content; ?>', 'example.css');
    </script>
    <input type="submit">
    </p>
</form>

um...like this?

 

or...you can have the HTML in a seperate file...i'm gonna call it template.html
[code]<?php
function freeRTE_Preload($content) {
// Strip newline characters.
$content = str_replace(chr(10), " ", $content);
$content = str_replace(chr(13), " ", $content);
// Replace single quotes.
$content = str_replace(chr(145), chr(39), $content);
$content = str_replace(chr(146), chr(39), $content);
// Return the result.
return $content;
}
// Send the preloaded content to the function.
$content = freeRTE_Preload(file_get_contents('template.html');
?>

I have used that and what you said and it comes up with this error.

 

Parse error: parse error, unexpected ';' in /home/www/notgiveingmyproperwebsite.com/addinggame2.php on line 13

[/code]

All the code together should look like:

 

<table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
  <tr><td width="23%" rowspan="2"><table width="66%" border="1" bordercolor="#000000"><tr><td><center><img src="http://www.civage.com/team/images/paul.gif" alt="Demo" width="175" height="170" longdesc="demo" />
  </center></td></tr><tr><td><center>In Game Screenshot</center></td></tr></table></td>
  <td width="68%" height="38"><strong>Area T9</strong></td>
  <td width="9%"><img src="../Images/flag/UK.png" alt="English" width="65" height="34" longdesc="English"></td></tr><tr><td colspan="2"><p>Size: 9.4mb<br />
        Version: 1<br />
        Type: Beta<br />
        <a href="http://civage.com/downloads/index.php?act=view&id=7" target="_self" onMouseOver="MM_swapImage('Download','','../downloads/skins/old/images/download.gif',0)" onMouseOut="MM_swapImgRestore()"><img src="../downloads/skins/old/images/download.gif" alt="Download" name="Download" width="142" height="52" border="0"></a></p></td></tr>
  <tr>
    <td colspan="3"><center>
      Loads of mini games!
    </center>
    </td>
  </tr>
</table>

 

<?php
function freeRTE_Preload($content) {
// Strip newline characters.
$content = str_replace(chr(10), " ", $content);
$content = str_replace(chr(13), " ", $content);
// Replace single quotes.
$content = str_replace(chr(145), chr(39), $content);
$content = str_replace(chr(146), chr(39), $content);
// Return the result.
return $content;
}
?>
<form method="post" action="addgame.php">
  <p>Name: 
    <label>
    <input type="text" name="Name" id="Name" />
    </label>
  </p>
  <p>
    <!-- Include the Free Rich Text Editor Runtime -->
    <script src="freerte_v1/js/richtext.js" type="text/javascript" language="javascript"></script>
    <!-- Include the Free Rich Text Editor Variables Page -->
    <script src="freerte_v1/js/config.js" type="text/javascript" language="javascript"></script>
    <!-- Initialise the editor -->
    <script>
initRTE('<?php freeRTE_Preload(file_get_contents('template.html')); ?>', 'example.css');
    </script>
    <input type="submit">
    </p>
</form>

This is the page source from FIREFOX.

 

<form method="post" action="addgame.php">
  <p>Name: 
    <label>
    <input type="text" name="Name" id="Name" />
    </label>
  </p>
  <p>
    <!-- Include the Free Rich Text Editor Runtime -->
    <script src="freerte_v1/js/richtext.js" type="text/javascript" language="javascript"></script>

    <!-- Include the Free Rich Text Editor Variables Page -->
    <script src="freerte_v1/js/config.js" type="text/javascript" language="javascript"></script>
    <!-- Initialise the editor -->
    <script>
initRTE('', 'freerte_v1/examples/example.css');
    </script>
    <input type="submit">
    </p>
</form>

 

Hope it helps

 

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.