Closed avs-code closed 8 years ago
http://sparkadsl.0lx.net/pruebas/?page=show_rules
Fixed with :
<?php
$str= file_get_contents("rules.rtf");
$str = nl2br($str, true);
// for XHMTL (in other words <br />). Use false for <br>. i.e $str = nl2br($str, false);
echo $str;
?>
May be best using the php upload funtion to insert a link in data base and this showing in show_rules.php, for example to pdf link. Its this best option?
For the show_rules u should have an editor into the admin section, so with an WYSIWYG editor the user (admin user) will be able to modify it, without the needing of upload anything into the server.
investigating about wysiwyg
In index file I have this:
<script src="tinymce/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: '#tinyeditor',
theme: 'modern',
width: 600,
height: 300,
plugins: [
'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker',
'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
'save table contextmenu directionality emoticons template paste textcolor'
],
content_css: 'href="http://www.w3schools.com/lib/w3.css"',
toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons'
});
</script>
basic script with extra options and plugins. I dont know if is better insert the script into the editor php file (edit_rules_mods) or is right in index.php.
In edit_rules_mods.php I have this:
<? if(!defined("CONFIG")) exit(); ?>
<? if(!isset($login)) { show_error("You do not have administrator rights\n"); return; } ?>
<form method="post">
<textarea id='tinyeditor' cols="50" rows="15"></textarea>
<input type="submit" value="Save" />
</form>
<form method="post" action="show_rules_mods.php">
</form>
In show_rules.php I have this:
<? if(!defined("CONFIG")) exit(); ?>
<?php
$str= file_get_contents("rules.rtf");
$str = nl2br($str, true); // for XHMTL (in other words <br />). Use false for <br>. i.e $str = nl2br($str, false);
echo $str;
?>
<?php
echo(stripslashes($_POST['content']));
?>
http://sparkadsl.0lx.net/PREM/?page=show_rules