Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
floppydrivez
Involved
Involved



Joined: Feb 26, 2006
Posts: 340
Location: Jackson, Mississippi

PostPosted: Wed Sep 06, 2006 4:43 pm Reply with quote

Alright I am pulling some text from the db, but I don't want it to be too long.

So here is what I got
Code:


<strong>&middot;</strong>&nbsp;<b>(<a href=\"modules.php?name=$module_name&op=view&eid=$eid\">$title</a>)</b>$text


$text being my variable.
 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
floppydrivez







PostPosted: Wed Sep 06, 2006 4:53 pm Reply with quote

answered my own question with a little research. Anyway for others

Code:
$home_length = '25';

$home_text = cut_word($hometext, $home_length);
 
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Wed Sep 06, 2006 5:31 pm Reply with quote

Where did you find this cut_word function? I don't see it in my PHP manual. I guess you could write a function to do this but why?

$home_text = substr($text, 0, 25);

will do it.

Or to eliminate a couple steps:

Code:


<strong>&middot;</strong>&nbsp;<b>(<a href=\"modules.php?name=$module_name&op=view&eid=$eid\">$title</a>)</b>substr($text, 0, 25);


Gotta save 3 nanoseconds with that and a couple bytes of memory.
 
View user's profile Send private message Visit poster's website
floppydrivez







PostPosted: Wed Sep 06, 2006 5:33 pm Reply with quote

thats a much better way thanks for the snappy reply.

Here's another off topic question if the date pulled from db is formated like so.

yyyy/mm/dd

How can I change to

mm/dd/yyyy
 
floppydrivez







PostPosted: Wed Sep 06, 2006 5:42 pm Reply with quote

$startDate = date('M d, Y', strtotime($date));

Yes I plan to try to answer all my own ?'s and then post my results! Smile

Until I learn I should look before I ask. Thanks for all that kelly
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Thu Sep 07, 2006 6:08 am Reply with quote

Quote:

Until I learn I should look before I ask

I have definitely found that this helps me to learn it better... If I don't first try to figure it out on my own, I will not learn as much and it won't "stick" in my mind.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Thu Sep 07, 2006 11:56 am Reply with quote

Basically the php.net manual lists every function and how they can be used. It takes a little to figure out which function to use, but trust me, its there

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
floppydrivez







PostPosted: Thu Sep 07, 2006 7:42 pm Reply with quote

Your right montego, giving it a good go on my own was much more valuable.
Image

Thanks again
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©