Jump to content
xisto Community
Sign in to follow this  
wappy

String/text Formatting?

Recommended Posts

right i was wondering if someone could help me with this:

I notice on this site if i make a topic for example WAppY rOCks WaP, it will come out like Wappy Rocks Wap. I also want to do this to my forums, can anyone give me the code to format a string of text in this way?

THANKS IN ADVANCE

Share this post


Link to post
Share on other sites

PHP has a selection of string modifying functions to handle this. In fact you will have to use two of them together in the following fashion:

<?php$foo = 'HeLlO wOrLd!';echo $foo;$foo = ucwords(strtolower($foo));echo $foo;?>

Untested, but it should work exactly as you want. It is slightly modified from the php manual.The strtolower function converts the entire string to lowercase and then the ucwords function converts the starting character of each word to uppercase. How and when and where these functions need to be applied to your Forum is another topic and would be dependent on the Forum specific coding. Essentially, use this code whenever the topic title is displayed.

Share this post


Link to post
Share on other sites

Many thanks :-)i should of really looked at php.net for this (now i realise how simple it is).Its just i made a mod for my wap forums where the latest replied to topic is shown above my forum categories. I (when making categories) use this format of writing but other users don't so i wanted to format it so it appears this way and matches my categories, just a small detail to make it look more professional.

Share this post


Link to post
Share on other sites

The php Manual can be downloaded to your desktop / Laptop so that it is readily available even if you are off line at the time. It only takes a few minutes ant then you are never without it.

Share this post


Link to post
Share on other sites

Yes i know this but i work from a symbian phone (nokia 6630) and have built my site and also browse with this. I have a pc but its broken and i won't have money to fix it for a while. So i can't really use the php manual on this as i believe its like a 2mb file, if i open a file so big while im browsing it will slow me down way to much. But yes i will download it anyway. I find the web site more helpfull though with its search and examples :-)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.