Welcome Guest, Not a member yet? Register   Sign In
How to format text with admin page
#1

[eluser]tirithen[/eluser]
I'm making an adminpage for a website and I have two questions on text formatting, I have a page that uses a form to insert text into a database table, when I extract the text and view it with a echo command I won't get any line-break as it displays the text as html code. How do I do to strip the text from html tags and insert a <p></p> per each line-break the easiest way, I have a feeling that some of this handling is included in Code Igniter...

The other thing I wonder about is how to make the CSS dynamic since it's commonly stored as a file and not in a database and I want to be able to change the font and colors from within my adminpage. Which mehods are possible, could the CSS information be included in the generated html file in the heather or something like that or is there a way of creating and modifying an CSS file directly without a database, seem more complicated though.
#2

[eluser]xwero[/eluser]
The easiest solution is using a wysiwyg editor for the input. The editor takes care of the formating and you just check if there are not allowed html tags or attributes (script, onclick, ...)
#3

[eluser]tirithen[/eluser]
Yes I know but I would like to have a form much like this forum post form, and then a CSS page where I can choose from drop down menus fonts and colors and so on to make it easy to use for anyone and to ensure that the same CSS styles are used in the whole website. Editing should be like writing a word document but with the onely choises for fronts and sizes from the CSS formats.
#4

[eluser]tirithen[/eluser]
Could someone give me some fast hints on how to get line-breaks to show on a webpage like the <pre> tag but without the change of font. Like when I do this


My text placements are a few lines down. Do I have to search the textarea for any "return" characters and replace them with <br> or how should I do?

If I view the html code for this thread I can see that the line-break ends up like a <p> tag bur how did the code find the "return" character to replace it with an <p> tag, did it search for the return ASCII code?
#5

[eluser]xwero[/eluser]
you could use the nl2br function.
#6

[eluser]tirithen[/eluser]
Thanks thats the thing that I was looking for, missed the typography when I looked in the user guide. Thanks :-D
#7

[eluser]xwero[/eluser]
it's a native php function Smile
#8

[eluser]esra[/eluser]
tirithen... take a look at Coolfactor's proposed View library for CodeIgniter. It currently does what you want. Since it is a library, it can also be subclassed (extended) and the methods can be overloaded to create custom View classes.

For example, it's possible to create something like an EditView with an embedded Javascript text editor or a GridView, TreeView, etc..
#9

[eluser]tirithen[/eluser]
Thanks, I'll look at that, thanks for all the help. :-)




Theme © iAndrew 2016 - Forum software by © MyBB