Website description help

vnevermore

Member
As you can see here, even if paste on the description code/text with more than one line,
http://prntscr.com/d6ouwq
when i save it, it becomes a huge paragraph with 1 line, which makes it kinda ungly if you ask me.
http://prntscr.com/d6ovf0

I know it can make problem on the design on the index but i will handle this problem with CSS.
I think the problem is on the way that is stored on the database.

I've made a research over forum, i don't wanna use second description.
I didn't found something about this, but still i ve seen some visiolist toplists having this feature working.

Any help or idea?
 

vnevermore

Member
the whole description is on a paragraph like:
Code:
<p>{$description}</p>
... i will need to force user's to put it like this...
otherwise i will need to edit some core-script i guess to replace line separator with a </br> for example
 

vnevermore

Member
this plugin makes a second description, which actually is not what i was looking for
looking into the source's i found out that all \r\n are replaced with a space line ' '.
removing this replacement would give me another problems, i will have to use nl2br() function when the data comes from the database to display
however, still no luck to make it work proper
 

vnevermore

Member
Okey i fixed it somehow,
talking about the edit.php file for example

I started removing completely the line
Code:
$description_prepare = str_replace(array("\r\n", "\n", "\r"), ' ', $FORM['description']);
then i removed $DB->escape() function when data is parsed from the FORM to $TMPL['category'] var
and then i replaced a few lines above
Code:
$TMPL['description'] = preg_replace('/[^A-Za-z0-9 .,\-]/', '', $TMPL['description']);
with
Code:
$TMPL['description'] = preg_replace('/([^A-Za-z0-9 .,\-\r\n\t])+/', '', $TMPL['description']);
which actually allows also tab spases,new lines etc to be saved on the database

and finally to display the results on the html page i used white-space: pre on the css to force html represen break lines

@Mark , @Basti
you think what i ve done is okey, or it can cause any problem? i am afraid just for the removal of the $DB->escape() function.
and also i would like to point out, that maybe it was unnecessary on this part of code, since you preg_replace the symbols etc , 2 times

well, i mean what escape does is already done by preg_replace, or i am wrong?
thanks for your time anyway
 

Mark

Administrator
Staff member
There was an issue with the escape function, that extra preg_replace() function was really just a temp security fix. Basti had made some changes that I did not roll into 1.5 release, I suspect this is one of them.

You should be safe with your edit, though finding a way to handle this via plugin would be the best solution so you dont need to apply this change after each update.
 

vnevermore

Member
There was an issue with the escape function, that extra preg_replace() function was really just a temp security fix. Basti had made some changes that I did not roll into 1.5 release, I suspect this is one of them.

You should be safe with your edit, though finding a way to handle this via plugin would be the best solution so you dont need to apply this change after each update.
yes you are right, still i am not very familiar with the plugin system but i am planing starting work with it..
wherever i edit the source's i put a comment, so searching a specific word will give me back all edited code places , but yes this means i will have to re-install 1.6 and parse all changes again :/
 
Top