Matpatnik Posted April 12, 2007 Share Posted April 12, 2007 Hi guys,I just find out about the function: substr($VAR, 0, 100). It's a cool function for news but limited to plain text.My problem is that it can mess the code and/or the validation when using it with BBcode and I would like to know if there is a way to keep the text shortned and having a the code in good condition. I've looked on php.net and browsed on google and didn't find anything useful.If there is nothing I can do about it then I will just add a textarea in the news form for the brief presentation of the news.Thank you for your idea Link to comment Share on other sites More sharing options...
Xenon Design Posted April 12, 2007 Share Posted April 12, 2007 Im not quite sure what you mean. Could you post some code or a more detailed explination? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 13, 2007 Share Posted April 13, 2007 substr is a string function. All it does is return part of a string. It doesn't look at anything with regard to the content of the string, like whether or not it contains HTML tags. That's not what PHP does, this function is simply for taking a substring out of a given string. If you want to take HTML tags into account, then you need to search for the tags yourself and make sure you aren't breaking anything. Or you can also use the striptags function to remove all tags. Link to comment Share on other sites More sharing options...
Matpatnik Posted April 13, 2007 Author Share Posted April 13, 2007 What I thought I could use the function to make the text of the news shorter in an home page but the news contain BBcode in it so it won't be a good idea in this purpose. I will use my second idea to do that then.Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now