Anybody got a little spare time to help me out with a little OOP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



coz i suck at OOP!

Hey!

Am trying to modify a wordpress plugin file,the name of the plugin is POST TEASER and can be downloaded from here http://wordpress.org/extend/plugins/post-teaser/, it works as advertised and this is what it does:

I specify for
example 4 words before the page should be "cut",  it first breaks the
page down into blocks based on the <p> and </p> tags

example
<p> this will be block 1</p>
<p> this will be block 2</p>
<p> this will be block 3</p>
etc

then
it counts the words in block 1, if its equal to the number of words i
specified.. it returns the whole block if not it returns block1 and
block 2 etc...

What i am trying to make it do is... if i specify 3 workds it returns EXACTLY 3 
words like so:
"This will be.... read more inside!"
 

I have written the code to get the above output... but being a total dumbo at OOP i dont know where to 'insert' the code.
here is the code I have come up with:

================================== Start code ============================================
$sample_string="From http://www.ezee.se/ The UK police are by far one of the most open to being greedy and corrupted by their afore mentioned greed, case and point: the hundreds of extra speed cameras that are put in place with an idea of making more money rather than public safety, cameras that get fines that are around 100 million pounds per year! Heres one example..";

$words=explode(" ", $sample_string);
$no_to_display=12;

for($i =0; $i < $no_to_display; $i++)     
{$make_string_again .= $words[$i]." ";} 

echo $make_string_again."... read more inside!";

==================================== end code ===========================================

Have upped the file here if you want to give it a shot.... the script is pretty well self documented too via comments in the script.


Thanks in advance,
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



      

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux