The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
first x words
I've written a some scripts to pull out posts from specific forums to display on non-vb pages, but am having trouble cropping the sentence for display on the article listing page. If you want to see my problem, go here http://www.numbmonkey.com. Basically, I want the title and the first x words displayed. I've tried two different functions to crop at x characters or x words, but they have a tendancy to cut URL links in half. How can I crop after so many words with busting the vbulletin URL tags.
Here are the two scripts I tried (first one adds a nice "..." after crop): PHP Code:
PHP Code:
Thanks, -Matt |
#2
|
|||
|
|||
While it's not exactly what you want, why not just try PHP's http://www.php.net/wordwrap function?
|
#3
|
||||
|
||||
Thanks for the idea of using wordwrap. It sort of worked by keeping the long URL's from breaking the design, but it didn't fix them not getting converted into a usable link. In my text format function, I have it convert the vbulleting [URL] tag into an html link. I think that the way my cropsentence function (seen in my first post) is working is preventing this conversion from working correctly.
Here's what I use to convert the [URL] into a link: PHP Code:
|
#4
|
|||
|
|||
Side note: use the preg (preg_replace) instead of the ereg (ereg_replace) functions for speed.
If these non-vB pages have global.php included, you can just use the bbcodeparse2() function to do all the work. |
#5
|
||||
|
||||
Oh man ... you gotta be kidding. Here I am banging my head against the desk trying to figure out how to do this and I could have been using bbcodeparse2? Can you give any guidance on how to use it? I found the function but am not sure what I have to pass into it?
Thanks! -Matt |
#6
|
||||
|
||||
Can anyone explain how to use the bbcodeparse2() function? What variables to I have to pass into it?
|
#7
|
|||
|
|||
Look at the header for it...
|
#8
|
||||
|
||||
PHP Code:
PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|