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

Link to comment
Share on other sites

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');
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.