play_ Posted August 31, 2009 Share Posted August 31, 2009 From a blog entry, php echoes this line to the browser: <Directory /media/Shared/sites/www/subdomains/expyred/> It doesn't show, because HTML tries to parse it, i believe. Which means i have to convert < into >, etc. However, when typing the blog, i do insert html characters such as <b> and <u>, etc. What is the simplest way I could I make it so any HTML tags get parsed, but non-html tags don't? Do i have to resort to bbcode? Link to comment https://forums.phpfreaks.com/topic/172559-solved-parsing-html-tags/ Share on other sites More sharing options...
Garethp Posted August 31, 2009 Share Posted August 31, 2009 That would be an idea, or have an array of tags, such as I don't know if this would work, but give it a try $Input = preg_replace('~(<[^bui]+)>~', '>$1>', $Input); But that would still only work for things that are just <b> or <u> or <bbb> or such. BBCode is best really. But that's just me, there's probably a better answer Link to comment https://forums.phpfreaks.com/topic/172559-solved-parsing-html-tags/#findComment-909711 Share on other sites More sharing options...
mikesta707 Posted August 31, 2009 Share Posted August 31, 2009 yeah BBCode is probably the best way, although I guess you could htmlentities everything, and than go back and un-entity the tags you want. but either way its about the same TBH Link to comment https://forums.phpfreaks.com/topic/172559-solved-parsing-html-tags/#findComment-909724 Share on other sites More sharing options...
play_ Posted September 1, 2009 Author Share Posted September 1, 2009 bbcode it'll be I just wish passing '<Directory>' to strip_tags() would work =( Link to comment https://forums.phpfreaks.com/topic/172559-solved-parsing-html-tags/#findComment-909974 Share on other sites More sharing options...
corbin Posted September 1, 2009 Share Posted September 1, 2009 Hrmmm, instead of a fullout BBCode system, you could have a htmlentities BBCode. It would be pretty ghetto, but you could do something like: [htmlentities]<Directory /media/Shared/sites/www/subdomains/expyred/>[/htmlentities] Then server side: $str = preg_replace('/\[htmlentities\](.*?)\[\/htmlentities\]/ie', "htmlentities('\1')"); Link to comment https://forums.phpfreaks.com/topic/172559-solved-parsing-html-tags/#findComment-909978 Share on other sites More sharing options...
play_ Posted September 3, 2009 Author Share Posted September 3, 2009 thats not a bad idea corbin. Link to comment https://forums.phpfreaks.com/topic/172559-solved-parsing-html-tags/#findComment-911426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.