Joomla frontpage newsFeed problem

    I was referencing a problem of hiding part or whole of frontpage articles on Joomla 1.5.x when i came across the only option i had for serving the frontpage feeds .
Introtext or Fulltext . Huuuggghh?? What if I want to serve part of an article or half of it .
It was much quicker  to write my own custom solution and so I did ( not sure though if it the best though , maybe there are plugins to do such things , but i did not w3ant to use any )

Frontpage Rss are served through the view.feed.php in components\com_content\views\frontpage

`    I wrote a small block with two function   , let’s call it myfunctions.php and place it in the same directory

The code looks like that
<?php

function shorten_string($string, $wordsreturned)

{
$retval = $string;
$array = explode(‘ ‘, $string);
if (count($array)<= $wordsreturned) {
$retval = $string;
}
else {
array_splice($array, $wordsreturned);
$retval = implode(‘ ‘, $array).’ …’;
}
return $retval;
}
function half_string($string)

{
$halfwords =  round((str_word_count($string) /2 ));

$retval = $string;
$array = explode(‘ ‘, $string);
if (count($array)<= $halfwords) {
$retval = $string;
}
else {
array_splice($array, $halfwords);
$retval = implode(‘ ‘, $array).’ …’;
}
return $retval;
}

?>

The first function takes two parameters   , the string ( article data ) , and the number of words we want to return . The Second one uses only the article data as input and
return exactly half words of it .

Next step is import it in view.feed.php  . We need to reference it with
require_once(dirname(__FILE__) . “/myfunctions.php”);

Final step is find the line that returns the description string ( article data )  and use the functions we wrote accordingly
$description  =  $params->get(‘feed_summary’, 0) ? $row->introtext.$row->fulltext : $row->introtext);  ( line 59 I believe )

we comment it out and write
$description =   half_string($row->introtext.$row->fulltext ) ;
Voila . A quick and dirty ( too dirty i admit )  solution. to get the job done !!